cancel
Showing results for 
Search instead for 
Did you mean: 

Granular Permission Rights

ottopodo
Champ in-the-making
Champ in-the-making
I had Granular Permission Rights enabled in our 3.4 installation according to this article (http://keytocontent.blogspot.com/2011/04/accessing-granular-permission-rights.html).
I see that in 4.0 Alfresco changed configuration without care about migration problems.
I'm trying to figure out how to change configuration share-documentlibrary-config.xml to obtain the same feature.
Can someone point me in the right direction?
Marco
9 REPLIES 9

ottopodo
Champ in-the-making
Champ in-the-making
I reply to my question…  Smiley Very Happy
I jus replaced
        <!– Manage permissions (site roles) –>
         <action id="document-manage-site-permissions" type="javascript" icon="document-manage-permissions" label="actions.document.manage-permissions">
            <param name="function">onActionManagePermissions</param>
            <permissions>
               <permission allow="true">ChangePermissions</permission>
            </permissions>
            <evaluator>evaluator.doclib.action.siteBased</evaluator>
         </action>

with

          <!– Manage permissions (site roles) –>
         <action id="document-manage-site-permissions" type="pagelink" icon="document-manage-permissions" label="actions.document.manage-permissions">
            <param name="page">manage-permissions?nodeRef={node.nodeRef}</param>
            <permissions>
               <permission allow="true">ChangePermissions</permission>
            </permissions>
            <evaluator negate="true">evaluator.doclib.action.siteBased</evaluator>
         </action>

and now I have granular permission Rights as in repository.
Marco

mikeh
Star Contributor
Star Contributor
I see that in 4.0 Alfresco changed configuration without care about migration problems.
Somewhat harsh. There are lots of developer blogs at http://blogs.alfresco.com/ regarding the new extensibility features of both Surf and the Document Library. We also recently held two 2-day DevCons where people could come and talk to the engineering team directly about issues such as code migration.

Here's my entry on the new Document Library extension points: http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/

As much as we'd like to, it's impractical to provide a "step-by-step" guide as each customisation will be completely different.

Thanks,
Mike

ottopodo
Champ in-the-making
Champ in-the-making
Thank you Mike,
I will go through your article and other resources.
Sorry if I was a little bit hard.  Smiley Very Happy
But please consider that not all the projects have resources to rewrite everything and that if migrations become complex they reopen evaluation phase, alternative solutions evaluation…I think that also a soft migration process is a great feature.

Marco

yatin
Champ in-the-making
Champ in-the-making
Hi ottopodo

i tried exactly the same thing but after making the changes to the share-documentlibrary-config.xml file, i cant see the option to Manage Permissions on my Sites anymore? i am using Alfresco 4.0.c. Any idea?

chris_toselli
Champ in-the-making
Champ in-the-making
Hi ottopodo

I've had the same result as yatin.  I made that change to share-documentlibrary-config.xml and it's removed the ability to manage permissions. I'm also using 4.0.c.  Thanks again for this post - this has been something that I have been wanting to do for a long time

Thanks

mmtman
Champ in-the-making
Champ in-the-making
Just remove: negate="true" from the evaluator line and then it works fine.

So, this line

<evaluator negate="true">evaluator.doclib.action.siteBased</evaluator>

should look like this

<evaluator>evaluator.doclib.action.siteBased</evaluator>

mmtman
Champ in-the-making
Champ in-the-making
What I posted above works for when you want to click on Manage Permissions and get the granular permissions as you would in the repository, but another thing yet to change is when clicking on the little icon in the Permissions section on the right-side of the document details page.  I don't yet know how to make this button redirect to the granular permissions for the document. 

It should be possible because you can change the document-details in the URL to manage-permissions and then you're directed to the granular permissions.  The problem, from what I can tell so far, is that the little icon in the Permissions section executes some sort of JavaScript to create the little dialog that comes up.  If anyone can help out with how to override this that'd be great. 

In the meantime, I just moved the document-permissions.get.js (located in your tomcat directory at: webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details) to document-permissions.get.js.bak and then the Permissions section on the document details page is no longer visible.  The Manage Permissions option is still available at the top of the page and works as expect when following the modifications in these posts.

chris_toselli
Champ in-the-making
Champ in-the-making
Hi mmtman

Thanks for posting that - that worked great.

wabson
Star Contributor
Star Contributor
The 'Manage Permissions' link itself is rendered by the document-permissions.get.html.ftl file, but if you look at the anchor tag you'll notice that it has no 'href' attribute. Instead, the onclick behaviour is implemented by the onManagePermissionsClick() method of the class Alfresco.DocumentPermissions (JavaScript docs).

The link element is associated to that method via its 'name' attribute, on the following line.

<a href="#" name=".onManagePermissionsClick" class="${el} edit" title="${msg("label.edit")}"> </a>

So, if you want to remove the JavaScript behaviour, simply remove the 'name' attribute, or change its value to something else.

That will leave a link that does nothing when clicked, so it's better if you change its behaviour. You could add a new prototype method to Alfresco.DocumentPermissions and bind that to the link to implement some custom JavaScript behaviour, but it's easier by far in this instance to simply change the link's 'href' attribute value to point to the Manage Permissions page.

<a href="manage-permissions?nodeRef=${nodeRef?html}" class="${el} edit" title="${msg("label.edit")}"> </a>

The FTL file can be found in tomcat/webapps/share/classes/alfresco/site-webscripts/org/alfresco/components/document-details, but rather than updating it in-place you should copy it into the directory tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/document-details (after creating this folder structure if necessary) and update it there.

Lastly, an even better method (say, if you wanted to install this across multiple environments) would be to use a Share Extensibility module to override the component's FTL (or to remove the component completely from the page). See the archives of Dave Draper's blog at http://blogs.alfresco.com/wp/ddraper/ for more information.

Cheers,
Will