def isAtLeastMaster(cn): if sbserver.playerPrivilege(cn) > 0: return True try: return isUserAtLeastMaster(player(cn).user.id) except AttributeError, ValueError: return False
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')
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)