why is me.isAdmin not working?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2009 10:20 AM
I am trying to update Alfresco/root/projects/slingshot/source/web/components/site-members/site-members.js as below
Will include the SiteManager piece also however for testing just took it out. As a system admin I do not have the ability to edit user's roles in a site so it doesn't seem to be honoring the isAdmin piece like it does in other JS files. Am I doing something wrong?
Thanks.
JR
Note: Also should be noted that I do not get any javascript errors on the page with this so it seems it thinks it's a valid object/method maybe.
if (me.isAdmin)// if (me.options.currentUserRole !== undefined &&// me.options.currentUserRole === "SiteManager") { this.isCurrentUserSiteAdmin = true; }
Will include the SiteManager piece also however for testing just took it out. As a system admin I do not have the ability to edit user's roles in a site so it doesn't seem to be honoring the isAdmin piece like it does in other JS files. Am I doing something wrong?
Thanks.
JR
Note: Also should be noted that I do not get any javascript errors on the page with this so it seems it thinks it's a valid object/method maybe.
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2009 06:46 AM
That's client-side JavaScript, so unless you've passed the value in it doesn't have access to any "isAdmin" property. the usual "Share" way of doing this is to add it to the setOptions call in the Freemarker template and pick it up in the JavaScript from there ("me.options.isAdmin").
The reason the code isn't failing is because it's just being returned as "undefined" and so the if statement fails.
Thanks,
Mike
The reason the code isn't failing is because it's just being returned as "undefined" and so the if statement fails.
Thanks,
Mike
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2009 09:28 AM
That's client-side JavaScript, so unless you've passed the value in it doesn't have access to any "isAdmin" property. the usual "Share" way of doing this is to add it to the setOptions call in the Freemarker template and pick it up in the JavaScript from there ("me.options.isAdmin").
The reason the code isn't failing is because it's just being returned as "undefined" and so the if statement fails.
Thanks,
Mike
Thanks for the reply Mike. Don't see a lot on the setOptions value for FreeMarker in any documentation however here is my thought. Let me know if it's right before I recompile and push to the dev server for testing.
1. Edit Alfresco/root/projects/slingshot/config/alfresco/site-webscripts/org/alfresco/components/site-members/site-members.get.html.ftl and add to the top:
<#assign areAdmin = (user.name=='admin') />
2. In same file add
isAdmin: areAdmin,
or maybeisAdmin: ${areAdmin},
after
<script type="text/javascript">//<