Ejemplo n.º 1
0
 def service_addUser(self, context, username, method, password, groups):
     username = getUsername(username)
     password = getPassword(password)
     groups = getList(getGroup, groups)
     #method is checked in auth_basemethods.AbstractAuth.hash_password
     if self.auth.addUser(username, method, password, groups):
         self.info(context, "User %s added" % username)
         yield self.modified()
         returnValue(True)
     returnValue(False)
Ejemplo n.º 2
0
def getAddressList(attr, key, address_type):
    default = (None,)
    if key not in attr:
        return default

    addresses = []
    for value in getList(getUnicode, attr.pop(key)):
        ips = getIP(value, address_type)
        addresses.extend(ips)
    if not addresses:
        return default
    return addresses
Ejemplo n.º 3
0
 def service_editUser(self, context, username, method, password, groups):
     """
     Edit a user account.
     password is optional
     """
     username = getUsername(username)
     password = getPassword(password, False)
     groups = getList(getGroup, groups)
     #method is checked in auth_basemethods.AbstractAuth.hash_password
     if self.auth.editUser(username, method, password, groups):
         self.info(context, "User %s modified" % username)
         yield self.modified()
         returnValue(True)
     returnValue(False)
Ejemplo n.º 4
0
 def service_groupCreate(self, context, id, library, objects):
     """
     Create a new group of objects:
         - id : unicode string of the group identifier
         - library : name of the library that stores this group ("applications", "protocols" ...)
         - objects: list of object identifiers contained in the group
     """
     id = getUnicode(id)
     objects = getList(getUnicode, objects)
     library = self.getRuleset(context).getLibrary(library)
     attr = {'id': id, 'objects': objects}
     updates = library.createGroup(attr)
     self.saveSession(context)
     return updates
Ejemplo n.º 5
0
def getIntegerList(value):
    return getList(getInteger, value)