cancel
Showing results for 
Search instead for 
Did you mean: 

How hide the Site Page Links to non admin users

phanisridath
Champ in-the-making
Champ in-the-making
There are 2 link in the site, which are visible for all the menbers of the site. Now I want to hide those 2 links for non admin users.

In shre-config-custom.xml

I made the entries as

<config evaluator="string-compare" condition="SitePages" >
                   <pages>
                            <page id="content-translator">content-translator</page>
                            <page id="admin-page">admin-page</page>
                    </pages>

</config>

How to hide these 2 links to users who are not admins.

I tried in the following ways, but its not working

1.<config evaluator="string-compare" condition="SitePages" permission="admin">
2.added

<groups>GROUP_ALFRESCO_ADMINISTRATORS</groups>

<negate>true</negate>

Can any one please suggest me how to permission only for admin.


Thanks,
Sridath

3 REPLIES 3

anshu_kumar
Star Contributor
Star Contributor
Hello Phani,

In order to hide Site Page links to Non-Admin users, you will have to add validation to 'collaboration-navigation.get.html.ftl' available under file path '\{ServerPath}\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\navigation'

*******************START CODE*******************
<#if linkPage = "admin-page">
   <#if user.isAdmin>
      <span class="navigation-item"><a href="${url.context}/page/site/${activeSite}/${linkPage}" ${linkClass}>${(p.sitePageTitle!p.title)?html}</a></span>
   </#if>
   <#else>
      <span class="navigation-item"><a href="${url.context}/page/site/${activeSite}/${linkPage}" ${linkClass}>${(p.sitePageTitle!p.title)?html}</a></span>
   </#if>
************************END CODE**********************


Similarly, add another check for your translator page.

Hope my answer is helpful.

anshu_kumar
Star Contributor
Star Contributor
Look for the below block of code in 'collaboration-navigation.get.html.ftl'

************************Start Code**********************
<#list pages as p>
  <#assign linkPage=p.pageUrl!p.title/>
    <#if linkPage?index_of(pageFamily) != -1>
      <#assign linkClass>class="active-page theme-color-4"</#assign>     
    <#else>
      <#assign linkClass>class="theme-color-4"</#assign>
    </#if>
    <span class="navigation-item"><a href="${url.context}/page/site/${activeSite}/${linkPage}" ${linkClass}>${(p.sitePageTitle!p.title)?html}</a></span>
<#if p_has_next>
<span class="navigation-gap"> </span>
</#if>
</#list>
***********************End Code***************************

And add the relevant check(in my previous post) to the line of code this —-

<span class="navigation-item"><a href="${url.context}/page/site/${activeSite}/${linkPage}" ${linkClass}>${(p.sitePageTitle!p.title)?html}</a></span>

ddraper
World-Class Innovator
World-Class Innovator
If you're using version 4.2 then the suggested update from Anshu Kumar will not work because the header section of Share has been re-written for 4.2 and the "collaboration-nagigation.get" WebScript is no longer used. Please refer to the following blog posts for information on how to customize the header:
<ul><li>http://blogs.alfresco.com/wp/developer/2013/09/04/customizing-the-share-header-menu-part-1/</li>
<li>http://blogs.alfresco.com/wp/developer/2013/09/06/customizing-the-share-header-menu-part-2/</li>
<li>http://blogs.alfresco.com/wp/developer/2013/09/16/customizing-the-share-header-part-3/</li></ul>

Although these posts deal with the very top part of the header, the sites navigation menu (e.g. "Dashboard", "Document Library", "Members", etc) is also controlled by the same "share-header.get" WebScript so the principle remains the same. You should familiarise yourself with the "share-header.lib.js" library file to understand how the header is constructed and how to display menu items for admins only.

Regards,
Dave