Beispiel #1
0
 def save(self, widget, data):
     props =  ILDAPProps(self.plugin)
     users =  ILDAPUsersConfig(self.plugin)
     groups = ILDAPGroupsConfig(self.plugin)
     def fetch(name):
         name = 'ldapsettings.%s' % name
         __traceback_info__ = name
         return data.fetch(name).extracted
     props.uri = fetch('server.uri')
     props.user = fetch('server.user')
     password = fetch('server.password')
     if password is not UNSET:
         props.password = password
     # XXX: later
     #props.start_tls = fetch('server.start_tls')
     #props.tls_cacertfile = fetch('server.tls_cacertfile')
     #props.tls_cacertdir = fetch('server.tls_cacertdir')
     #props.tls_clcertfile = fetch('server.tls_clcertfile')
     #props.tls_clkeyfile = fetch('server.tls_clkeyfile')
     #props.retry_max = fetch(at('server.retry_max')
     #props.retry_delay = fetch('server.retry_delay')
     props.cache = fetch('cache.cache')
     props.memcached = fetch('cache.memcached')
     props.timeout = fetch('cache.timeout')
     users.baseDN = fetch('users.dn')
     map = odict()
     map.update(fetch('users.aliases_attrmap'))
     users_propsheet_attrmap = fetch('users.propsheet_attrmap')
     if users_propsheet_attrmap is not UNSET:
         map.update(users_propsheet_attrmap)
     users.attrmap = map
     users.scope = fetch('users.scope')
     users.queryFilter = fetch('users.query')
     objectClasses = fetch('users.object_classes')
     objectClasses = \
         [v.strip() for v in objectClasses.split(',') if v.strip()]
     users.objectClasses = objectClasses
     groups = self.groups
     groups.baseDN = fetch('groups.dn')
     map = odict()
     map.update(fetch('groups.aliases_attrmap'))
     groups_propsheet_attrmap = fetch('groups.propsheet_attrmap')
     if groups_propsheet_attrmap is not UNSET:
         map.update(groups_propsheet_attrmap)
     groups.attrmap = map
     groups.scope = fetch('groups.scope')
     groups.queryFilter = fetch('groups.query')
     objectClasses = fetch('groups.object_classes')
     objectClasses = \
         [v.strip() for v in objectClasses.split(',') if v.strip()]
     groups.objectClasses = objectClasses
Beispiel #2
0
    def save(self, widget, data):
        props = ILDAPProps(self.plugin)
        users = ILDAPUsersConfig(self.plugin)
        groups = ILDAPGroupsConfig(self.plugin)

        def fetch(name, default=UNSET):
            name = 'ldapsettings.%s' % name
            __traceback_info__ = name
            val = data.fetch(name).extracted
            if default is UNSET:
                return val
            if val is UNSET:
                return default
            return val

        props.uri = fetch('server.uri')
        props.user = fetch('server.user')
        password = fetch('server.password')
        if password is not UNSET:
            props.password = password
        props.ignore_cert = fetch('server.ignore_cert')
        # TODO: later
        # props.start_tls = fetch('server.start_tls')
        # props.tls_cacertfile = fetch('server.tls_cacertfile')
        # props.tls_cacertdir = fetch('server.tls_cacertdir')
        # props.tls_clcertfile = fetch('server.tls_clcertfile')
        # props.tls_clkeyfile = fetch('server.tls_clkeyfile')
        # props.retry_max = fetch(at('server.retry_max')
        # props.retry_delay = fetch('server.retry_delay')
        props.page_size = fetch('server.page_size')
        props.cache = fetch('cache.cache')
        props.memcached = fetch('cache.memcached')
        props.timeout = fetch('cache.timeout')
        users.baseDN = fetch('users.dn')
        attrmap = odict()
        attrmap.update(fetch('users.aliases_attrmap'))
        users_propsheet_attrmap = fetch('users.propsheet_attrmap')
        if users_propsheet_attrmap is not UNSET:
            attrmap.update(users_propsheet_attrmap)
        users.attrmap = attrmap
        users.scope = fetch('users.scope')
        if users.scope is not UNSET:
            users.scope = int(users.scope.strip('"'))
        users.queryFilter = fetch('users.query')
        objectClasses = fetch('users.object_classes')
        users.objectClasses = objectClasses
        users.memberOfSupport = fetch('users.memberOfSupport')
        users.account_expiration = fetch('users.account_expiration')
        users._expiresAttr = fetch('users.expires_attr')
        users._expiresUnit = int(fetch('users.expires_unit', 0))
        groups.baseDN = fetch('groups.dn')
        attrmap = odict()
        attrmap.update(fetch('groups.aliases_attrmap'))
        groups_propsheet_attrmap = fetch('groups.propsheet_attrmap')
        if groups_propsheet_attrmap is not UNSET:
            attrmap.update(groups_propsheet_attrmap)
        groups.attrmap = attrmap
        groups.scope = fetch('groups.scope')
        if groups.scope is not UNSET:
            groups.scope = int(groups.scope.strip('"'))
        groups.queryFilter = fetch('groups.query')
        objectClasses = fetch('groups.object_classes')
        groups.objectClasses = objectClasses
        groups.memberOfSupport = fetch('groups.memberOfSupport')
