Hi everyone,
the way we handle Author of the document in XWiki is through two fields in XWikiDocument, author and contentAuthor. I won’t talk about contentAuthor since it’s been introduced only for security reason and AFAIU it should never be different from the author in the storage (it might be different at execution time, but it’s not the topic).
Now, the purpose of the author field in XWikiDocument is twofold: its first usage is to be able to display who is the author of the document in the header content of the page, its second usage is to be able to compute rights on the document.
The fact that it has two usage can be problematic in some conditions: right now, a script without PR rights cannot set the current user as the author of the document, so a document created in this condition will always have the script author as its own author, and not the actual user of the script.
For me my usecase is a bit different: I want a way in Change request, to be able to save a document in specifying that the user who performs the merge is the author to be checked for the rights, and the author who actually proposed the changes, the author to be displayed.
For those reasons, I propose that we add a new field and associated methods in XWikiDocument that I would call displayedAuthor
: its purpose is solely to be displayed in the UI, and the author
would remain the one to be checked for rights.
The change for introducing such field would be the following:
- introduce the field and API in XWikiDocument (getter, setter)
- introduce new save API in Document to allow setting a custom
displayedAuthor
when saving - introduce an hibernate migration that would create a new column in Document table, and fill it with the author for existing documents
- change the implementation of the versioning store to use the
displayedAuthor
as the author saved in an RCSNodeInfo - change the serialization of a document to XML to introduce this new metadata
This is my main proposal, on top of this I propose that we rename getAuthor
to getMetadataAuthor
or something a bit more explicit to be able to make the distinction between the 3 authors we’d have.
WDYT?