permissionManager.grantPermissions(..) returns true but the values are not in the database
mroeoesli Oct 16, 2008 10:30 AMI tryed to grant permissions to an object of my TestClass. I try it like this:
@In PermissionManager permissionManager; .... TestClass tc=new TestClass(); Permission p1= new Permission(tc,"view",identity.getPrincipal()); Permission p2= new Permission(tc,"test",identity.getPrincipal()); List<Permission> permissions= new ArrayList<Permission>(); permissions.add(p1); permissions.add(p2); permissionManager.grantPermissions(permissions);
identity.getPrincipal() is the user 'admin' successfuly authed by the identity manager. this user has the role 'root'
to get access to grant permissions i added this rule in my security-rules.drl file
... import ch.pomop.dummy.common.TestClass; ... rule ManageTestClassPermissions no-loop activation-group "permissions" when tc: TestClass() check: PermissionCheck(target == tc, action == "seam.grant-permission", granted == false) Role(name == "root") then check.grant(); end
permissionManager.grantPermissions(permissions) returns true but there is no value in my database.
I also tryed
permissionManager.getPermissionStore().grantPermissions(permissions);
I also tryed to add @Transactional to my method wich calls grantPermissions(..)
my entityManager works properly in other methods
there is no exception and the result is ture but there is no entry in the database.
I configured the PermissionManager like this:
<security:permission-manager permission-store="#{org.jboss.seam.security.jpaPermissionStore}" /> <security:jpa-permission-store user-permission-class="ch.pomop.dummy.security.AccountPermission" />
my AccountPermission looks like this
@Entity public class AccountPermission implements Serializable { /** * */ private static final long serialVersionUID = -1901644563196207597L; private Integer permissionId; private String recipient; private String target; private String action; private String discriminator; public AccountPermission() { System.out.println("------------>"); } @Id @GeneratedValue public Integer getPermissionId() { return permissionId; } public void setPermissionId(Integer permissionId) { this.permissionId = permissionId; } @PermissionUser @PermissionRole public String getRecipient() { return recipient; } public void setRecipient(String recipient) { this.recipient = recipient; } @PermissionTarget public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } @PermissionAction public String getAction() { return action; } public void setAction(String action) { this.action = action; } @PermissionDiscriminator public String getDiscriminator() { return discriminator; } public void setDiscriminator(String discriminator) { this.discriminator = discriminator; } }
Is there something wrong what I am trying to do?
Thx for your help!!
greetz Marco