I am trying to add permissions to my eclipse seam project using
jboss rules. When I created the project a security.drl file was added to it. I am trying to grant permissions to certain logged in user groups. In a typical scenario, a user would log into the system and a User object would be added to the session when the authenticate method is called. From this point, I need a way to deny login access to a certain user group, say bankers. I also need to allow Administrators to add users to the system. I am having trouble finding documentation to explain how the syntax should work for this scenario. How would the security.drl file know about the user object in the session or am I viewing this wrong? Second, is PermissionCheck and Role something that my object provides or is it something internal to Drools? Also, can someone point me in the direction of documentation and example code?
I was thinking it would look like this:
rule "DenyAccessToBankers"
when
c: PermissionCheck(name == "Login")
Role(name == "Bankers")
then
c.revoke();
end
rule "AllowUserAccessToAdministrators"
when
c: PermissionCheck(name == "User", action in ("edituser","deleteuser","adduser"))
Role(name == "Administrator")
then
c.grant();
end