cancel
Showing results for 
Search instead for 
Did you mean: 

Share header

mrgrechkinn
Champ in-the-making
Champ in-the-making
Hello,

How I can customize share header by user permissions or group. Show\hide items for example.

Thanks.
3 REPLIES 3

vamirr
Champ on-the-rise
Champ on-the-rise
I've done something similar to this to remove the Create Site option from being displayed to users who are not in my SITE_CREATORS group.

In this case I'm editing the following:
classes/alfresco/web-extension/site-webscripts/org/alfresco/modules/header/sites.get.js
classes/alfresco/web-extension/site-webscripts/org/alfresco/modules/header/sites.get.html.ftl

In the javascript file, I'm querying the SITE_CREATORS group for its members, then  checking to see if the user is in the group.  Once I have concluded that the user is or is not in the group, I set a model variable (canCreate) accordingly.



        siteowners = remote.call("/api/groups/SITE_CREATORS/children?authorityType=USER");
        siteowners = eval('(' + siteowners + ')');

        model.canCreate = false;
        if(siteowners && siteowners.data)
        for(i=0; i<siteowners.data.length; i++){
                current_user = siteowners.data[i];

                if(current_user.shortName == user.id){
                        model.canCreate = true;
                        break;
                }
        }


Now I have a variable to use in the template.   In my sites.get.html.ftl template, I've added the following.  If the canCreate variable is true, it writes the create site link, if not, it doesn't.



  <#if canCreate || isAdmin>
      <ul class="create-site-menuitem">
         <li>
            <span><a href="#" onclick='Alfresco.util.ComponentManager.get("${id_js}").showCreateSite(); return false;'>${msg("label.create-site")}</a></span>
         </li>
      </ul>
</#if>

Let me know if this helps.

efestione
Champ in-the-making
Champ in-the-making
Hi,
have you already taken a look at this?
http://wiki.alfresco.com/wiki/Share_Header

mrgrechkinn
Champ in-the-making
Champ in-the-making
Hello,
Yes, I saw it already, but in this wiki we can only use "admin" in the permission property. But we can't customize header through other permissions.