[seam-commits] Seam SVN: r13366 - in modules/security/trunk/impl: src/main/java/org/jboss/seam/security/permission and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jul 13 07:26:49 EDT 2010


Author: shane.bryzak at jboss.com
Date: 2010-07-13 07:26:49 -0400 (Tue, 13 Jul 2010)
New Revision: 13366

Modified:
   modules/security/trunk/impl/pom.xml
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionCheck.java
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionResolver.java
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
Log:
configuration for rule based permissions


Modified: modules/security/trunk/impl/pom.xml
===================================================================
--- modules/security/trunk/impl/pom.xml	2010-07-13 11:24:17 UTC (rev 13365)
+++ modules/security/trunk/impl/pom.xml	2010-07-13 11:26:49 UTC (rev 13366)
@@ -71,10 +71,60 @@
              <groupId>com.sun.xml.bind</groupId>
              <artifactId>jaxb-xjc</artifactId>
            </exclusion>
+           <exclusion>
+              <groupId>org.drools</groupId>
+              <artifactId>drools-decisiontables</artifactId>
+           </exclusion>
+           <exclusion>
+              <groupId>org.drools</groupId>
+              <artifactId>drools-workitems</artifactId>
+           </exclusion>
+           <exclusion>
+              <groupId>org.drools</groupId>
+              <artifactId>drools-transformer-xstream</artifactId>
+           </exclusion>
+           <exclusion>
+              <groupId>javax.el</groupId>
+              <artifactId>el-api</artifactId>
+           </exclusion>
          </exclusions>
       </dependency>
 
       <dependency>
+         <groupId>org.jboss.seam.drools</groupId>
+         <artifactId>seam-drools-impl</artifactId>
+         <version>3.0.0-SNAPSHOT</version>
+
+         <exclusions>
+            <exclusion>
+               <groupId>com.sun.xml.bind</groupId>
+               <artifactId>jaxb-impl</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>com.sun.xml.bind</groupId>
+               <artifactId>jaxb-xjc</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.drools</groupId>
+               <artifactId>drools-decisiontables</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.drools</groupId>
+               <artifactId>drools-workitems</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>javax.el</groupId>
+               <artifactId>el-api</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.jboss.spec.javax.interceptor</groupId>
+               <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+            </exclusion>
+         </exclusions>
+
+      </dependency>
+
+      <dependency>
          <groupId>org.jboss.seam.security</groupId>
          <artifactId>seam-security-api</artifactId>
          <version>${project.version}</version>

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionCheck.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionCheck.java	2010-07-13 11:24:17 UTC (rev 13365)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionCheck.java	2010-07-13 11:26:49 UTC (rev 13366)
@@ -12,27 +12,27 @@
  */
 public class PermissionCheck
 {
-   private Object target;
+   private Object resource;
 
-   private String action;
+   private String permission;
    private boolean granted;
    private Set<String> requirements;
    
-   public PermissionCheck(Object target, String action)
+   public PermissionCheck(Object resource, String permission)
    {      
-      this.target = target;
-      this.action = action;
+      this.resource = resource;
+      this.permission = permission;
       granted = false;
    }
    
-   public Object getTarget()
+   public Object getResource()
    {
-      return target;
+      return resource;
    }   
 
-   public String getAction() 
+   public String getPermission() 
    {
-      return action;
+      return permission;
    }
    
    public void require(String requirement)

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionResolver.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionResolver.java	2010-07-13 11:24:17 UTC (rev 13365)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/PermissionResolver.java	2010-07-13 11:26:49 UTC (rev 13366)
@@ -9,6 +9,6 @@
  */
 public interface PermissionResolver
 {
-   boolean hasPermission(Object target, String action);
-   void filterSetByAction(Set<Object> targets, String action);
+   boolean hasPermission(Object resource, String permission);
+   void filterSetByAction(Set<Object> resources, String permission);
 }

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java	2010-07-13 11:24:17 UTC (rev 13365)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java	2010-07-13 11:26:49 UTC (rev 13366)
@@ -48,12 +48,6 @@
    @Inject Identity identity;
    
    @Inject
-   public boolean create()
-   {
-      initSecurityContext();
-      return getSecurityContext() != null;
-   }
-   
    protected void initSecurityContext()
    {
       if (getSecurityRules() != null)
@@ -70,7 +64,7 @@
     * @param action String The action to be performed on the target
     * @return boolean True if the user has the specified permission
     */
-   public boolean hasPermission(Object target, String action)
+   public boolean hasPermission(Object resource, String permission)
    {
       StatefulKnowledgeSession securityContext = getSecurityContext();
       
@@ -82,18 +76,18 @@
       
       synchronized( securityContext )
       {
-         if (!(target instanceof String) && !(target instanceof Class))
+         if (!(resource instanceof String) && !(resource instanceof Class<?>))
          {
-            handles.add( securityContext.insert(target) );
+            handles.add( securityContext.insert(resource) );
          }
-         else if (target instanceof Class)
+         else if (resource instanceof Class<?>)
          {
             // TODO fix
             String componentName = null; // manager. Seam.getComponentName((Class) target);
-            target = componentName != null ? componentName : ((Class) target).getName();
+            resource = componentName != null ? componentName : ((Class) resource).getName();
          }
          
-         check = new PermissionCheck(target, action);
+         check = new PermissionCheck(resource, permission);
          
          try
          {
@@ -267,7 +261,6 @@
       this.securityContext = securityContext;
    }
    
-
    public KnowledgeBase getSecurityRules()
    {
       return securityRules;



More information about the seam-commits mailing list