Beispiel #1
0
 def deleteUser(self, user):
     """ Deletes a user, as well as deleting his requests and removing
         him from all groups """
     if user in self.getUser():
         requests = json.loads(self.getUser(user))['requests']
         for request in requests:
             self.deleteRequest(request)
         for group in GroupInfo.groupsForUser(user).keys():
             GroupManagement.removeUserFromGroup(user, group)
         return UserManagement.deleteUser(user)
Beispiel #2
0
 def deleteUser(self, user):
     """ Deletes a user, as well as deleting his requests and removing
         him from all groups """
     if user in self.getUser():
         requests = json.loads(self.getUser(user))['requests']
         for request in requests:
             self.deleteRequest(request)
         for group in GroupInfo.groupsForUser(user).keys():
             GroupManagement.removeUserFromGroup(user, group)
         return UserManagement.deleteUser(user)
Beispiel #3
0
 def user(self, userName):
     """ Web page of details about the user, and sets user priority """
     self.validate(userName)
     groups = GroupInfo.groupsForUser(userName).keys()
     requests = UserRequests.listRequests(userName).keys()
     priority = UserManagement.getPriority(userName)
     allGroups = GroupInfo.listGroups()
     self.validate(groups)
     self.validate(requests)
     self.validate(allGroups)
     return self.templatepage("User", user=userName, groups=groups, 
         allGroups=allGroups, requests=requests, priority=priority)
Beispiel #4
0
 def getUser(self, userName=None, group=None):
     """ No args returns a list of all users.  Group returns groups this user is in.  Username
         returs a JSON with information about the user """
     if userName != None:
         if not Registration.isRegistered(userName):
             raise cherrypy.HTTPError(404, "Cannot find user")
         result = {}
         result['groups'] = GroupInfo.groupsForUser(userName).keys()
         result['requests'] = UserRequests.listRequests(userName).keys()
         result['priority'] = UserManagement.getPriority(userName)
         result.update(Registration.userInfo(userName))
         return result
     elif group != None:
         GroupInfo.usersInGroup(group)
     else:
         return Registration.listUsers()
Beispiel #5
0
 def getUser(self, userName=None, group=None):
     """ No args returns a list of all users.  Group returns groups this user is in.  Username
         returs a JSON with information about the user """
     if userName != None:
         if not Registration.isRegistered(userName):
             raise cherrypy.HTTPError(404, "Cannot find user")
         result = {}
         result['groups'] = GroupInfo.groupsForUser(userName).keys()
         result['requests'] = UserRequests.listRequests(userName).keys()
         result['priority'] = UserManagement.getPriority(userName)
         result.update(Registration.userInfo(userName))
         return result
     elif group != None:
         GroupInfo.usersInGroup(group)
     else:
         return Registration.listUsers()
Beispiel #6
0
 def user(self, userName):
     """ Web page of details about the user, and sets user priority """
     self.validate(userName)
     groups = GroupInfo.groupsForUser(userName).keys()
     requests = UserRequests.listRequests(userName).keys()
     priority = UserManagement.getPriority(userName)
     allGroups = GroupInfo.listGroups()
     self.validate(groups)
     self.validate(requests)
     self.validate(allGroups)
     return self.templatepage("User",
                              user=userName,
                              groups=groups,
                              allGroups=allGroups,
                              requests=requests,
                              priority=priority)
Beispiel #7
0
 def postUser(self, user, priority):
     """ Change the user's priority """
     return UserManagement.setPriority(user, priority)
Beispiel #8
0
 def handleUserPriority(self, user, userPriority):
     """ Handles setting user priority """
     self.validate(user)
     UserManagement.setPriority(user, userPriority)
     return "Updated user %s priority to %s" % (user, userPriority)
Beispiel #9
0
 def postUser(self, user, priority):
     """ Change the user's priority """
     return UserManagement.setPriority(user, priority)
Beispiel #10
0
 def handleUserPriority(self, user, userPriority):
     """ Handles setting user priority """
     self.validate(user)
     UserManagement.setPriority(user, userPriority)
     return "Updated user %s priority to %s" % (user, userPriority)