Announcement Announcement Module
Collapse
No announcement yet.
How to insert Roles from database as GrantedAuthoritySid in MutableAcl? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.!

    Comment

    Working...
    X