cancel
Showing results for 
Search instead for 
Did you mean: 

change all users' role

lucille_arkenst
Champ in-the-making
Champ in-the-making
Is there a way to change the role of all users to one particular role?
3 REPLIES 3

sanket
Champ on-the-rise
Champ on-the-rise
U can assign all users to one group. And assign a role (say - Consumer) to that group.
If u want to change the role, just delete the existing permission and set new permission.


   String lStrSpaceGroupName = request.getParameter("spaceGroupName")!=null ? request.getParameter("spaceGroupName") : "";
        NodeRef nodeRefOfPermissiveSpace = null;
        groupName = getAuthorityService().getName(AuthorityType.GROUP, lStrSpaceGroupName);
        if(getAuthorityService().authorityExists(groupName)){
                  nodeRefOfPermissiveSpace = new NodeRef(Repository.getStoreRef(),lStrSpaceNodeRef);
                  getPermissionService().deletePermission(nodeRefOfPermissiveSpace, groupName , PermissionService.CONSUMER);
             getPermissionService().deletePermission(nodeRefOfPermissiveSpace, groupName , PermissionService.CONTRIBUTOR);
             getPermissionService().deletePermission(nodeRefOfPermissiveSpace, groupName , PermissionService.EDITOR);

                  getPermissionService().setPermission(nodeRefOfPermissiveSpace,groupName ,PermissionService.CONSUMER, true);
        }

Dont forget to make entry of the services used in the above code in your xml file.

Thanks

lucille_arkenst
Champ in-the-making
Champ in-the-making
Sanket, thank you for your reply.  I have been using web scripts because I don't know what to do with Java files.  Can I just compile it locally and put it somewhere on the system?  Or do I need to pull in the whole Alfresco into Eclipse and export a war file or something?  Also which xml file are you referring to?
Thanks again.

sanket
Champ on-the-rise
Champ on-the-rise
I have created my java class, put d entries of the bean in d xml and then after compilation, I build a JAR and put in under
tomcat\webapps\alfresco\WEB-INF\lib.

And restart tomcat to reflect the changes.
SO, I guess yes. Without importing the Alfresco in eclipse, it wont b directly possible.