[seam-commits] Seam SVN: r13396 - in modules/security/trunk/examples/idmconsole/src/main: resources and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jul 14 21:30:40 EDT 2010


Author: shane.bryzak at jboss.com
Date: 2010-07-14 21:30:40 -0400 (Wed, 14 Jul 2010)
New Revision: 13396

Modified:
   modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java
   modules/security/trunk/examples/idmconsole/src/main/resources/import.sql
   modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/classes/seam-beans.xml
   modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/security-rules.drl
Log:
add some relationships


Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java	2010-07-14 22:39:48 UTC (rev 13395)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java	2010-07-15 01:30:40 UTC (rev 13396)
@@ -5,6 +5,7 @@
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 
 import org.jboss.seam.security.annotations.management.IdentityProperty;
@@ -22,7 +23,7 @@
    
    private Long id;
    private String name;
-   private IdentityObjectRelationshipType type;
+   private IdentityObjectRelationshipType relationshipType;
    private IdentityObject from;
    private IdentityObject to;
    
@@ -47,18 +48,18 @@
       this.name = name;
    }
    
-   @ManyToOne @IdentityProperty(PropertyType.TYPE)
-   public IdentityObjectRelationshipType getType()
+   @ManyToOne @IdentityProperty(PropertyType.TYPE) @JoinColumn(name = "RELATIONSHIP_TYPE_ID")
+   public IdentityObjectRelationshipType getRelationshipType()
    {
-      return type;
+      return relationshipType;
    }
    
-   public void setType(IdentityObjectRelationshipType type)
+   public void setRelationshipType(IdentityObjectRelationshipType relationshipType)
    {
-      this.type = type;
+      this.relationshipType = relationshipType;
    }
 
-   @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_FROM)
+   @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_FROM) @JoinColumn(name = "FROM_IDENTITY_ID")
    public IdentityObject getFrom()
    {
       return from;
@@ -69,7 +70,7 @@
       this.from = from;
    }
 
-   @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_TO)
+   @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_TO) @JoinColumn(name = "TO_IDENTITY_ID")
    public IdentityObject getTo()
    {
       return to;

Modified: modules/security/trunk/examples/idmconsole/src/main/resources/import.sql
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/resources/import.sql	2010-07-14 22:39:48 UTC (rev 13395)
+++ modules/security/trunk/examples/idmconsole/src/main/resources/import.sql	2010-07-15 01:30:40 UTC (rev 13396)
@@ -3,9 +3,14 @@
 
 insert into IdentityObject (id, name, identity_object_type_id) values (1, 'shane', 1);
 insert into IdentityObject (id, name, identity_object_type_id) values (2, 'demo', 1);
+insert into IdentityObject (id, name, identity_object_type_id) values (3, 'Head Office', 2);
 
 insert into IdentityObjectCredentialType (id, name) values (1, 'PASSWORD');
 
 insert into IdentityObjectCredential (id, identity_object_id, credential_type_id, value) values (1, 1, 1, 'password');
 insert into IdentityObjectCredential (id, identity_object_id, credential_type_id, value) values (2, 2, 1, 'demo');
 
+insert into IdentityObjectRelationshipType (id, name) values (1, 'MEMBER_OF');
+insert into IdentityObjectRelationshipType (id, name) values (2, 'ROLE');
+
+insert into IdentityObjectRelationship (id, name, relationship_type_id, identity_from_id, identity_to_id) values (1, 'admin', 2, 1, 3);

Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/classes/seam-beans.xml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/classes/seam-beans.xml	2010-07-14 22:39:48 UTC (rev 13395)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/classes/seam-beans.xml	2010-07-15 01:30:40 UTC (rev 13396)
@@ -14,7 +14,7 @@
    </security:JpaPermissionStore>
    
    <drools:RuleResources>
-     <s:modifies/>
+     <s:overrides/>
      <security:SecurityRulesConfig/>
      <drools:resources>
        <s:value>classpath;security-rules.drl;DRL</s:value>
@@ -31,20 +31,7 @@
    </drools:DroolsConfig>
    
    <security:RuleBasedPermissionResolver>
-      <s:overrides/>
-      
-      <security:manager>
-        <s:Inject/>
-      </security:manager>
-      
-      <security:identity>
-        <s:Inject/>
-      </security:identity>
-      
-      <security:init>
-        <s:Inject/>
-      </security:init>
-      
+      <s:modifies/>     
       <security:securityRules>
         <security:SecurityRulesConfig/>
         <s:Inject/>

Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/security-rules.drl
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/security-rules.drl	2010-07-14 22:39:48 UTC (rev 13395)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/WEB-INF/security-rules.drl	2010-07-15 01:30:40 UTC (rev 13396)
@@ -34,7 +34,7 @@
   
 ******************************************************************************************/
 
-rule ManageUsers
+rule ManageIdentities
   no-loop
   activation-group "permissions"
 when
@@ -43,12 +43,3 @@
   check.grant();
 end
 
-rule ManageRoles
-  no-loop
-  activation-group "permissions"
-when
-  check: PermissionCheck(resource == "seam.role", granted == false)
-//  Role(name == "admin")
-then
-  check.grant();
-end



More information about the seam-commits mailing list