[
http://jira.jboss.com/jira/browse/JBSEAM-1019?page=comments#action_12355693 ]
Shane Bryzak commented on JBSEAM-1019:
--------------------------------------
It should definitely work. The rules in the seamspace example include conditions based on
the Principal (which is an interface, the concrete class actually asserted in the working
memory is org.jboss.seam.security.SimplePrincipal) and these work fine.
Asserted objects should be handled polymorphically
--------------------------------------------------
Key: JBSEAM-1019
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1019
Project: JBoss Seam
Issue Type: Feature Request
Components: Security
Reporter: Christian Bauer
Assigned To: Shane Bryzak
Class hierarchy: Node(Document,Directory)
I'm asserting an instance of Document into working memory like this:
<s:link id="editDoc" styleClass="linkNavigation"
action="editDoc" accesskey="E"
rendered="#{s:hasPermission('NodeHome', 'edit',
currentDocument)}"><u>E</u>dit</s:link>
This doesn't fire:
rule RestrictNodeHomeEditAccess
no-loop;
activation-group "permissions"
when
c: PermissionCheck(name == "NodeHome", action == "edit");
Node(nodeWriteAccessLevel : writeAccessLevel, nodeCreator : createdBy)
Role(userAccessLevel : name -> (Integer.valueOf(userAccessLevel).intValue() >=
nodeWriteAccessLevel.intValue()) )
or
User(authenticatedUserId : id -> (nodeCreator.getId().equals(authenticatedUserId))
)
then
c.grant();
modify(c);
end;
This does:
rule RestrictNodeHomeEditAccess
no-loop;
activation-group "permissions"
when
c: PermissionCheck(name == "NodeHome", action == "edit");
Document(nodeWriteAccessLevel : writeAccessLevel, nodeCreator : createdBy)
Role(userAccessLevel : name -> (Integer.valueOf(userAccessLevel).intValue() >=
nodeWriteAccessLevel.intValue()) )
or
User(authenticatedUserId : id -> (nodeCreator.getId().equals(authenticatedUserId))
)
then
c.grant();
modify(c);
end;
I couldn't find anything in the Drools docs about polymorphism but it looks like
Facts are not checked polymorphically. Sad language that is.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira