diff options
Diffstat (limited to 'module/Api.py')
-rw-r--r-- | module/Api.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/module/Api.py b/module/Api.py index 577c420c3..96b10be9c 100644 --- a/module/Api.py +++ b/module/Api.py @@ -21,15 +21,12 @@ from types import MethodType from remote.apitypes import * -from utils import bits_set +from utils import bits_set, primary_uid # contains function names mapped to their permissions # unlisted functions are for admins only perm_map = {} -# store which methods needs user context -user_context = {} - # decorator only called on init, never initialized, so has no effect on runtime def RequirePerm(bits): class _Dec(object): @@ -39,12 +36,6 @@ def RequirePerm(bits): return _Dec -# TODO: not needed anymore -# decorator to annotate user methods, these methods must have user=None kwarg. -class UserContext(object): - def __new__(cls, f, *args, **kwargs): - user_context[f.__name__] = True - return f urlmatcher = re.compile(r"((https?|ftps?|xdcc|sftp):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+\-=\\\.&]*)", re.IGNORECASE) @@ -93,8 +84,8 @@ class Api(Iface): return None #TODO return default user? @property - def userHandle(self): - return self.user.primary if self.user is not None else None + def primaryUID(self): + return primary_uid(self.user) @classmethod def initComponents(cls): |