Esempio n. 1
0
def isAtLeastMaster(cn):
	if sbserver.playerPrivilege(cn) > 0:
		return True
	try:
		return isUserAtLeastMaster(player(cn).user.id)
	except AttributeError, ValueError:
		return False
Esempio n. 2
0
def isAtLeastMaster(cn):
    if sbserver.playerPrivilege(cn) > 0:
        return True
    try:
        return isUserAtLeastMaster(player(cn).user.id)
    except AttributeError, ValueError:
        return False
Esempio n. 3
0
	def __call__(self, *args, **kwargs):
		args[0].setHeader('Content-Type', 'text/plain')
		try:
			username = args[1].args['username'][0]
			password = args[1].args['password'][0]
		except KeyError:
			return responses['invalid_login']
		user = userAuth(username, password)
		if not user:
			return responses['invalid_login']
		if isUserAtLeastMaster(user.id):
			return self.f(*(args + (user,)), **kwargs)
		else:
			return response('insufficient_permissions', 'User does not have master permissions')
Esempio n. 4
0
	def render_user_JSON(self, request, user):
		if not isUserAtLeastMaster(user.id):
			return response('insufficient_permissions', 'User does not have master permissions')
		return self.render_master_JSON(request, user)