Results 1 to 2 of 2

Thread: How to insert Roles from database as GrantedAuthoritySid in MutableAcl?

  1. #1
    Join Date
    Dec 2012
    Posts
    21

    Question How to insert Roles from database as GrantedAuthoritySid in MutableAcl?

    I have a mutableacl service as follows:-

    private MutableAclService mutableAclService;

    public void setMutableAclService(MutableAclService mutableAclService) {
    this.mutableAclService = mutableAclService;
    }
    And i have added the ObjectIdentity into it.

    ObjectIdentity oid =new ObjectIdentityImpl(Message.class, message.getId());
    MutableAcl acl = mutableAclService.createAcl(oid);

    And set permission as follows:-

    acl.insertAce(0, BasePermission.ADMINISTRATION,new PrincipalSid(request.getRemoteUser()), true);
    acl.insertAce(1, BasePermission.DELETE,new GrantedAuthoritySid("ROLE_ADMIN"), true);
    acl.insertAce(2, BasePermission.READ,new GrantedAuthoritySid("ROLE_USER"), true);

    I need to know how to make the roles(ie "ROLE_ADMIN","ROLE_USER") dynamic from database.

  2. #2
    Join Date
    Dec 2012
    Posts
    21

    Talking

    Quote Originally Posted by mirnav View Post
    I have a mutableacl service as follows:-

    private MutableAclService mutableAclService;

    public void setMutableAclService(MutableAclService mutableAclService) {
    this.mutableAclService = mutableAclService;
    }
    And i have added the ObjectIdentity into it.

    ObjectIdentity oid =new ObjectIdentityImpl(Message.class, message.getId());
    MutableAcl acl = mutableAclService.createAcl(oid);

    And set permission as follows:-

    acl.insertAce(0, BasePermission.ADMINISTRATION,new PrincipalSid(request.getRemoteUser()), true);
    acl.insertAce(1, BasePermission.DELETE,new GrantedAuthoritySid("ROLE_ADMIN"), true);
    acl.insertAce(2, BasePermission.READ,new GrantedAuthoritySid("ROLE_USER"), true);

    I need to know how to make the roles(ie "ROLE_ADMIN","ROLE_USER") dynamic from database.


    I have made the roles dynamic from database.!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •