Page MenuHomec4science

directory.py
No OneTemporary

File Metadata

Created
Wed, Nov 6, 20:43

directory.py

# -*- coding: utf-8 -*-
from ... import export
from ..directories.ldap import LDAPDirectory
import ldap3
import copy
__author__ = "Nicolas Richart"
__copyright__ = "Copyright (C) 2016, EPFL (Ecole Polytechnique Fédérale " \
"de Lausanne) - SCITAS (Scientific IT and Application " \
"Support)"
__credits__ = ["Nicolas Richart"]
__license__ = "BSD"
__version__ = "0.1"
__maintainer__ = "Nicolas Richart"
__email__ = "nicolas.richart@epfl.ch"
@export
class EPFLDirectory(LDAPDirectory):
def __init__(self, **kwargs):
args = copy.copy(kwargs)
args.update({
'basedn': 'o=epfl,c=ch',
'scope': ldap3.SUBTREE,
'uidNumber': 'uniqueIdentifier',
'gecos': 'gecos',
'uid': 'uid',
'email': 'mail',
'user_filter': '(&(objectClass=posixAccount)({attr}={value}))',
'user_group_attrs': 'memberOf',
'gidNumber': 'uniqueIdentifier',
'gid': 'cn',
'group_filter': '(&(objectClass=groupOfNames)({attr}={value}))',
'group_member_filter': 'uniqueIdentifier',
'group_user_attrs': 'memberUniqueId'
})
super().__init__('ldaps://scoldap.epfl.ch', **args)
def get_switch_aai_id(self, _id):
return '{0}@epfl.ch'.format(_id)

Event Timeline