cancel
Showing results for 
Search instead for 
Did you mean: 

Disable 'Create site' link

lees
Champ in-the-making
Champ in-the-making
Hi all,

I want to disable  the 'Create Site' link from the 'My sites' dashlet in case the user is not belong to admin group.

let me know any pointers as to how to implement..

-thx
41 REPLIES 41

norgan
Champ in-the-making
Champ in-the-making
1) Search  for the Textstring in the properties files and mark the codeline
2) Search for the JSP, using the codeline, which gives you the text
3) Copy & Change the JSP and change the Myfaces config to use your JSp instead of the standard.

For more details - see the wiki and  http://www.ecmarchitect.com

lees
Champ in-the-making
Champ in-the-making
Hi Norgan,

Thanks for the reply!
I am not an Alfresco expert and I didn't worked in any customization parts. Anyway as you said I do a search for the textstring in the properties files and get my-sites.js. I am looking on it. Hopefully this is the one you suggested.

Lees

norgan
Champ in-the-making
Champ in-the-making
I hope so as well Smiley Happy That was jus the way, I would have searched.

You might think about adjusting the rights system, however, to finetune the SHARE rights to "may create new sites" or something. because hiding the link will still allow black sheep to directly call the JSP and create their shadow sites.

And regardless of wether you solved it, alfresco has to do it or the community might help - open up a ticket with issues.alfresco.com as feature request/improvement for share. Then post the link here to make people vote on it.

Norgan

gronfelt
Champ in-the-making
Champ in-the-making
If you simply want to prevent the Create Site-link from being shown you could disable it in the file my-sites.get.html.ftl.

You should be able to use something like this to enable it for Admin users only:

<#if user.isAdmin>
                 <div class="toolbar">
                       <a href="#" id="${args.htmlid}-createSite-button" class="theme-color-1">${msg("link.createSite")}</a>
                 </div>
</#if>

(That's also how the Administration link in the header is shown/hidden.)

However, this will not disable the functionality itself, merely the link.

lees
Champ in-the-making
Champ in-the-making
That is really cool workaround!!

It is now working as well and still looking whether I can add site_managers group instead of admin  :wink: .

Thanks gronfelt.
However as Norgan said, will open a ticket in JIRA.

lees
Champ in-the-making
Champ in-the-making
Another solution, but it is with Alfresco explorer
http://forums.alfresco.com/en/viewtopic.php?f=47&t=21330

unknown-user
Champ on-the-rise
Champ on-the-rise
Using this solution, When I log back in as a non admin user, I can still see the button. Does this only work for users that do not have a profile yet? If so how can I force everyone to have new profiles at login?

Also using this method can I remove the invite right to all users? I only want admin and site admins to be able to invite users.

Thanks

lgarcia
Champ in-the-making
Champ in-the-making
Hi all. I tried the above code and it works. But what i want is to allow the creation of sites for some users, not only the admin. I want to create a function, like the "isAdmin", for example "isfromGroupCreate", that returns true is the users bellongs to the group "Create". Someone has any ideas?
Thanks,
Luís Garcia.

fkoenig
Champ in-the-making
Champ in-the-making
If you simply want to prevent the Create Site-link from being shown you could disable it in the file my-sites.get.html.ftl.

You should be able to use something like this to enable it for Admin users only:

<#if user.isAdmin>
                 <div class="toolbar">
                       <a href="#" id="${args.htmlid}-createSite-button" class="theme-color-1">${msg("link.createSite")}</a>
                 </div>
</#if>

(That's also how the Administration link in the header is shown/hidden.)

However, this will not disable the functionality itself, merely the link.

This only prevents the "Create Site" link from being shown in the My Sites dashlet.

If you want to remove it from the drop-down menu next to Sites in the page header, edit header.get.html.ftl , something like:


<#if !isGuest>
         <#if user.isAdmin>
         <ul class="create-site-menuitem">
            <li>
               <a href="#" onclick="thisHeader.showCreateSite(); return false;">${msg("header.sites.createSite")}</a>
            </li>
         </ul>
         </#if>
         </#if>

Io remove it from the Getting started dashlet edit user-welcome.get.html.ftl , something like :

<#if user.isAdmin>
      <div class="detail-list-item">
         <h4 class="theme-color-2">${msg("header.customiseDashboard")}</h4>
         <div>${msg("text.customiseDashboard")}</div>
         <div><a href="${url.context}/page/customise-user-dashboard" class="theme-color-2">${msg("link.customiseDashboard")}</a></div>
      </div>
      <div class="detail-list-item last-item">
         <h4 class="theme-color-2">${msg("header.createSite")}</h4>
         <div>${msg("text.createSite")}</div>
         <div><a id="${args.htmlid}-createSite-button" href="#" class="theme-color-2">${msg("link.createSite")}</a></div>
      </div>
<#else>
      <div class="detail-list-item last-item">
         <h4 class="theme-color-2">${msg("header.customiseDashboard")}</h4>
         <div>${msg("text.customiseDashboard")}</div>
         <div><a href="${url.context}/page/customise-user-dashboard" class="theme-color-2">${msg("link.customiseDashboard")}</a></div>
      </div>