Ejemplo n.º 1
0
 def __init__(self, props, cfg):
     context = LDAPNode(name=cfg.baseDN, props=props)
     context.search_filter = cfg.queryFilter
     context.search_scope = int(cfg.scope)
     context.child_defaults = dict()
     context.child_defaults["objectClass"] = cfg.objectClasses
     context.child_defaults.update(cfg.defaults)
     for oc in cfg.objectClasses:
         for key, val in creation_defaults.get(oc, dict()).items():
             if key not in context.child_defaults:
                 context.child_defaults[key] = val
     # if cfg.member_relation:
     #     context.search_relation = cfg.member_relation
     self._rdn_attr = cfg.attrmap["rdn"]
     self._key_attr = cfg.attrmap["id"]
     if self._key_attr not in cfg.attrmap:
         cfg.attrmap[self._key_attr] = self._key_attr
     self._login_attr = None
     if cfg.attrmap.get("login") and cfg.attrmap["login"] != cfg.attrmap["id"]:
         self._login_attr = cfg.attrmap["login"]
     self.expiresAttr = getattr(cfg, "expiresAttr", None)
     self.expiresUnit = getattr(cfg, "expiresUnit", None)
     self.principal_attrmap = cfg.attrmap
     self.principal_attraliaser = DictAliaser(cfg.attrmap, cfg.strict)
     self.context = context
Ejemplo n.º 2
0
 def __init__(self, props, cfg):
     context = LDAPNode(name=cfg.baseDN, props=props)
     context.search_filter = cfg.queryFilter
     context.search_scope = int(cfg.scope)
     
     context.child_defaults = dict()
     context.child_defaults['objectClass'] = cfg.objectClasses
     if hasattr(cfg, 'defaults'):
         context.child_defaults.update(cfg.defaults)
     for oc in cfg.objectClasses:
         for key, val in creation_defaults.get(oc, dict()).items():
             if not key in context.child_defaults:
                 context.child_defaults[key] = val
     
     # XXX: make these attrs public
     context._key_attr = cfg.attrmap['id']
     context._rdn_attr = cfg.attrmap['rdn']
     
     #if cfg.member_relation:
     #    context.search_relation = cfg.member_relation
     
     context._seckey_attrs = ('dn',)
     if cfg.attrmap.get('login') \
       and cfg.attrmap['login'] != cfg.attrmap['id']:
         context._seckey_attrs += (cfg.attrmap['login'],)
     
     context._load_keys()
     
     self.expiresAttr = getattr(cfg, 'expiresAttr', None)
     self.expiresUnit = getattr(cfg, 'expiresUnit', None)
     self.principal_attrmap = cfg.attrmap
     self.principal_attraliaser = DictAliaser(cfg.attrmap, cfg.strict)
     self.context = context
Ejemplo n.º 3
0
 def __init__(self, props, cfg):
     context = LDAPNode(name=cfg.baseDN, props=props)
     context.search_filter = cfg.queryFilter
     context.search_scope = int(cfg.scope)
     context.child_defaults = dict()
     context.child_defaults['objectClass'] = cfg.objectClasses
     context.child_defaults.update(cfg.defaults)
     for oc in cfg.objectClasses:
         for key, val in creation_defaults.get(oc, dict()).items():
             if key not in context.child_defaults:
                 context.child_defaults[key] = val
     # if cfg.member_relation:
     #     context.search_relation = cfg.member_relation
     self._rdn_attr = cfg.attrmap['rdn']
     self._key_attr = cfg.attrmap['id']
     if self._key_attr not in cfg.attrmap:
         cfg.attrmap[self._key_attr] = self._key_attr
     self._login_attr = None
     if cfg.attrmap.get('login') \
             and cfg.attrmap['login'] != cfg.attrmap['id']:
         self._login_attr = cfg.attrmap['login']
     self.expiresAttr = getattr(cfg, 'expiresAttr', None)
     self.expiresUnit = getattr(cfg, 'expiresUnit', None)
     self.principal_attrmap = cfg.attrmap
     self.principal_attraliaser = DictAliaser(cfg.attrmap, cfg.strict)
     self.context = context