[xwiki-users] controlling display on a per user basis
Hi all, I need to control what sections of a document are shown on a per user basis. I know how to do that per group, but I am failing when I try to evaluate $xwiki.getUser() output. For instance, this code write TEST whoever the logged user is: #if ($xwiki.getUser().equals("com.xpn.xwiki.api.User@69be76")) TEST #end Could you please, help me with this issue? Thanks! Ricardo -- View this message in context: http://www.nabble.com/controlling-display-on-a-per-user-basis-tp15545530p155... Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi, have you tried something akin to #if ($context.user == 'XWiki.YourUserName') Test #end ? Guillaume On 18/02/2008, [Ricardo Rodriguez] <[email protected]> wrote:
Hi all,
I need to control what sections of a document are shown on a per user basis.
I know how to do that per group, but I am failing when I try to evaluate $xwiki.getUser() output.
For instance, this code write TEST whoever the logged user is:
#if ($xwiki.getUser().equals("com.xpn.xwiki.api.User@69be76")) TEST #end
Could you please, help me with this issue? Thanks!
Ricardo -- View this message in context: http://www.nabble.com/controlling-display-on-a-per-user-basis-tp15545530p155... Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge wrote:
Hi,
have you tried something akin to
#if ($context.user == 'XWiki.YourUserName') Test #end
?
Nope. And it perfectly works! Thanks. Given an user with this it is possible to control if a paragraph appears or not but a new doubt arises from here. Look at this... #toc("2" "3" "") #if ($xwiki.hasAdminRights()) 1.1 Entry 1 1.1 Entry 2 #end #if ($context.user == 'XWiki.MyUsername') 1.1 Entry 3 #end Only Entry 1 and 2 are show in the document for an admin other than MyUsername, but all three entries appear in the TOC. Is it possible to control this? Thanks again! Best regards, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
On Feb 18, 2008, at 4:27 PM, [Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Guillaume Lerouge wrote:
Hi,
have you tried something akin to
#if ($context.user == 'XWiki.YourUserName') Test #end
?
Nope. And it perfectly works! Thanks.
Given an user with this it is possible to control if a paragraph appears or not but a new doubt arises from here. Look at this...
#toc("2" "3" "")
#if ($xwiki.hasAdminRights()) 1.1 Entry 1 1.1 Entry 2 #end
#if ($context.user == 'XWiki.MyUsername') 1.1 Entry 3 #end
Only Entry 1 and 2 are show in the document for an admin other than MyUsername, but all three entries appear in the TOC.
Is it possible to control this? Thanks again!
This is a limitation of the TOC macro. It looks for 1.* text elements in the raw document content. Thus there's no solution for this right now apart from rewriting the TOC macro. -Vincent
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Guillaume Lerouge wrote:
Hi,
have you tried something akin to
#if ($context.user == 'XWiki.YourUserName') Test #end
?
Nope. And it perfectly works! Thanks.
Given an user with this it is possible to control if a paragraph appears or not but a new doubt arises from here. Look at this...
#toc("2" "3" "")
#if ($xwiki.hasAdminRights()) 1.1 Entry 1 1.1 Entry 2 #end
#if ($context.user == 'XWiki.MyUsername') 1.1 Entry 3 #end
Only Entry 1 and 2 are show in the document for an admin other than MyUsername, but all three entries appear in the TOC.
Is it possible to control this? Thanks again!
Not now. The TOC macro is implemented in a wrong way, and it has many issues. I have an idea about how it should work, but I don't have time for this right now. -- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu wrote:
Not now. The TOC macro is implemented in a wrong way, and it has many issues. I have an idea about how it should work, but I don't have time for this right now.
Thanks both, Vincent and Sergiu. I'll take this into account. My situation is even worst than yours, Sergiu: no time, no idea! Let's see if I manage to improve any of these items... :-( Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
On Feb 18, 2008, at 4:38 PM, Sergiu Dumitriu wrote:
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Guillaume Lerouge wrote:
Hi,
have you tried something akin to
#if ($context.user == 'XWiki.YourUserName') Test #end
?
Nope. And it perfectly works! Thanks.
Given an user with this it is possible to control if a paragraph appears or not but a new doubt arises from here. Look at this...
#toc("2" "3" "")
#if ($xwiki.hasAdminRights()) 1.1 Entry 1 1.1 Entry 2 #end
#if ($context.user == 'XWiki.MyUsername') 1.1 Entry 3 #end
Only Entry 1 and 2 are show in the document for an admin other than MyUsername, but all three entries appear in the TOC.
Is it possible to control this? Thanks again!
Not now. The TOC macro is implemented in a wrong way, and it has many issues. I have an idea about how it should work, but I don't have time for this right now.
BTW this will be fixed when we finish implementing the new rendering component. -Vincent
participants (5)
-
[Ricardo Rodriguez] -
[Ricardo Rodriguez] Your EPEC Network ICT Team -
Guillaume Lerouge -
Sergiu Dumitriu -
Vincent Massol