Skip to Content
author's profile photo Former Member
Former Member

Permissions based on Property and Group

Hello,

i want to change the permissions of a user (read, write, delete) for a resource during runtime, based on properties of the resource and group memberships of the user. Has anyone an idea how to achieve this.

Every user has the permission "Full Control" set for the repository of the folder

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2005 at 06:34 PM

    Hi Macro,

    I assume permissions are managed using aclSecurityManager (such as in /documents repository manager).

    In this method, not every resource has an acl (access control list).

    A resource that doesn't have an acl inherits its permissions from its father.

    Therefore the way to remove permissions for a resource without an acl is to create an empty acl for it.

    Here's an example code:

    if (privateFlag){	
            IResourceAclManager aclMan = ((IAclSecurityManager) aResource.getRepositoryManager().getSecurityManager(aResource)).getAclManager();
    	aclMan.createAcl(aResource);
    }
    else{
    	IResourceAclManager aclMan = ((IAclSecurityManager) aResource.getRepositoryManager().getSecurityManager(aResource)).getAclManager();
    	IResourceAcl acl = aclMan.createAcl(aResource);
    	IUMPrincipal everyone = WPUMFactory.getGroupFactory().getGroup("Everyone");
    	IAclPermission read = aclMan.getPermission(IAclPermission.ACL_PERMISSION_READ);
    	IResourceAclEntry entry = aclMan.createAclEntry(everyone,false,read,0);
    	acl.addEntry(entry);
    }

    Hope that helps,

    Yoav.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.