Beispiel #3
0
    def save(self, widget, data):
        props = ILDAPProps(self.plugin)
        users = ILDAPUsersConfig(self.plugin)
        groups = ILDAPGroupsConfig(self.plugin)

        def fetch(name, default=UNSET):
            name = "ldapsettings.%s" % name
            __traceback_info__ = name
            val = data.fetch(name).extracted
            if default is UNSET:
                return val
            if val is UNSET:
                return default
            return val

        props.uri = fetch("server.uri")
        if not fetch("server.anonymous"):
            props.user = fetch("server.user")
            password = fetch("server.password")
            if password is not UNSET:
                props.password = password
        else:
            props.user = ""
            props.password = ""
        props.ignore_cert = fetch("server.ignore_cert")
        # TODO: later
        # props.start_tls = fetch('server.start_tls')
        # props.tls_cacertfile = fetch('server.tls_cacertfile')
        # props.tls_cacertdir = fetch('server.tls_cacertdir')
        # props.tls_clcertfile = fetch('server.tls_clcertfile')
        # props.tls_clkeyfile = fetch('server.tls_clkeyfile')
        # props.retry_max = fetch(at('server.retry_max')
        # props.retry_delay = fetch('server.retry_delay')
        props.page_size = fetch("server.page_size")
        props.cache = fetch("cache.cache")
        props.memcached = fetch("cache.memcached")
        props.timeout = fetch("cache.timeout")
        users.baseDN = fetch("users.dn")
        # build attrmap from static keys and dynamic keys inputs
        users.attrmap = odict()
        users.attrmap.update(fetch("users.aliases_attrmap"))
        users_propsheet_attrmap = fetch("users.propsheet_attrmap")
        if users_propsheet_attrmap is not UNSET:
            users.attrmap.update(users_propsheet_attrmap)
        # we expect to always have the id key mapped under the same name in the
        # propertysheet. this would be set implicit on LDAPPrincipal init, but
        # to avoid a write on read, we do it here.
        if users.attrmap["id"] not in users.attrmap:
            users.attrmap[users.attrmap["id"]] = users.attrmap["id"]
        users.scope = fetch("users.scope")
        if users.scope is not UNSET:
            users.scope = int(users.scope.strip('"'))
        users.queryFilter = fetch("users.query")
        objectClasses = fetch("users.object_classes")
        users.objectClasses = objectClasses
        users.memberOfSupport = fetch("users.memberOfSupport")
        users.recursiveGroups = fetch("users.recursiveGroups")
        users.memberOfExternalGroupDNs = fetch("users.memberOfExternalGroupDNs")
        users.account_expiration = fetch("users.account_expiration")
        users._expiresAttr = fetch("users.expires_attr")
        users._expiresUnit = int(fetch("users.expires_unit", 0))
        groups.baseDN = fetch("groups.dn")
        groups.attrmap = odict()
        groups.attrmap.update(fetch("groups.aliases_attrmap"))
        groups_propsheet_attrmap = fetch("groups.propsheet_attrmap")
        if groups_propsheet_attrmap is not UNSET:
            groups.attrmap.update(groups_propsheet_attrmap)
        groups.scope = fetch("groups.scope")
        if groups.scope is not UNSET:
            groups.scope = int(groups.scope.strip('"'))
        groups.queryFilter = fetch("groups.query")
        objectClasses = fetch("groups.object_classes")
        groups.objectClasses = objectClasses
        groups.memberOfSupport = fetch("groups.memberOfSupport")
        groups.recursiveGroups = False
        groups.memberOfExternalGroupDNs = []
