Author: shane.bryzak(a)jboss.com
Date: 2008-05-07 11:07:06 -0400 (Wed, 07 May 2008)
New Revision: 8131
Modified:
trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java
trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java
Log:
support for bulk add/revoke permissions
Modified: trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java 2008-05-07
14:56:13 UTC (rev 8130)
+++ trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java 2008-05-07
15:07:06 UTC (rev 8131)
@@ -25,7 +25,6 @@
import org.jboss.seam.annotations.security.permission.PermissionRole;
import org.jboss.seam.annotations.security.permission.PermissionTarget;
import org.jboss.seam.annotations.security.permission.PermissionUser;
-import org.jboss.seam.annotations.security.permission.Permissions;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.log.LogProvider;
@@ -276,6 +275,13 @@
}
}
+ public boolean grantPermissions(List<Permission> permissions)
+ {
+ // TODO implement
+
+ return false;
+ }
+
private String getDiscriminatorValue(boolean isRole)
{
PermissionDiscriminator discriminator = discriminatorProperty.getAnnotation();
@@ -298,8 +304,14 @@
{
return false;
}
- }
+ }
+ public boolean revokePermissions(List<Permission> permissions)
+ {
+ // TODO implement
+ return false;
+ }
+
/**
* If the user or role properties in the entity class refer to other entities, then
this method
* uses the JpaIdentityStore (if available) to lookup that user or role entity.
Otherwise it
Modified: trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java 2008-05-07
14:56:13 UTC (rev 8130)
+++ trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java 2008-05-07
15:07:06 UTC (rev 8131)
@@ -103,12 +103,30 @@
return permissionStore.grantPermission(permission);
}
+ public boolean grantPermissions(List<Permission> permissions)
+ {
+ for (Permission permission : permissions)
+ {
+ Identity.instance().checkPermission(permission.getTarget(), PERMISSION_GRANT);
+ }
+ return permissionStore.grantPermissions(permissions);
+ }
+
public boolean revokePermission(Permission permission)
{
Identity.instance().checkPermission(permission.getTarget(), PERMISSION_REVOKE);
return permissionStore.revokePermission(permission);
}
+ public boolean revokePermissions(List<Permission> permissions)
+ {
+ for (Permission permission : permissions)
+ {
+ Identity.instance().checkPermission(permission.getTarget(), PERMISSION_REVOKE);
+ }
+ return permissionStore.revokePermissions(permissions);
+ }
+
public List<String> listAvailableActions(Object target)
{
return permissionStore.listAvailableActions(target);
Modified: trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java 2008-05-07
14:56:13 UTC (rev 8130)
+++ trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java 2008-05-07
15:07:06 UTC (rev 8131)
@@ -12,6 +12,8 @@
List<Permission> listPermissions(Object target);
List<Permission> listPermissions(Object target, String action);
boolean grantPermission(Permission permission);
+ boolean grantPermissions(List<Permission> permissions);
boolean revokePermission(Permission permission);
+ boolean revokePermissions(List<Permission> permissions);
List<String> listAvailableActions(Object target);
}
Show replies by date