Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-10 05:14:13 +0000
committerEike Stepper2012-06-10 05:14:13 +0000
commit7c04f6905700d5ee65f01b70ee07f0ac291d9451 (patch)
tree815f272a5c2471da505ca2b9af8d6cb8562cc647 /plugins
parent3aa06bd3de3bec99de8f70444a6324a7ce705565 (diff)
downloadcdo-7c04f6905700d5ee65f01b70ee07f0ac291d9451.tar.gz
cdo-7c04f6905700d5ee65f01b70ee07f0ac291d9451.tar.xz
cdo-7c04f6905700d5ee65f01b70ee07f0ac291d9451.zip
[380629] Design a default Security model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=380629
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.security.edit/plugin.properties1
-rw-r--r--plugins/org.eclipse.emf.cdo.security/model/security.ecore2
-rw-r--r--plugins/org.eclipse.emf.cdo.security/model/security.genmodel1
-rw-r--r--plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityPackage.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/User.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityPackageImpl.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/UserImpl.java41
7 files changed, 125 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties
index 0a78ace850..f1703a7476 100644
--- a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties
@@ -85,3 +85,4 @@ _UI_User_unassignedRoles_feature = Unassigned Roles
_UI_Realm_defaultPermission_feature = Default Permission
_UI_User_defaultPermissionOverride_feature = Default Permission Override
_UI_User_defaultPermission_feature = Default Permission
+_UI_User_allChecks_feature = All Checks
diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.ecore b/plugins/org.eclipse.emf.cdo.security/model/security.ecore
index fb055fac82..bbe75c2177 100644
--- a/plugins/org.eclipse.emf.cdo.security/model/security.ecore
+++ b/plugins/org.eclipse.emf.cdo.security/model/security.ecore
@@ -58,6 +58,8 @@
eType="#//Group" changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="allRoles" upperBound="-1"
eType="#//Role" changeable="false" volatile="true" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="allChecks" upperBound="-1"
+ eType="#//Check" changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="unassignedRoles" upperBound="-1"
eType="#//Role" changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.genmodel b/plugins/org.eclipse.emf.cdo.security/model/security.genmodel
index a13f5b7041..2e01449c8c 100644
--- a/plugins/org.eclipse.emf.cdo.security/model/security.genmodel
+++ b/plugins/org.eclipse.emf.cdo.security/model/security.genmodel
@@ -54,6 +54,7 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference security.ecore#//User/groups"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference security.ecore#//User/allGroups"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference security.ecore#//User/allRoles"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference security.ecore#//User/allChecks"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference security.ecore#//User/unassignedRoles"/>
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute security.ecore#//User/label"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute security.ecore#//User/firstName"/>
diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityPackage.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityPackage.java
index 7fca6bc1b6..9091c471fd 100644
--- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityPackage.java
+++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityPackage.java
@@ -526,13 +526,22 @@ public interface SecurityPackage extends EPackage
int USER__ALL_ROLES = ASSIGNEE_FEATURE_COUNT + 2;
/**
+ * The feature id for the '<em><b>All Checks</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int USER__ALL_CHECKS = ASSIGNEE_FEATURE_COUNT + 3;
+
+ /**
* The feature id for the '<em><b>Unassigned Roles</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int USER__UNASSIGNED_ROLES = ASSIGNEE_FEATURE_COUNT + 3;
+ int USER__UNASSIGNED_ROLES = ASSIGNEE_FEATURE_COUNT + 4;
/**
* The feature id for the '<em><b>Label</b></em>' attribute.
@@ -541,7 +550,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__LABEL = ASSIGNEE_FEATURE_COUNT + 4;
+ int USER__LABEL = ASSIGNEE_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>First Name</b></em>' attribute.
@@ -550,7 +559,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__FIRST_NAME = ASSIGNEE_FEATURE_COUNT + 5;
+ int USER__FIRST_NAME = ASSIGNEE_FEATURE_COUNT + 6;
/**
* The feature id for the '<em><b>Last Name</b></em>' attribute.
@@ -559,7 +568,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__LAST_NAME = ASSIGNEE_FEATURE_COUNT + 6;
+ int USER__LAST_NAME = ASSIGNEE_FEATURE_COUNT + 7;
/**
* The feature id for the '<em><b>Email</b></em>' attribute.
@@ -568,7 +577,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__EMAIL = ASSIGNEE_FEATURE_COUNT + 7;
+ int USER__EMAIL = ASSIGNEE_FEATURE_COUNT + 8;
/**
* The feature id for the '<em><b>Default Permission Override</b></em>' attribute.
@@ -577,7 +586,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__DEFAULT_PERMISSION_OVERRIDE = ASSIGNEE_FEATURE_COUNT + 8;
+ int USER__DEFAULT_PERMISSION_OVERRIDE = ASSIGNEE_FEATURE_COUNT + 9;
/**
* The feature id for the '<em><b>Default Permission</b></em>' attribute.
@@ -586,7 +595,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__DEFAULT_PERMISSION = ASSIGNEE_FEATURE_COUNT + 9;
+ int USER__DEFAULT_PERMISSION = ASSIGNEE_FEATURE_COUNT + 10;
/**
* The feature id for the '<em><b>Locked</b></em>' attribute.
@@ -595,7 +604,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__LOCKED = ASSIGNEE_FEATURE_COUNT + 10;
+ int USER__LOCKED = ASSIGNEE_FEATURE_COUNT + 11;
/**
* The feature id for the '<em><b>Password</b></em>' containment reference.
@@ -604,7 +613,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER__PASSWORD = ASSIGNEE_FEATURE_COUNT + 11;
+ int USER__PASSWORD = ASSIGNEE_FEATURE_COUNT + 12;
/**
* The number of structural features of the '<em>User</em>' class.
@@ -613,7 +622,7 @@ public interface SecurityPackage extends EPackage
* @generated
* @ordered
*/
- int USER_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 12;
+ int USER_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 13;
/**
* The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.UserPasswordImpl <em>User Password</em>}' class.
@@ -1162,6 +1171,17 @@ public interface SecurityPackage extends EPackage
EReference getUser_AllRoles();
/**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.User#getAllChecks <em>All Checks</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>All Checks</em>'.
+ * @see org.eclipse.emf.cdo.security.User#getAllChecks()
+ * @see #getUser()
+ * @generated
+ */
+ EReference getUser_AllChecks();
+
+ /**
* Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.User#getUnassignedRoles <em>Unassigned Roles</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1674,6 +1694,14 @@ public interface SecurityPackage extends EPackage
EReference USER__ALL_ROLES = eINSTANCE.getUser_AllRoles();
/**
+ * The meta object literal for the '<em><b>All Checks</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference USER__ALL_CHECKS = eINSTANCE.getUser_AllChecks();
+
+ /**
* The meta object literal for the '<em><b>Unassigned Roles</b></em>' reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/User.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/User.java
index 9ca84e7d18..c7e1bf94a1 100644
--- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/User.java
+++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/User.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.common.util.EList;
* <li>{@link org.eclipse.emf.cdo.security.User#getGroups <em>Groups</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.User#getAllGroups <em>All Groups</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.User#getAllRoles <em>All Roles</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.security.User#getAllChecks <em>All Checks</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.User#getUnassignedRoles <em>Unassigned Roles</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.User#getLabel <em>Label</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.User#getFirstName <em>First Name</em>}</li>
@@ -92,6 +93,22 @@ public interface User extends Assignee
EList<Role> getAllRoles();
/**
+ * Returns the value of the '<em><b>All Checks</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.cdo.security.Check}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>All Checks</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>All Checks</em>' reference list.
+ * @see org.eclipse.emf.cdo.security.SecurityPackage#getUser_AllChecks()
+ * @model transient="true" changeable="false" volatile="true" derived="true"
+ * @generated
+ */
+ EList<Check> getAllChecks();
+
+ /**
* Returns the value of the '<em><b>Unassigned Roles</b></em>' reference list.
* The list contents are of type {@link org.eclipse.emf.cdo.security.Role}.
* <!-- begin-user-doc -->
diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityPackageImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityPackageImpl.java
index a421c687fa..7e4edb4037 100644
--- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityPackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityPackageImpl.java
@@ -524,7 +524,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
* <!-- end-user-doc -->
* @generated
*/
- public EReference getUser_UnassignedRoles()
+ public EReference getUser_AllChecks()
{
return (EReference)userEClass.getEStructuralFeatures().get(3);
}
@@ -534,9 +534,19 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
* <!-- end-user-doc -->
* @generated
*/
+ public EReference getUser_UnassignedRoles()
+ {
+ return (EReference)userEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EAttribute getUser_Label()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(4);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(5);
}
/**
@@ -546,7 +556,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_FirstName()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(5);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(6);
}
/**
@@ -556,7 +566,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_LastName()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(6);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(7);
}
/**
@@ -566,7 +576,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_Email()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(7);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(8);
}
/**
@@ -576,7 +586,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_DefaultPermissionOverride()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(8);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(9);
}
/**
@@ -586,7 +596,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_DefaultPermission()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(9);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(10);
}
/**
@@ -596,7 +606,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EAttribute getUser_Locked()
{
- return (EAttribute)userEClass.getEStructuralFeatures().get(10);
+ return (EAttribute)userEClass.getEStructuralFeatures().get(11);
}
/**
@@ -606,7 +616,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
*/
public EReference getUser_Password()
{
- return (EReference)userEClass.getEStructuralFeatures().get(11);
+ return (EReference)userEClass.getEStructuralFeatures().get(12);
}
/**
@@ -798,6 +808,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
createEReference(userEClass, USER__GROUPS);
createEReference(userEClass, USER__ALL_GROUPS);
createEReference(userEClass, USER__ALL_ROLES);
+ createEReference(userEClass, USER__ALL_CHECKS);
createEReference(userEClass, USER__UNASSIGNED_ROLES);
createEAttribute(userEClass, USER__LABEL);
createEAttribute(userEClass, USER__FIRST_NAME);
@@ -1005,6 +1016,11 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage
null,
"allRoles", null, 0, -1, User.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
+ getUser_AllChecks(),
+ this.getCheck(),
+ null,
+ "allChecks", null, 0, -1, User.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(
getUser_UnassignedRoles(),
this.getRole(),
null,
diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/UserImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/UserImpl.java
index 04b13c3677..b94c8f2171 100644
--- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/UserImpl.java
+++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/UserImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.security.impl;
+import org.eclipse.emf.cdo.security.Check;
import org.eclipse.emf.cdo.security.Group;
import org.eclipse.emf.cdo.security.Permission;
import org.eclipse.emf.cdo.security.Realm;
@@ -18,6 +19,7 @@ import org.eclipse.emf.cdo.security.SecurityPackage;
import org.eclipse.emf.cdo.security.User;
import org.eclipse.emf.cdo.security.UserPassword;
+import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -36,6 +38,7 @@ import java.util.Set;
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getGroups <em>Groups</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getAllGroups <em>All Groups</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getAllRoles <em>All Roles</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getAllChecks <em>All Checks</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getUnassignedRoles <em>Unassigned Roles</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getLabel <em>Label</em>}</li>
* <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getFirstName <em>First Name</em>}</li>
@@ -110,6 +113,34 @@ public class UserImpl extends AssigneeImpl implements User
}
};
+ private EList<Check> allChecks = new CachedList<Check>()
+ {
+ @Override
+ protected InternalEObject getOwner()
+ {
+ return UserImpl.this;
+ }
+
+ @Override
+ protected EStructuralFeature getFeature()
+ {
+ return SecurityPackage.Literals.USER__ALL_CHECKS;
+ }
+
+ @Override
+ protected Object[] getData()
+ {
+ BasicEList<Check> result = new BasicEList<Check>();
+
+ for (Role role : getAllRoles())
+ {
+ result.addAll(role.getChecks());
+ }
+
+ return result.data();
+ }
+ };
+
private EList<Role> unassignedRoles = new CachedList<Role>()
{
@Override
@@ -197,6 +228,16 @@ public class UserImpl extends AssigneeImpl implements User
* <!-- end-user-doc -->
* @generated NOT
*/
+ public EList<Check> getAllChecks()
+ {
+ return allChecks;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public EList<Role> getUnassignedRoles()
{
return unassignedRoles;

Back to the top