This instruction will ONLY work from 4.2.e and I only tested in on 4.2.e. There are some good blog entries why it is not working on 4.2.d, so I will not discuss that here anymore.
I will not create an own JAR file for that customization, but do all in the shared directory. Perhaps I will provide a JAR file too, if I have some time which is quite rare.
1. Create a share module
create file shared/classes/alfresco/web-extension/site-data/extension/remove-create-site-extension.xml
<extension> <modules> <module> <id>Remove create site menu option for non admin users</id> <version>1.0</version> <customizations> <customization> <targetPackageRoot>org.alfresco.share.header</targetPackageRoot> <sourcePackageRoot>ingen.header</sourcePackageRoot> </customization> <customization> <targetPackageRoot>org.alfresco.components.dashlets</targetPackageRoot> <sourcePackageRoot>ingen.dashlets</sourcePackageRoot> </customization> </customizations> </module> </modules> </extension>2. customize header webscript
create file shared/classes/alfresco/web-extension/site-webscripts/ingen/header/share-header.get.js
//Find the "Sites" menu... var sitesMenu = widgetUtils.findObject(model.jsonModel, "id", "HEADER_SITES_MENU"); if (sitesMenu != null) { if (!user.isAdmin) { sitesMenu.config.showCreateSite = false; } }3. the 'my sites' dashlet
create file shared/classes/alfresco/web-extension/site-webscripts/ingen/dashlets/my-sites.get.js
if (!user.isAdmin) { model.showCreateSite = false; }4. don't forget the dynamic-welcome dashlet
Thanks Douglas for remembering me about the dynamic-welcome dashlet and the create site link in there. To remove that link create file shared/classes/alfresco/web-extension/site-webscripts/ingen/dashlets/dynamic-welcome.get.js
if (args.dashboardType == "user" && !user.isAdmin) { model.columns[1].actionMsg = null; model.columns[1].actionHref = null; }5. restart alfresco share
6. activate module
Now everything should be fine. But don't forget to restrict the service calls too - especially if you want to be sure that any left link, direct call and alternative frontend (mobile, ...) are save too ;)
Hey... I'm douglascrp from the Alfresco IRC channel
AntwortenLöschenNice one, but I think you have forgot about the create site link in dynamic-welcome dashlet.
Now you could create a new post about how to avoid a site to be deleted by non-admin users.
I think that it's so important as the create site option. Actually, I think it's even more dangerous.... lol
Other options I usually remove from non-admin users are leave site, invite users and customize site.
Cheers
Thanks Douglas, I added the dynamic-welcome dashlet to the instructions.
LöschenI was following this blog: (http://blogs.alfresco.com/wp/developer/2013/09/16/customizing-the-share-header-part-3) and managed to remove some items from the menu and was left with the "create site" options I wanted to remove. So I combined the information from that blog and this one and I have a nice, less cluttered share webinterface. Thanks.
AntwortenLöschenNice! I just read Douglas' comment and wow what a security issue. Any user can delete a site from the site dashlet?
AntwortenLöschen