Make options in header 'admin-only' in Alfresco 4.2d

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2013 11:46 AM
For example the Create Site-option was editable like that in: tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/modules/header/sites.get.html.ftl
Also, to make the Repository button admin-accessible only, you could set "permission=admin" to the right option in: tomcat/webapps/share/WEB-INF/classes/alfresco/share-config.xml
In 4.2d, these don't work anymore and I can't find where I can influence this behaviour.
Setting <legacy-mode-enabled> to 'true', which should make the pre-4.2d way work again, but this made things far worse: the Header bar layout was all wrong.
Hope someone can point me in te right direction!
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2013 12:16 PM
<config evaluator="string-compare" condition="RepositoryLibrary" replace="true"> <visible>false</visible></config>
…it should be noted that even if the Repository link is removed, it is still accessible via a direct URL and all users (by default) do have read access to Company Home.
There is also a legacy mode configuration element for building the new header using the old configuration (although as you've pointed out the layout isn't ideal primarily because of the way in which the "Sites" drop-down menu was written using custom JavaScript).
However, the new header menu should be more flexible although perhaps not in your specific example of just wanting to make certain menu items admin only through pure configuration. You can now reconfigure the menu bar via extensions where you identify the widget for each menu item, menu group, menu drop-down or menu bar (and indeed any other widget in the header) and either update it, remove it or add to it. This should make it very easy to customise the menu bar in a way that makes it more resistant to core changes.
Hopefully you won't find making these changes to arduous although I can see in this case it is probably going to be more work than it was before (and I'm sorry that this is the case) but hopefully you'll be able to see the benefits in the approach we've taken. We're already "eating our own dog food" in this regard as we take the same approach in customizing the header menu for our cloud offering.
If you have any issues customizing the header bar then please post to the forums and I'll try to help you with the solution.
Regards,
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2013 06:26 PM
I have the opposite issue. I *want* the repository to be available to non-admin users. This is because some external WS clients access the files in the user's User Homes/${username} folder and the users want to use /share and view those files. Am I supposed to set legacy-mode-enabled to true so that non-admin users can see the Repository link?
There's no legacy-mode-enabled or header block in share-config-custom.xml.sample so I tried a few things. first copy share-config-custom.xml.sample to share-config-custom.xml
1. there's a config/flags block in share-config-custom.xml, so I added legacy-mode-enabled there with setting true. after alfresco restart, non-admins have no Repository link.
2. I copied the whole share-config.xml into share-config-custom.xml 🙂 and set legacy-mode-enabled to true in the custom file. no Repository link for non-admins after restart.
3. I edited share-config.xml and set legacy-mode-enabled true there. after restart, non-admins DO have the Repository link.
I'd much prefer to set that in custom config though. What am I missing?
Thanks for any pointers,
Gerald Quimpo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 03:17 AM
Regards,
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 07:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2013 10:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2013 03:33 AM
What would really help, is something like an example or some pointers how to edit/modify one of these menu drop-downs (or are it groups?) and replace the original one with it (as I understand that's how it should be done now), using the web-extensions folder.
As I'm not really sure where to look for the new files that are used by the new header, I hope you can help with that as well.
And also: it would be rally nice to be able to hide the Repository and Create Site links for non-admins, but show it for admins. Not completely remove them. I know what URL to use, but probably not all admins in the world do 😉
Also, in "tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/modules/header/sites.get.html.ftl" I see things like <#if showCreateSite> and <#if showFindSites>. This is what I'd normally use to add an admin-only check. How/where can you configure these switches?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2013 05:05 AM
The share-header.get WebScript uses the "share-header.lib.js" file to build the header which you could import and use to build a completely new header if you wanted to completely replace the default "share-header.get" WebScript via the web-extensions folder.
FYI… setting the "visible" element to "false" will only hide the Repository link for non-Admins (which is what you want)… it should actually be like that by default and I've actually committed that fix this morning.
Regards,
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2013 10:42 AM
As I read it, it should be easy to hide the Repository-button for non-admins.
To hide the 'Create Site'-button for non-admins: if I find the time to have a good look at this, I think I can fix myself some extensions/replacements for the Share header.
Regards,
Erwin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2013 11:42 AM
Basically you have to do the following:
1) Create an extension the "share-header.get.js" WebScript JavaScript controller
2) Create a new widget that extends "alfresco/header/AlfSitesMenu"
3) Make the new widget override the "addUsefulGroup" function so that the create site menu item doesn't get added
4) In your extension controller use widgetUtils.findObject to locate the "HEADER_SITES_MENU" widget
5) Modify the definition so that the "name" attribute is set to your custom widget
6) If you create your custom widget in your own package then you'll need to update the surf.xml to add the root location of your module so that it can be picked as an AMD resource.
The reason that this example is slightly more complicated (e.g. than say just finding a menu item and removing it) is because the sites menu does a lot of dynamic generation of menu items (e.g. the recent sites and favourite items). However, I can see that I should have included some boolean configuration so that you could toggle which menu items are shown (e.g. the create sites and site finder, etc). Then this would have been much easier. It's obviously too late for me to commit this change to the 4.2d Community release but I can have it in place for Enterprise and the next Community release.
Regards,
Dave
