X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddInterfaceTag.py;h=b02b484442b0dadd6e8ebf75da585eb64d025c10;hb=295eb745592e486442587145ab1efcb15e7c9b82;hp=912e1479bc27bd2d0924ff270e6fbda6b6094fe4;hpb=0c28b6c095054293cc35c75a7a601486a4c249ff;p=plcapi.git diff --git a/PLC/Methods/AddInterfaceTag.py b/PLC/Methods/AddInterfaceTag.py index 912e147..b02b484 100644 --- a/PLC/Methods/AddInterfaceTag.py +++ b/PLC/Methods/AddInterfaceTag.py @@ -12,6 +12,9 @@ from PLC.Interfaces import Interface, Interfaces from PLC.TagTypes import TagType, TagTypes from PLC.InterfaceTags import InterfaceTag, InterfaceTags +# need to import so the core classes get decorated with caller_may_write_tag +from PLC.AuthorizeHelpers import AuthorizeHelpers + class AddInterfaceTag(Method): """ Sets the specified setting for the specified interface @@ -59,15 +62,7 @@ class AddInterfaceTag(Method): tag_type['tag_type_id']) # 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 AuthorizeHelpers.interface_belongs_to_person (self.api, interface, self.caller): - pass - else: - raise PLCPermissionDenied, "%s: you must belong in the same site as subject interface"%self.name - + interface.caller_may_write_tag(self.api,self.caller,tag_type) interface_tag = InterfaceTag(self.api) interface_tag['interface_id'] = interface['interface_id']