git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
split the various *Api classes into somethin more sensible
[sfa.git]
/
sfa
/
methods
/
Update.py
diff --git
a/sfa/methods/Update.py
b/sfa/methods/Update.py
index
de9dbb0
..
31b17e9
100644
(file)
--- a/
sfa/methods/Update.py
+++ b/
sfa/methods/Update.py
@@
-1,11
+1,5
@@
-### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
-
-import time
-from sfa.util.faults import *
from sfa.util.method import Method
from sfa.util.method import Method
-from sfa.util.parameter import Parameter, Mixed
-from sfa.util.debug import log
+from sfa.util.parameter import Parameter
from sfa.trust.credential import Credential
class Update(Method):
from sfa.trust.credential import Credential
class Update(Method):
@@
-23,10
+17,8
@@
class Update(Method):
interfaces = ['registry']
accepts = [
interfaces = ['registry']
accepts = [
- Parameter(str, "Credential string"),
Parameter(dict, "Record dictionary to be updated"),
Parameter(dict, "Record dictionary to be updated"),
- Mixed(Parameter(str, "Human readable name of the original caller"),
- Parameter(None, "Origin hrn not specified"))
+ Parameter(str, "Credential string"),
]
returns = Parameter(int, "1 if successful")
]
returns = Parameter(int, "1 if successful")
@@
-34,8
+26,14
@@
class Update(Method):
def call(self, record_dict, creds):
# validate the cred
valid_creds = self.api.auth.checkCredentials(creds, "update")
def call(self, record_dict, creds):
# validate the cred
valid_creds = self.api.auth.checkCredentials(creds, "update")
+
+ # verify permissions
+ hrn = record_dict.get('hrn', '')
+ self.api.auth.verify_object_permission(hrn)
+
+ # log
origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
- self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn,
None
, self.name))
+ self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn,
hrn
, self.name))
manager = self.api.get_interface_manager()
manager = self.api.get_interface_manager()