 		id: @id
 		passphrase: @passphrase
 		members: x.id for x in @members
-
+			
 # Set up common functions
 getUserById = (id) ->
 	for user in userRegistry


userRegistry = []
groupRegistry = []
loggedUsers = []
hostBlacklist = JSON.parse Modules.fs.readFileSync ResourceDir + "blacklist.json"


	admin: 50
	owner: 2000

class KcIdentifier
	constructor: (@id) ->
		
class User extends KcIdentifier
	constructor: (id, @powerLevel, @auth) ->
		super id
		@connection = null
		@cipher = Modules.aes.createCipher @auth

	isQualifiedFor: (powerLevel) -> powerLevel <= @powerLevel
	toString: () -> "[User id=#{@id} powerLevel=#{@powerLevel}]"
	onConnect: (webSocketConnection) -> 
		@connection = webSocketConnection
		loggedUsers.push this
	onDisconnect: () -> @connection = null if @connection?
	authenticate: (pwd) -> Modules.sha pwd is @auth

