Disabling 'Create Site' Button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2015 09:23 AM
Do anyone of you know, or did anyone tried to disable (hide) the "Create Site" Button for non Admin users (or show it only for specific group of ppl)?
I'm using Alfresco 5.0.c. I found some topic on 4.0, 4.2 and even older versions, but I tried them all and non of them worked as it should.
Regards!
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2015 12:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2015 12:46 PM
share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/modules/header/sites.get.html.ftl
share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/modules/header/sites.get.js
its quite 'dirty' but I don't how to do that in any other way…
ex:
in ftp template:
<#if createSiteVisible> <ul class="create-site-menuitem"> <li> <a href="#" onclick='Alfresco.util.ComponentManager.get("${id_js}").showCreateSite(); return false;'>${msg("label.create-site")}</a> </li> </ul></#if>
in js:
createSiteVisible function returns true/false if user is admin….
(i'll post an example later id needed)
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2015 04:55 AM
Just a question about code in the .js file, would you please let me know where I need to add it?
I can see :
model.showCreateSite = true;
I assume that I need to ovewrite it with something like:
if (user == admin)
{model.createSiteVisible = true}
else {model.createSiteVisible = false}
Am I right?
Regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2017 01:21 AM
Hi i couldn't find the code you mentioned in the provided path, i'm unable to identify the source... i'm sending you a screenshot.. could you help me please??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2015 01:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2015 04:56 AM

Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2015 10:32 AM
you can try to add this code in my-sites.get.js:
var createSiteVisible = userHasGroup(user.name, 'SiteCreators');model.createSiteVisible = createSiteVisible;function userHasGroup(username, group) { var result = remote.call("/api/people/" + stringUtils.urlEncode(username) + "?groups=true"); if (result.status == 200 && result != "{}") { var user = eval('(' + result + ')'); var groups = new Array(); groups = user.groups; for (i = 0; i < groups.length; i++) { if (groups[i].itemName == "GROUP_" + group || groups[i].itemName == "GROUP_ALFRESCO_ADMINISTRATORS") { return true; // found group } } return false; } else { return false; }}
Edit: the code had some errors, and there were parts not relevant to the topic, so I fixed it and removed those parts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2015 04:49 AM
I just tried the code added to my-sites.get.js. However I still can see the button with all users.
I'm using LDAP - AD authentication, I didn't mentioned, because I do not think it's relevant.
Also should I delete some compiled files before I restart the service? I'm asking because not so long ago I did that when I needed to do some other customizations.
Regards,
Bobi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 07:56 PM
https://github.com/jpotts/share-site-creators
It restricts the create-site links everywhere they exist to only the members of the Site Creators group. If it doesn't work in 5.0.c create an issue and I'll look at it.
Jeff
