From: Mark Huang Date: Thu, 1 Feb 2007 05:01:04 +0000 (+0000) Subject: allow node and anonymous authentication X-Git-Tag: pycurl-7_13_1~29 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=03f03eb21ef66571e98d61c0b0c56bdb861062a7;p=plcapi.git allow node and anonymous authentication --- diff --git a/PLC/Methods/GetNodeGroups.py b/PLC/Methods/GetNodeGroups.py index 478eb995..f4927efc 100644 --- a/PLC/Methods/GetNodeGroups.py +++ b/PLC/Methods/GetNodeGroups.py @@ -14,7 +14,7 @@ class GetNodeGroups(Method): is specified, only the specified details will be returned. """ - roles = ['admin', 'pi', 'user', 'tech'] + roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous'] accepts = [ Auth(), diff --git a/PLC/Methods/GetNodeNetworks.py b/PLC/Methods/GetNodeNetworks.py index 1168e491..558dcf36 100644 --- a/PLC/Methods/GetNodeNetworks.py +++ b/PLC/Methods/GetNodeNetworks.py @@ -15,7 +15,7 @@ class GetNodeNetworks(Method): specified details will be returned. """ - roles = ['admin', 'pi', 'user', 'tech'] + roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous'] accepts = [ Auth(), @@ -26,6 +26,5 @@ class GetNodeNetworks(Method): returns = [NodeNetwork.fields] - def call(self, auth, nodenetwork_filter = None, return_fields = None): return NodeNetworks(self.api, nodenetwork_filter, return_fields) diff --git a/PLC/Methods/GetNodes.py b/PLC/Methods/GetNodes.py index 8ab44f05..d308a4f4 100644 --- a/PLC/Methods/GetNodes.py +++ b/PLC/Methods/GetNodes.py @@ -3,6 +3,7 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.Nodes import Node, Nodes +from PLC.Persons import Person, Persons from PLC.Auth import Auth class GetNodes(Method): @@ -16,7 +17,7 @@ class GetNodes(Method): Some fields may only be viewed by admins. """ - roles = ['admin', 'pi', 'user', 'tech'] + roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous'] accepts = [ Auth(), @@ -34,7 +35,8 @@ class GetNodes(Method): nodes = Nodes(self.api, node_filter, return_fields) # Remove admin only fields - if 'admin' not in self.caller['roles']: + if not isinstance(self.caller, Person) or \ + 'admin' not in self.caller['roles']: for node in nodes: for field in ['boot_nonce', 'key', 'session', 'root_person_ids']: if field in node: diff --git a/PLC/Methods/GetSites.py b/PLC/Methods/GetSites.py index d148b5d0..0d98e6b2 100644 --- a/PLC/Methods/GetSites.py +++ b/PLC/Methods/GetSites.py @@ -13,7 +13,7 @@ class GetSites(Method): specified details will be returned. """ - roles = ['admin', 'pi', 'user', 'tech'] + roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous'] accepts = [ Auth(), @@ -25,6 +25,5 @@ class GetSites(Method): returns = [Site.fields] - def call(self, auth, site_filter = None, return_fields = None): return Sites(self.api, site_filter, return_fields)