Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86220138
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
Sat, Oct 5, 00:49
Size
1 KB
Mime Type
text/x-python
Expires
Mon, Oct 7, 00:49 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21304639
Attached To
rPHAPI Phabricator API scripts
directory.py
View Options
# -*- coding: utf-8 -*-
import
copy
import
logging
from
.
import
export
from
.backends
import
_get_class
__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"
_logger
=
logging
.
getLogger
(
__name__
)
@export
class
Directory
(
object
):
def
__new__
(
cls
,
**
kwargs
):
"""
Factory constructor depending on the chosen backend
"""
option
=
copy
.
copy
(
kwargs
)
backend
=
option
.
pop
(
'backend'
,
None
)
_class
=
_get_class
(
'directory'
,
backend
)
return
super
(
Directory
,
cls
)
.
__new__
(
_class
)
def
__init__
(
self
,
**
kwargs
):
opts
=
copy
.
copy
(
kwargs
)
self
.
_backend_name
=
opts
.
pop
(
"backend"
,
None
)
self
.
_dry_run
=
opts
.
pop
(
"dry_run"
,
False
)
@property
def
backend_name
(
self
):
return
self
.
_backend_name
def
is_valid_user
(
self
,
id
):
pass
def
is_valid_group
(
self
,
id
):
pass
def
get_users_from_group
(
self
,
id
):
pass
def
get_group_unique_id
(
self
,
name
):
return
''
def
get_user_unique_id
(
self
,
email
):
return
''
def
get_group_name
(
self
,
id
):
return
''
def
get_user_name
(
self
,
id
):
return
''
def
get_user_email
(
self
,
id
):
return
''
def
search_users
(
self
,
list_emails
):
_res
=
{}
for
_mail
in
list_emails
:
_res
[
_mail
]
=
self
.
get_user_unique_id
(
_mail
)
return
_res
def
create_group
(
self
,
name
):
raise
PermissionError
(
'Groups cannot be created in this directory'
)
def
set_group_users
(
self
,
gid
,
uids
):
raise
PermissionError
(
'Groups cannot be modified in this directory'
)
Event Timeline
Log In to Comment