isCurrentUserAuthor isn't
Brought to you by:
ebrehault
PlominoAccessControl.isCurrentUserAuthor implies that it's checking authorship, and the docstring says: "is the current user the document's author?"
In fact, the method does both less and far more.
1) Whether the user is the author of this doc or not, the method returns False if they don't have edit permission.
2) If they are Owner, Manager, PlominoEditor, PlominoDesigner, or PlominoManager it returns True even if they are not Author.
3) and finally it also does what it promises to do.
This should probably be factored into two methods: currentUserCanEdit (which does (1)-(3) and isCurrentUserAuthor (which only does (3)).
indeed the method name is not accurate
but basically, it implements the author concept in Plomino
Author does not mean creator, the creator is automatically added to the authors list, but it can be removed later.
Author is actually an access right, if you have author access on a doc, you can modify it.
So first thing is to chek the plomino ACL:
- if you are only a PlominoReader (that's what we test with: not self.checkUserPermission(EDIT_PERMISSION) ), you cannot edit.
- if you are PlominoEditor, PlominoDesigner or PlominoManager, you can always edit any document (and alos if you are Manager or Owner at the Plone level),
- if you are PlominoAuthor, then we need to check if you are listed in the Plomino_Authors field (you, or pone of your group, or one of your user roles)
but I agree it should be named hasAuthorAccess
eric