Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-09-20 02:43:12 +0000
committerEike Stepper2013-09-20 02:43:12 +0000
commit3b3d9425082bb788bc9eb1600d9d0de3f6e9632b (patch)
tree5553459ab8a6d780ad23eee7456aaad8e3827b2f
parentaf9ce07ac1e7e452c0cb7b2d11a20b30caae5367 (diff)
downloadcdo-3b3d9425082bb788bc9eb1600d9d0de3f6e9632b.tar.gz
cdo-3b3d9425082bb788bc9eb1600d9d0de3f6e9632b.tar.xz
cdo-3b3d9425082bb788bc9eb1600d9d0de3f6e9632b.zip
[417474] [Security] Factor out PermissionFilters to separate access
level from filter application https://bugs.eclipse.org/bugs/show_bug.cgi?id=417474
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
index afe57e8282..853b1cc4c1 100644
--- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
@@ -14,7 +14,8 @@ import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.security.Access;
-import org.eclipse.emf.cdo.security.Permission;
+import org.eclipse.emf.cdo.security.FilterPermission;
+import org.eclipse.emf.cdo.security.PermissionFilter;
import org.eclipse.emf.cdo.security.Realm;
import org.eclipse.emf.cdo.security.RealmUtil;
import org.eclipse.emf.cdo.security.Role;
@@ -107,20 +108,20 @@ public class AnnotationHandler implements InternalSecurityManager.CommitHandler
protected void handlePackagePermission(Realm realm, EPackage ePackage, String key, Access access)
{
- EClass permissionClass = SecurityPackage.Literals.PACKAGE_PERMISSION;
- EReference permissionFeature = SecurityPackage.Literals.PACKAGE_PERMISSION__APPLICABLE_PACKAGE;
- handlePermission(realm, ePackage, key, access, permissionClass, permissionFeature);
+ EClass filterClass = SecurityPackage.Literals.PACKAGE_FILTER;
+ EReference filterFeature = SecurityPackage.Literals.PACKAGE_FILTER__APPLICABLE_PACKAGE;
+ handlePermission(realm, ePackage, key, access, filterClass, filterFeature);
}
protected void handleClassPermission(Realm realm, EClass eClass, String key, Access access)
{
- EClass permissionClass = SecurityPackage.Literals.CLASS_PERMISSION;
- EReference permissionFeature = SecurityPackage.Literals.CLASS_PERMISSION__APPLICABLE_CLASS;
- handlePermission(realm, eClass, key, access, permissionClass, permissionFeature);
+ EClass filterClass = SecurityPackage.Literals.CLASS_FILTER;
+ EReference filterFeature = SecurityPackage.Literals.CLASS_FILTER__APPLICABLE_CLASS;
+ handlePermission(realm, eClass, key, access, filterClass, filterFeature);
}
protected void handlePermission(Realm realm, EModelElement modelElement, String key, Access access,
- EClass permissionClass, EReference permissionFeature)
+ EClass filterClass, EReference filterFeature)
{
String annotation = EcoreUtil.getAnnotation(modelElement, SOURCE_URI, key);
if (annotation == null || annotation.length() == 0)
@@ -136,9 +137,10 @@ public class AnnotationHandler implements InternalSecurityManager.CommitHandler
String token = tokenizer.nextToken();
if (token != null && token.length() != 0)
{
- Permission permission = (Permission)EcoreUtil.create(permissionClass);
- permission.setAccess(access);
- permission.eSet(permissionFeature, modelElement);
+ PermissionFilter filter = (PermissionFilter)EcoreUtil.create(filterClass);
+ filter.eSet(filterFeature, modelElement);
+
+ FilterPermission permission = SecurityFactory.eINSTANCE.createFilterPermission(access, filter);
Role role = RealmUtil.findRole(items, token);
if (role == null)

Back to the top