[jboss-user] [JBoss Seam] - Re: Security - Define dynamic Role in application

markfoerstein do-not-reply at jboss.com
Fri May 4 19:27:27 EDT 2007


Hi Shane,

Today I finally got my hands on this. My database structure and entities are all set.

Step 2) tricked me, since the getSecurityContext() method is not available inside RuleBasedIdentity.instance(). So Im using the following to get the working memory:

  | WorkingMemory wm = ((RuleBasedIdentity) Identity.instance()).getSecurityContext();
  | 

Im having trouble coding the rule, and I though maybe you could help me. This is the rule (just the same you posted):

  | package DynamicPermission
  | 
  | import org.jboss.seam.security.PermissionCheck;
  | import com.sphere.consultoria.login.GrantedPermission;
  | 
  | rule GrantDynamicPermission
  |   no-loop
  |   activation-group "permissions"
  |   salience -10
  | when
  |   check: PermissionCheck(granted == false)
  |   GrantedPermission(n : name -> (n.equals(check.name)), a : action -> (a.equals(check.action)))
  | then
  |   check.grant();
  | end;
  | 

And here is the permission class:

  | ...
  | public class GrantedPermission implements Serializable {
  | 
  | 	private String name;
  | 	private String action;
  | 	
  | 	public String getAction() {
  | 		return action;
  | 	}
  | 	
  | 	public void setAction(String action) {
  | 		this.action = action;
  | 	}
  | 	
  | 	public String getName() {
  | 		return name;
  | 	}
  | 	
  | 	public void setName(String name) {
  | 		this.name = name;
  | 	}
  | 
  | 	@Override
  | 	public int hashCode() {
  | 	...
  | 	}
  | 
  | 	@Override
  | 	public boolean equals(Object obj) {
  | 	...
  | 	}
  | }
  | 

Im getting...

  | 19:52:13,975 INFO  [Lifecycle] starting up: org.jboss.seam.security.identity
  | 19:52:28,867 ERROR [[/consultoria]] Session event listener threw exception
  | org.drools.rule.InvalidRulePackage: Rule Compilation error Private member cannot be accessed from type "DynamicPermission.Rule_GrantDynamicPermission_0". Private member cannot be accessed from type "DynamicPermission.Rule_GrantDynamicPermission_0".
  | 
  | 	at org.drools.rule.Package.checkValidity(Unknown Source)
  | 	at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
  | 	at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:70)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 

I have no idea what's going on. The getters are public in either classes, GrantedPermission and PermissionCheck. So what private member can't be accessed?

Im using:
JBoss 4.0.5
JBoss Seam 1.2.1GA

Thanks in advance.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043380#4043380

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043380



More information about the jboss-user mailing list