[xwiki-users] Setting page permission when creating an article - AWM
Hi Xwiki Users. I have a simple question about user rights. Here's a simple example of what I'm trying to do: User_X has a problem with the printer. 1 - He creates an issue in "Requests" space (created via App Within Minutes). 2 - The IT departament checks it and solves the problem. 3 - The user marks it as closed. What I'm asking is: Can user_X be able to read only his own question and not user_Y's question? I mean, I know that I can change a single page permission, but I got to do it manually. Is it possible to make the item readable only by its autor and by a certain group(in this case, the IT departament) when creating an article? Thank you very much.
One option is to write an event listener that catches the create event for documents of type "Request" and sets the proper rights. See platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial . Hope this helps, Marius On Tue, Aug 5, 2014 at 9:45 PM, Leonardo Kodato <[email protected]> wrote:
Hi Xwiki Users.
I have a simple question about user rights. Here's a simple example of what I'm trying to do:
User_X has a problem with the printer. 1 - He creates an issue in "Requests" space (created via App Within Minutes). 2 - The IT departament checks it and solves the problem. 3 - The user marks it as closed.
What I'm asking is: Can user_X be able to read only his own question and not user_Y's question? I mean, I know that I can change a single page permission, but I got to do it manually. Is it possible to make the item readable only by its autor and by a certain group(in this case, the IT departament) when creating an article?
Thank you very much. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi Marius. Thanks for the reply. I've already solved this problem. It's not well writen, but it works. 1 - After creating a page, user_X usually goes to "view" mode. So: if ($xcontext.action == "view") #set ($result = $allow_user.set("groups", $doc.getValue("dept"))) #set ($result = $allow_user.set("levels", "view,edit")) #set ($result = $allow_user.set("allow", 1)) ## Save the modifications $doc.save() #end The only problem is that it generates 2 saves(one when creating the page and another when creating the object that sets the rights). But its not a big deal. I've also added some script to check if the rights are already set and if the new value is different from the former Thank you. 2014-09-17 11:01 GMT-03:00 Marius Dumitru Florea < [email protected]>:
One option is to write an event listener that catches the create event for documents of type "Request" and sets the proper rights.
See platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial .
Hope this helps, Marius
On Tue, Aug 5, 2014 at 9:45 PM, Leonardo Kodato <[email protected]> wrote:
Hi Xwiki Users.
I have a simple question about user rights. Here's a simple example of what I'm trying to do:
User_X has a problem with the printer. 1 - He creates an issue in "Requests" space (created via App Within Minutes). 2 - The IT departament checks it and solves the problem. 3 - The user marks it as closed.
What I'm asking is: Can user_X be able to read only his own question and not user_Y's question? I mean, I know that I can change a single page permission, but I got to do it manually. Is it possible to make the item readable only by its autor and by a certain group(in this case, the IT departament) when creating an article?
Thank you very much. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Leonardo Kodato -
Marius Dumitru Florea