Loading ccserver/ccserver.py +20 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,22 @@ class CCServer(object): 'connected' % login) client.shutdown() def list(self, query, show=set()): def check(self, client, method, tql): rights = self.conf.show(client.login)['rights'] objects = self.list(tql, pure=True) for right in rights: if not (right['method'] is None or right['method'] == method): continue if right['tql'] is not None: objects_right = self.list(right['tql'], pure=True) if not objects <= objects_right: continue if right['target'] == 'allow': return True else: return False def list(self, query, show=set(), pure=False): ''' List objects on the server. Loading Loading @@ -235,6 +250,10 @@ class CCServer(object): objects = OrderedSet(self.objects.all(to_get, to_check)) if ast is not None: objects, _ = ast.eval(objects, objects) if pure: return objects objects_dicts = [] for obj in objects: objects_dicts.append(obj.to_dict(to_show, deny=deny)) Loading ccserver/handlers.py +6 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,12 @@ class OnlineCCHandler(CCHandler): def on_disconnect(self, conn): self._server.unregister(conn) def _check(self, conn, method, tql): client = self._server.search_client_by_connection(conn) allow = self._server.check(client, method, tql) if not allow: raise RightError('You are not allowed to do this action.') class HypervisorHandler(OnlineCCHandler): ''' Loading debian/changelog +1 −0 Original line number Diff line number Diff line -- Antoine Millet <antoine.millet@smartjog.com> Thu, 27 Jan 2011 17:31:05 +0100 cc-server (8) unstable; urgency=low * Fixed a lot a bugs. Loading Loading
ccserver/ccserver.py +20 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,22 @@ class CCServer(object): 'connected' % login) client.shutdown() def list(self, query, show=set()): def check(self, client, method, tql): rights = self.conf.show(client.login)['rights'] objects = self.list(tql, pure=True) for right in rights: if not (right['method'] is None or right['method'] == method): continue if right['tql'] is not None: objects_right = self.list(right['tql'], pure=True) if not objects <= objects_right: continue if right['target'] == 'allow': return True else: return False def list(self, query, show=set(), pure=False): ''' List objects on the server. Loading Loading @@ -235,6 +250,10 @@ class CCServer(object): objects = OrderedSet(self.objects.all(to_get, to_check)) if ast is not None: objects, _ = ast.eval(objects, objects) if pure: return objects objects_dicts = [] for obj in objects: objects_dicts.append(obj.to_dict(to_show, deny=deny)) Loading
ccserver/handlers.py +6 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,12 @@ class OnlineCCHandler(CCHandler): def on_disconnect(self, conn): self._server.unregister(conn) def _check(self, conn, method, tql): client = self._server.search_client_by_connection(conn) allow = self._server.check(client, method, tql) if not allow: raise RightError('You are not allowed to do this action.') class HypervisorHandler(OnlineCCHandler): ''' Loading
debian/changelog +1 −0 Original line number Diff line number Diff line -- Antoine Millet <antoine.millet@smartjog.com> Thu, 27 Jan 2011 17:31:05 +0100 cc-server (8) unstable; urgency=low * Fixed a lot a bugs. Loading