cancel
Showing results for 
Search instead for 
Did you mean: 

Add User Homes to header

cepums
Champ in-the-making
Champ in-the-making
Hi! I've removed Repository from Header Menu using this tutorial - https://www.alfresco.com/blogs/developer/2013/09/16/customizing-the-share-header-part-3/ I added
widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_REPOSITORY");
to share-header.get.js file.
But is there option to add direct link to User Homes in Header menu? And how I can do that?
7 REPLIES 7

muralidharand
Star Contributor
Star Contributor
By default the repository page has user authentication, so all the authenticated users are allowed to access Repository page.
To prevent this, you need to change the authentication from user to admin as mentioned in below
File Page :
 C:\ALF_DIR\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages\repository.xml 


<?xml version='1.0' encoding='UTF-8'?>
<page>
   <title>Repository Browser</title>
   <title-id>page.repository.title</title-id>
   <description>Browse content across the whole Repository</description>
   <description-id>page.repository.description</description-id>
   <template-instance>repository</template-instance>
   <authentication>admin</authentication>
</page>

cepums
Champ in-the-making
Champ in-the-making
Hi! Thanks for reply. No, I don't need prevent users from opening repository. I wanted remove Repository link from header menu, and I did it using tutorial I posted before. But now I want add link to "User Homes"  folder in same place where was link to Repository.
Thanks!

muralidharand
Star Contributor
Star Contributor
Hope this helps you.

    var repositoryMenuItem = widgetUtils.findObject(model.jsonModel, "id","HEADER_REPOSITORY"); //get the instance of Repository Menu item
    repositoryMenuItem.config.targetUrl = "<New Page URL>"; //Update the Repository menu Item URL
    repositoryMenuItem.config.label="<New Page Lable>"; //Update the label

Example:
    var repositoryMenuItem = widgetUtils.findObject(model.jsonModel, "id","HEADER_REPOSITORY");
    repositoryMenuItem.config.targetUrl = "console/admin-console/application";
    repositoryMenuItem.config.label="My Admin Console";

niketapatel
Star Contributor
Star Contributor
Hi, In alfresco 5.0 there is also other way to hide repository link from header. Please check this - http://docs.alfresco.com/5.1/tasks/share-repodoclib-config.html

Other thing, You want to have direct link to User Homes. That can be done by changing root folder as described in same link - http://docs.alfresco.com/5.1/tasks/share-repodoclib-config.html

- Keep Repository visible to all
- Chanage root node to - alfresco://user/home
- Admin can see everything while OOB any non-admin user doesnt have access to User home or any other user folder under it.
non-admin user can access only his/her user home folder. So when non-admin user click on Reposiroty it will directly take him to own home folder link this will similar to current OOB available link - 'My Files'

cepums
Champ in-the-making
Champ in-the-making
Thanks, niketapatel. This works. But it's not what I want achieve. When I set rood node to alfresco://user/home, user opens his own folder. But I want that user can open folder one step back. Currently testuser1 opens /User Homes/testuser1 folder, but I want him allow open just /User Homes folder. So then testuser1 will be able to see his own folder and maybe other user folder if I will set permissions for testuser1 for other user folders.

Thanks!

muralidharand
Star Contributor
Star Contributor
If you want to redirect the user to user home (root ) directory, then use below code.


var repositoryMenuItem = widgetUtils.findObject(model.jsonModel, "id","HEADER_REPOSITORY");
repositoryMenuItem.config.targetUrl = "repository#filter=path%7C%2FUser%2520Homes";
repositoryMenuItem.config.label="User Home";


If you want to redirect the user to his/her user home directory, then use below code.

var repositoryMenuItem = widgetUtils.findObject(model.jsonModel, "id","HEADER_REPOSITORY");
repositoryMenuItem.config.targetUrl = "repository#filter=path%7C%2FUser%2520Homes%2F"+user.name;
repositoryMenuItem.config.label="User Home";


Refer the attached.
I logged in as "likitha", when I click
 User Homes 
menu, then I'm redirected their user home directory and I can see only my user home directory.

Hope this helps you.

Please let me know, if you need any help on this.

cepums
Champ in-the-making
Champ in-the-making
Thanks, muralidharand! It works like a charm. Smiley Wink