Loading ccserver/conf.py +21 −21 Original line number Diff line number Diff line Loading @@ -46,6 +46,19 @@ import os import re from functools import wraps def writer(func): ''' Decorator used to threadsafize methods that made write operations on client configuration tree. ''' @wraps(func) def f(self, *args, **kwargs): with self._lock: return func(self, *args, **kwargs) return f class CCConf(object): ''' Create a new configuration interface. Loading @@ -70,19 +83,6 @@ class CCConf(object): def __exit__(self, *args, **kwargs): return self._lock.__exit__(*args, **kwargs) def _writer(func): ''' Decorator used to threadsafize methods that made write operations on client configuration tree. ''' @wraps(func) def f(self, *args, **kwargs): with self._lock: return func(self, *args, **kwargs) return f def _get_conf(self, login): ''' Return the configuration of a client by its login. Loading Loading @@ -233,7 +233,7 @@ class CCConf(object): else: return None @_writer @writer def set_password(self, login, password, method='ssha'): ''' Update the client's password in the configuration. Loading @@ -249,7 +249,7 @@ class CCConf(object): conf['password'] = password self._set_conf(login, conf) @_writer @writer def add_tag(self, login, tag_name, tag_value): ''' Add the tag to the user. Loading @@ -266,7 +266,7 @@ class CCConf(object): conf['tags'][tag_name] = tag_value self._set_conf(login, conf) @_writer @writer def remove_tag(self, login, tag): ''' Remove the tag to the user. Loading @@ -282,7 +282,7 @@ class CCConf(object): del conf['tags'][tag] self._set_conf(login, conf) @_writer @writer def remove_account(self, login): ''' Remove the configuration of the account. Loading @@ -298,7 +298,7 @@ class CCConf(object): else: raise CCConf.UnknownAccount('%s is not a file' % filename) @_writer @writer def create_account(self, login, role, password): ''' Create a new account. Loading @@ -321,7 +321,7 @@ class CCConf(object): conf['password'] = self._hash_password(password) self._set_conf(login, conf, create=True) @_writer @writer def add_right(self, login, tql, method=None, target='allow', index=None): ''' Add a right rule to the provided account. Loading @@ -346,7 +346,7 @@ class CCConf(object): rights.insert(index, rule) self._set_conf(login, conf) @_writer @writer def remove_right(self, login, index): ''' Remove a right rule from the provided account. Loading Loading
ccserver/conf.py +21 −21 Original line number Diff line number Diff line Loading @@ -46,6 +46,19 @@ import os import re from functools import wraps def writer(func): ''' Decorator used to threadsafize methods that made write operations on client configuration tree. ''' @wraps(func) def f(self, *args, **kwargs): with self._lock: return func(self, *args, **kwargs) return f class CCConf(object): ''' Create a new configuration interface. Loading @@ -70,19 +83,6 @@ class CCConf(object): def __exit__(self, *args, **kwargs): return self._lock.__exit__(*args, **kwargs) def _writer(func): ''' Decorator used to threadsafize methods that made write operations on client configuration tree. ''' @wraps(func) def f(self, *args, **kwargs): with self._lock: return func(self, *args, **kwargs) return f def _get_conf(self, login): ''' Return the configuration of a client by its login. Loading Loading @@ -233,7 +233,7 @@ class CCConf(object): else: return None @_writer @writer def set_password(self, login, password, method='ssha'): ''' Update the client's password in the configuration. Loading @@ -249,7 +249,7 @@ class CCConf(object): conf['password'] = password self._set_conf(login, conf) @_writer @writer def add_tag(self, login, tag_name, tag_value): ''' Add the tag to the user. Loading @@ -266,7 +266,7 @@ class CCConf(object): conf['tags'][tag_name] = tag_value self._set_conf(login, conf) @_writer @writer def remove_tag(self, login, tag): ''' Remove the tag to the user. Loading @@ -282,7 +282,7 @@ class CCConf(object): del conf['tags'][tag] self._set_conf(login, conf) @_writer @writer def remove_account(self, login): ''' Remove the configuration of the account. Loading @@ -298,7 +298,7 @@ class CCConf(object): else: raise CCConf.UnknownAccount('%s is not a file' % filename) @_writer @writer def create_account(self, login, role, password): ''' Create a new account. Loading @@ -321,7 +321,7 @@ class CCConf(object): conf['password'] = self._hash_password(password) self._set_conf(login, conf, create=True) @_writer @writer def add_right(self, login, tql, method=None, target='allow', index=None): ''' Add a right rule to the provided account. Loading @@ -346,7 +346,7 @@ class CCConf(object): rights.insert(index, rule) self._set_conf(login, conf) @_writer @writer def remove_right(self, login, index): ''' Remove a right rule from the provided account. Loading