本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Admin.GroupManagement类的典型用法代码示例。如果您正苦于以下问题:Python GroupManagement类的具体用法?Python GroupManagement怎么用?Python GroupManagement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupManagement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: putGroup
def putGroup(self, group, user=None):
""" Creates a group, or if a user is passed, adds that user to the group """
if(user != None):
# assume group exists and add user to it
return GroupManagement.addUserToGroup(user, group)
if GroupInfo.groupExists(group):
return "Group already exists"
GroupManagement.addGroup(group)
示例2: deleteUser
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)
示例3: getGroup
def getGroup(self, group=None, user=None):
""" No args lists all groups, one args returns JSON with users and priority """
if group != None:
result = {}
result['users'] = GroupInfo.usersInGroup(group)
result['priority'] = GroupManagement.getPriority(group)
return json.dumps(result)
elif user != None:
return GroupInfo.groupsForUser(user).keys()
else:
return GroupInfo.listGroups()
示例4: deleteGroup
def deleteGroup(self, group, user=None):
""" If no user is sent, delete the group. Otherwise, delete the user from the group """
if user == None:
return GroupManagement.deleteGroup(group)
else:
return GroupManagement.removeUserFromGroup(user, group)
示例5: handleAddToGroup
def handleAddToGroup(self, user, group):
""" Adds a user to the group """
self.validate(user)
self.validate(group)
GroupManagement.addUserToGroup(user, group)
return "Added %s to %s " % (user, group)
示例6: handleAddGroup
def handleAddGroup(self, group):
""" Handles adding a group """
self.validate(group)
GroupManagement.addGroup(group)
return "Added group %s " % group
示例7: handleGroupPriority
def handleGroupPriority(self, group, groupPriority):
""" Handles setting group priority """
self.validate(group)
GroupManagement.setPriority(group, groupPriority)
return "Updated group %s priority to %s" % (group, groupPriority)
示例8: group
def group(self, groupName):
""" Web page of details about the user, and sets user priority """
self.validate(groupName)
users = GroupInfo.usersInGroup(groupName)
priority = GroupManagement.getPriority(groupName)
return self.templatepage("Group", group=groupName, users=users, priority=priority)