Checking group membership in JavaScript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2007 11:34 AM
Is there a way to check group membership of the current logged in user using JavaScript? Based on if a user is part of a group I want to display different information (and want to do it within a freemarker template and not directly in the JSP).
Thanks.
Thanks.
Labels:
- Labels:
-
Archive
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2007 11:35 AM
Also, I am using alfresco version 1.4.2.. Do I have to upgrade to 2.0?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2007 12:11 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2007 12:44 PM
So if I upgraded to 2.0 and tried:
Should something like the above work?
<#assign myGroup = people.getGroup("myGroup")><#if (myGroup.hasPermission("Read")) etc…
Should something like the above work?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2007 05:46 AM
The first line would work yes, and you can then extract the members (people) of the group and manipulate them. The second line you post does would not work - the hasPermission() check currently only checks for permissions of the current user.
Thanks,
Kevin
Thanks,
Kevin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2007 05:58 PM
I have upgraded to 2.0.1 enterprise edition, and when I try to use
freemarker.core.InvalidReferenceException: Expression people is undefined on line 137, column 37
What am I doing wrong?
Thanks for your help.
<#assign taxGroup = people.getGroup("GROUP_grpOBITax")>
I get:freemarker.core.InvalidReferenceException: Expression people is undefined on line 137, column 37
What am I doing wrong?
Thanks for your help.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2007 08:46 AM
Sorry that should be:
var taxGroup = people.getGroup("GROUP_grpOBITax");
as the People object is part of the JavaScript API - not the freemarker templating API.
Thanks,
Kevin
var taxGroup = people.getGroup("GROUP_grpOBITax");
as the People object is part of the JavaScript API - not the freemarker templating API.
Thanks,
Kevin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2007 10:44 AM
Thanks for that. I am a bit confused, perhaps I am not understanding everything. What I have done is customized a JSP, and within the JSP I have inserted some freemarker templates (using the <r:template….). This way I have it spaced out exactly as I need.
I have created these freemarker templates, because I want them to be located within the repository and be able to be edited, without having to change the JSP and rebuild the war file. (similar to how I created custom dashlets for the dashboard).
That being said, one of the templates shows different text (in fact, it uses the workflow command processor to approve/reject). Therefore I need to limit it based on group membership.
I had attempted to do it with freemarker, but in light of the people object only being available in the JavaScript API, how would you suggest I go about changing how I have developed this to work. Maybe I went about this the wrong way. Is there even a way to use the server-side JavaScript API within freemarker?
Thanks for your help.
I have created these freemarker templates, because I want them to be located within the repository and be able to be edited, without having to change the JSP and rebuild the war file. (similar to how I created custom dashlets for the dashboard).
That being said, one of the templates shows different text (in fact, it uses the workflow command processor to approve/reject). Therefore I need to limit it based on group membership.
I had attempted to do it with freemarker, but in light of the people object only being available in the JavaScript API, how would you suggest I go about changing how I have developed this to work. Maybe I went about this the wrong way. Is there even a way to use the server-side JavaScript API within freemarker?
Thanks for your help.
