From: Tony Mack Date: Fri, 15 Sep 2006 20:27:17 +0000 (+0000) Subject: - added: check if caller is admin X-Git-Tag: pycurl-7_13_1~752 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ce5584577fb539263d69e135d08a6467ceb6e420;p=plcapi.git - added: check if caller is admin --- diff --git a/PLC/Methods/AdmAddNodeToNodeGroup.py b/PLC/Methods/AdmAddNodeToNodeGroup.py index 419ef636..8148cc3f 100644 --- a/PLC/Methods/AdmAddNodeToNodeGroup.py +++ b/PLC/Methods/AdmAddNodeToNodeGroup.py @@ -38,6 +38,13 @@ class AdmAddNodeToNodeGroup(Method): raise PLCInvalidArgument, "No such nodegroup" nodegroup = nodegroups.values()[0] + + # Authenticated function + assert self.caller is not None + + # make sure we are 'admin' + if 'admin' not in self.caller['roles']: + raise PLCPermissionDenied, "Not allowed to add node groups" # add node to nodegroup if node['node_id'] not in nodegroup['node_ids']: