From 763b142db70ce77952cb46cfccf84d9800f15651 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 11 Mar 2013 19:49:20 +0100 Subject: websocket login via session, websocket pushes server status, webui renders server status --- module/Api.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'module/Api.py') 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): -- cgit v1.2.3