Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91004981
directory.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 6, 20:43
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Nov 8, 20:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22178013
Attached To
rPHAPI Phabricator API scripts
directory.py
View Options
# -*- 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
Log In to Comment