X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAdmDeleteNode.py;h=8c3fd1a957ffd979ba3845b7a5939882b2595d9a;hb=9fd8cf39d8acdb32136fd4d1f97f53d77275f4cb;hp=3e308fce2bd689d358e201dcbd4adb3e2a562350;hpb=24d16d18acab3da7bccc3e09df4927e9cf2d3246;p=plcapi.git diff --git a/PLC/Methods/AdmDeleteNode.py b/PLC/Methods/AdmDeleteNode.py index 3e308fc..8c3fd1a 100644 --- a/PLC/Methods/AdmDeleteNode.py +++ b/PLC/Methods/AdmDeleteNode.py @@ -1,46 +1,8 @@ -from PLC.Faults import * -from PLC.Method import Method -from PLC.Parameter import Parameter, Mixed -from PLC.Auth import PasswordAuth -from PLC.Nodes import Node, Nodes +from PLC.Methods.DeleteNode import DeleteNode -class AdmDeleteNode(Method): +class AdmDeleteNode(DeleteNode): """ - Mark an existing node as deleted. - - PIs and techs may only delete nodes at their own sites. Admins may - delete nodes at any site. - - Returns 1 if successful, faults otherwise. + Deprecated. See DeleteNode. """ - roles = ['admin', 'pi', 'tech'] - - accepts = [ - PasswordAuth(), - Mixed(Node.fields['node_id'], - Node.fields['hostname']) - ] - - returns = Parameter(int, '1 if successful') - - def call(self, auth, node_id_or_hostname): - # Get account information - nodes = Nodes(self.api, [node_id_or_hostname]) - if not nodes: - raise PLCInvalidArgument, "No such node" - - node = nodes.values()[0] - - # If we are not an admin, make sure that the caller is a - # member of the site at which the node is located. - if 'admin' not in self.caller['roles']: - # Authenticated function - assert self.caller is not None - - if node['site_id'] not in self.caller['site_ids']: - raise PLCPermissionDenied, "Not allowed to delete nodes from specified site" - - node.delete() - - return 1 + status = "deprecated"