Beispiel #4
0
    def save(self, widget, data):
        props = ILDAPProps(self.plugin)
        users = ILDAPUsersConfig(self.plugin)
        groups = ILDAPGroupsConfig(self.plugin)

        def fetch(name, default=UNSET):
            name = 'ldapsettings.%s' % name
            __traceback_info__ = name
            val = data.fetch(name).extracted
            if default is UNSET:
                return val
            if val is UNSET:
                return default
            return val

        props.uri = fetch('server.uri')
        props.user = fetch('server.user')
        password = fetch('server.password')
        if password is not UNSET:
            props.password = password
        props.ignore_cert = fetch('server.ignore_cert')
        # TODO: later
        # props.start_tls = fetch('server.start_tls')
        # props.tls_cacertfile = fetch('server.tls_cacertfile')
        # props.tls_cacertdir = fetch('server.tls_cacertdir')
        # props.tls_clcertfile = fetch('server.tls_clcertfile')
        # props.tls_clkeyfile = fetch('server.tls_clkeyfile')
        # props.retry_max = fetch(at('server.retry_max')
        # props.retry_delay = fetch('server.retry_delay')
        props.page_size = fetch('server.page_size')
        props.cache = fetch('cache.cache')
        props.memcached = fetch('cache.memcached')
        props.timeout = fetch('cache.timeout')
        users.baseDN = fetch('users.dn')
        attrmap = odict()
        attrmap.update(fetch('users.aliases_attrmap'))
        users_propsheet_attrmap = fetch('users.propsheet_attrmap')
        if users_propsheet_attrmap is not UNSET:
            attrmap.update(users_propsheet_attrmap)
        users.attrmap = attrmap
        users.scope = fetch('users.scope')
        if users.scope is not UNSET:
            users.scope = int(users.scope.strip('"'))
        users.queryFilter = fetch('users.query')
        objectClasses = fetch('users.object_classes')
        users.objectClasses = objectClasses
        users.memberOfSupport = fetch('users.memberOfSupport')
        users.account_expiration = fetch('users.account_expiration')
        users._expiresAttr = fetch('users.expires_attr')
        users._expiresUnit = int(fetch('users.expires_unit', 0))
        groups.baseDN = fetch('groups.dn')
        attrmap = odict()
        attrmap.update(fetch('groups.aliases_attrmap'))
        groups_propsheet_attrmap = fetch('groups.propsheet_attrmap')
        if groups_propsheet_attrmap is not UNSET:
            attrmap.update(groups_propsheet_attrmap)
        groups.attrmap = attrmap
        groups.scope = fetch('groups.scope')
        if groups.scope is not UNSET:
            groups.scope = int(groups.scope.strip('"'))
        groups.queryFilter = fetch('groups.query')
        objectClasses = fetch('groups.object_classes')
        groups.objectClasses = objectClasses
        groups.memberOfSupport = fetch('groups.memberOfSupport')
    def save(self, widget, data):
        props = ILDAPProps(self.plugin)
        users = ILDAPUsersConfig(self.plugin)
        groups = ILDAPGroupsConfig(self.plugin)

        def fetch(name, default=UNSET):
            name = "ldapsettings.%s" % name
            __traceback_info__ = name
            val = data.fetch(name).extracted
            if default is UNSET:
                return val
            if val is UNSET:
                return default
            return val

        props.uri = fetch("server.uri")
        if not fetch("server.anonymous"):
            props.user = fetch("server.user")
            password = fetch("server.password")
            if password is not UNSET:
                props.password = password
        else:
            props.user = ""
            props.password = ""
        props.ignore_cert = fetch("server.ignore_cert")
        # TODO: later
        # props.start_tls = fetch('server.start_tls')
        # props.tls_cacertfile = fetch('server.tls_cacertfile')
        # props.tls_cacertdir = fetch('server.tls_cacertdir')
        # props.tls_clcertfile = fetch('server.tls_clcertfile')
        # props.tls_clkeyfile = fetch('server.tls_clkeyfile')
        # props.retry_max = fetch(at('server.retry_max')
        # props.retry_delay = fetch('server.retry_delay')
        props.page_size = fetch("server.page_size")
        props.cache = fetch("cache.cache")
        props.memcached = fetch("cache.memcached")
        props.timeout = fetch("cache.timeout")
        users.baseDN = fetch("users.dn")
        # build attrmap from static keys and dynamic keys inputs
        users.attrmap = odict()
        users.attrmap.update(fetch("users.aliases_attrmap"))
        users_propsheet_attrmap = fetch("users.propsheet_attrmap")
        if users_propsheet_attrmap is not UNSET:
            users.attrmap.update(users_propsheet_attrmap)
        # we expect to always have the id key mapped under the same name in the
        # propertysheet. this would be set implicit on LDAPPrincipal init, but
        # to avoid a write on read, we do it here.
        if users.attrmap['id'] not in users.attrmap:
            users.attrmap[users.attrmap['id']] = users.attrmap['id']
        users.scope = fetch("users.scope")
        if users.scope is not UNSET:
            users.scope = int(users.scope.strip('"'))
        users.queryFilter = fetch("users.query")
        objectClasses = fetch("users.object_classes")
        users.objectClasses = objectClasses
        users.memberOfSupport = fetch("users.memberOfSupport")
        users.account_expiration = fetch("users.account_expiration")
        users._expiresAttr = fetch("users.expires_attr")
        users._expiresUnit = int(fetch("users.expires_unit", 0))
        groups.baseDN = fetch("groups.dn")
        groups.attrmap = odict()
        groups.attrmap.update(fetch("groups.aliases_attrmap"))
        groups_propsheet_attrmap = fetch("groups.propsheet_attrmap")
        if groups_propsheet_attrmap is not UNSET:
            groups.attrmap.update(groups_propsheet_attrmap)
        groups.scope = fetch("groups.scope")
        if groups.scope is not UNSET:
            groups.scope = int(groups.scope.strip('"'))
        groups.queryFilter = fetch("groups.query")
        objectClasses = fetch("groups.object_classes")
        groups.objectClasses = objectClasses
        groups.memberOfSupport = fetch("groups.memberOfSupport")
        users.attrmap