[xwiki-devs] Two little questions regarding permissions & user profile
Hi, to finish my OpenID authentication project I have to little questions :-) I created an action AttachOpenIdAction which is used to attach an OpenID to an already existing user account (see http://jira.xwiki.org/jira/browse/XWIKI-2588). Now I have two questions: 1. How can I add a button to the users profile page where "Change your password", "Modify your profile", .. is. I found no template or action. 2. How can I set the permissions for that action. Currently it requires Admin rights to be executed. Thank you very much Have a nice weekend, Markus
Markus Lanthaler wrote:
Hi,
to finish my OpenID authentication project I have to little questions :-) I created an action AttachOpenIdAction which is used to attach an OpenID to an already existing user account (see http://jira.xwiki.org/jira/browse/XWIKI-2588). Now I have two questions:
1. How can I add a button to the users profile page where "Change your password", "Modify your profile", .. is. I found no template or action.
The user profile is actually in a wiki page, XWiki.XWikiUserSheet . You just have to edit that file. The source is at .../trunks/applications/administration/src/main/resources/XWiki/XWikiUserSheet.xml
2. How can I set the permissions for that action. Currently it requires Admin rights to be executed.
What exactly will happen when you click that button? What kind of code is executed (Java, velocity)? On the user profile page, you can hide the button like this: #if ($hasadmin || $context.user == $doc.fullName) ## display button #end but you still need to check rights in the action's code.
Thank you very much
Have a nice weekend, Markus
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Sergiu Dumitriu http://purl.org/net/sergiu/
The user profile is actually in a wiki page, XWiki.XWikiUserSheet . You just have to edit that file. The source is at .../trunks/applications/administration/src/main/resources/XWiki/XWikiUserSheet.xml
OK. And then I guess I have to build it with Maven and reimport it in my XWiki installation, right? I'm using Eclipse to debug it.
2. How can I set the permissions for that action. Currently it requires Admin rights to be executed.
What exactly will happen when you click that button? What kind of code is executed (Java, velocity)? On the user profile page, you can hide the button like this:
When I'm calling http://localhost:8181/xwiki/bin/attachopenid/XWiki/AttachOpenID I'm redirected to the login page. If I log in as Admin everything works fine, otherwise I get the error message "Error - You are not allowed to view this document or perform this action." The code in my action is not called. I don't know why.. couldn't figure it out. It happens somewhere in prepareDocuments() in XWikiAction#execute(XWikiContext context) I guess.
#if ($hasadmin || $context.user == $doc.fullName) ## display button #end
but you still need to check rights in the action's code.
OK. I just need to make sure that the user is logged in. So a context.getXWikiUser() check should be enough, right!?
On Mon, Aug 18, 2008 at 11:33 AM, Markus Lanthaler <[email protected]> wrote:
The user profile is actually in a wiki page, XWiki.XWikiUserSheet . You just have to edit that file. The source is at .../trunks/applications/administration/src/main/resources/XWiki/XWikiUserSheet.xml
OK. And then I guess I have to build it with Maven and reimport it in my XWiki installation, right? I'm using Eclipse to debug it.
Yes then, when you modified the page, you simply export it using "Print"->"export as xar" ad extract XWikiUserSheet.xml from the exported xar.
2. How can I set the permissions for that action. Currently it requires Admin rights to be executed.
What exactly will happen when you click that button? What kind of code is executed (Java, velocity)? On the user profile page, you can hide the button like this:
When I'm calling http://localhost:8181/xwiki/bin/attachopenid/XWiki/AttachOpenID I'm redirected to the login page. If I log in as Admin everything works fine, otherwise I get the error message "Error - You are not allowed to view this document or perform this action." The code in my action is not called. I don't know why.. couldn't figure it out. It happens somewhere in prepareDocuments() in XWikiAction#execute(XWikiContext context) I guess.
#if ($hasadmin || $context.user == $doc.fullName) ## display button #end
but you still need to check rights in the action's code.
OK. I just need to make sure that the user is logged in. So a context.getXWikiUser() check should be enough, right!?
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (3)
-
Markus Lanthaler -
Sergiu Dumitriu -
Thomas Mortagne