from PLC.TagTypes import TagType, TagTypes
from PLC.PersonTags import PersonTag, PersonTags
+# need to import so the core classes get decorated with caller_may_write_tag
from PLC.AuthorizeHelpers import AuthorizeHelpers
class AddPersonTag(Method):
(person['person_id'],person['email'], tag_type['tag_type_id'])
# check authorizations
- if 'admin' in self.caller['roles']:
- pass
- # user can change tags on self
- elif AuthorizeHelpers.person_may_access_person (self.api, self.caller, person):
- pass
- else:
- raise PLCPermissionDenied, "%s: you can only change your own tags"%self.name
-
+ person.caller_may_write_tag (self.api,self.caller,tag_type)
person_tag = PersonTag(self.api)
person_tag['person_id'] = person['person_id']