show tagname when permission is denied
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 19 Nov 2010 13:25:53 +0000 (14:25 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 19 Nov 2010 13:25:53 +0000 (14:25 +0100)
12 files changed:
PLC/Methods/AddIlink.py
PLC/Methods/AddInterfaceTag.py
PLC/Methods/AddNodeTag.py
PLC/Methods/AddSiteTag.py
PLC/Methods/DeleteIlink.py
PLC/Methods/DeleteInterfaceTag.py
PLC/Methods/DeleteNodeTag.py
PLC/Methods/DeleteSiteTag.py
PLC/Methods/UpdateIlink.py
PLC/Methods/UpdateInterfaceTag.py
PLC/Methods/UpdateNodeTag.py
PLC/Methods/UpdateSiteTag.py

index c9d18b1..0a7066a 100644 (file)
@@ -65,8 +65,8 @@ class AddIlink(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, src_if, self.caller):
             pass
         elif src_if_id != dst_if_id and AuthorizeHelpers.interface_belongs_to_person (self.api, dst_if, self.caller):
index 912e147..8d09fd0 100644 (file)
@@ -61,8 +61,8 @@ class AddInterfaceTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, interface, self.caller):
             pass
         else:
index 43e075f..fc64d1e 100644 (file)
@@ -64,8 +64,8 @@ class AddNodeTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.node_belongs_to_person (self.api, node, self.caller):
             pass
         else:
index cde238f..3c59f0b 100644 (file)
@@ -62,8 +62,8 @@ class AddSiteTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.person_belongs_to_site (self.api, self.caller, site):
             pass
         else:
index 6452b0d..0d07dfe 100644 (file)
@@ -53,8 +53,8 @@ class DeleteIlink(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, src_if, self.caller):
             pass
         elif src_if_id != dst_if_id and AuthorizeHelpers.interface_belongs_to_person (self.api, dst_if, self.caller):
index 187d25e..1bb4aad 100644 (file)
@@ -45,8 +45,8 @@ class DeleteInterfaceTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, interface, self.caller):
             pass
         else:
index bd99f0e..48b467f 100644 (file)
@@ -47,8 +47,8 @@ class DeleteNodeTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.node_belongs_to_person (self.api, node, self.caller):
             pass
         else:
index f0e87c3..3aa8d83 100644 (file)
@@ -46,8 +46,8 @@ class DeleteSiteTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.person_belongs_to_site (self.api, self.caller, site):
             pass
         else:
index 05daf17..97b14b6 100644 (file)
@@ -49,8 +49,8 @@ class UpdateIlink(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, src_if, self.caller):
             pass
         elif src_if_id != dst_if_id and AuthorizeHelpers.interface_belongs_to_person (self.api, dst_if, self.caller):
index e29041f..1d52ea3 100644 (file)
@@ -46,8 +46,8 @@ class UpdateInterfaceTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.interface_belongs_to_person (self.api, interface, self.caller):
             pass
         else:
index 3cc7891..d8b8af7 100644 (file)
@@ -48,8 +48,8 @@ class UpdateNodeTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.node_belongs_to_person (self.api, node, self.caller):
             pass
         else:
index 901a875..fadd953 100644 (file)
@@ -47,8 +47,8 @@ class UpdateSiteTag(Method):
         # check authorizations
         if 'admin' in self.caller['roles']:
             pass
-        elif not AuthorizeHelpers.person_access_tag_type (self.api, self.caller, tag_type):
-            raise PLCPermissionDenied, "%s, no permission to use this tag type"%self.name
+        elif not AuthorizeHelpers.caller_may_access_tag_type (self.api, self.caller, tag_type):
+            raise PLCPermissionDenied, "%s, forbidden tag %s"%(self.name,tag_type['tagname'])
         elif AuthorizeHelpers.person_belongs_to_site (self.api, self.caller, site):
             pass
         else: