diff options
author | Eike Stepper | 2012-05-28 08:32:03 +0000 |
---|---|---|
committer | Eike Stepper | 2012-05-28 08:32:03 +0000 |
commit | ddc6120a7f9db25f5991e5f0bf2db600482b4cad (patch) | |
tree | c9858b1d1dd7f887d2caaa90cd0e91d5b3b555c4 /plugins | |
parent | 1ef49aa5c994733ec662249f9a417020d6f28b01 (diff) | |
download | cdo-ddc6120a7f9db25f5991e5f0bf2db600482b4cad.tar.gz cdo-ddc6120a7f9db25f5991e5f0bf2db600482b4cad.tar.xz cdo-ddc6120a7f9db25f5991e5f0bf2db600482b4cad.zip |
[380629] Design a default Security model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=380629
Diffstat (limited to 'plugins')
19 files changed, 1175 insertions, 149 deletions
diff --git a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties index beaad9d7aa..ffc4ef785c 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties @@ -59,3 +59,9 @@ _UI_Group_inheritingGroups_feature = Inheriting Groups _UI_Directory_type = Directory _UI_Directory_items_feature = Items _UI_Directory_name_feature = Name +_UI_Group_allInheritedGroups_feature = All Inherited Groups +_UI_Group_allRoles_feature = All Roles +_UI_User_allGroups_feature = All Groups +_UI_User_allRoles_feature = All Roles +_UI_User_label_feature = Label +_UI_Group_allInheritingGroups_feature = All Inheriting Groups diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/GroupItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/GroupItemProvider.java index aee28b3b49..236bb331a7 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/GroupItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/GroupItemProvider.java @@ -66,7 +66,10 @@ public class GroupItemProvider extends AssigneeItemProvider implements IEditingD super.getPropertyDescriptors(object); addInheritedGroupsPropertyDescriptor(object); + addAllInheritedGroupsPropertyDescriptor(object); addInheritingGroupsPropertyDescriptor(object); + addAllInheritingGroupsPropertyDescriptor(object); + addAllRolesPropertyDescriptor(object); addUsersPropertyDescriptor(object); } return itemPropertyDescriptors; @@ -118,6 +121,51 @@ public class GroupItemProvider extends AssigneeItemProvider implements IEditingD } /** + * This adds a property descriptor for the All Inheriting Groups feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAllInheritingGroupsPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Group_allInheritingGroups_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Group_allInheritingGroups_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.GROUP__ALL_INHERITING_GROUPS, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Inherited Groups feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAllInheritedGroupsPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Group_allInheritedGroups_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Group_allInheritedGroups_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.GROUP__ALL_INHERITED_GROUPS, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Roles feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAllRolesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Group_allRoles_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Group_allRoles_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.GROUP__ALL_ROLES, false, false, false, null, null, null)); + } + + /** * This returns Group.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/SecurityItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/SecurityItemProviderAdapterFactory.java index 36f9559850..26b612adbb 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/SecurityItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/SecurityItemProviderAdapterFactory.java @@ -312,7 +312,7 @@ public class SecurityItemProviderAdapterFactory extends SecurityAdapterFactory i if (isFactoryForType(type)) { Object adapter = super.adapt(object, type); - if (!(type instanceof Class<?>) || ((Class<?>)type).isInstance(adapter)) + if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { return adapter; } @@ -390,7 +390,7 @@ public class SecurityItemProviderAdapterFactory extends SecurityAdapterFactory i } /** - * This disposes all of the item providers created by this factory. + * This disposes all of the item providers created by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -398,29 +398,17 @@ public class SecurityItemProviderAdapterFactory extends SecurityAdapterFactory i public void dispose() { if (realmItemProvider != null) - { realmItemProvider.dispose(); - } if (directoryItemProvider != null) - { directoryItemProvider.dispose(); - } if (roleItemProvider != null) - { roleItemProvider.dispose(); - } if (groupItemProvider != null) - { groupItemProvider.dispose(); - } if (userItemProvider != null) - { userItemProvider.dispose(); - } if (userPasswordItemProvider != null) - { userPasswordItemProvider.dispose(); - } } } diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/UserItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/UserItemProvider.java index 9dd8e137b9..68b2b2c70a 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/UserItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/UserItemProvider.java @@ -70,6 +70,9 @@ public class UserItemProvider extends AssigneeItemProvider implements IEditingDo super.getPropertyDescriptors(object); addGroupsPropertyDescriptor(object); + addAllGroupsPropertyDescriptor(object); + addAllRolesPropertyDescriptor(object); + addLabelPropertyDescriptor(object); addFirstNamePropertyDescriptor(object); addLastNamePropertyDescriptor(object); addEmailPropertyDescriptor(object); @@ -94,6 +97,53 @@ public class UserItemProvider extends AssigneeItemProvider implements IEditingDo } /** + * This adds a property descriptor for the All Groups feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAllGroupsPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_User_allGroups_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_User_allGroups_feature", "_UI_User_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.USER__ALL_GROUPS, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Roles feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addAllRolesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_User_allRoles_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_User_allRoles_feature", "_UI_User_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.USER__ALL_ROLES, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the Label feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addLabelPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_User_label_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_User_label_feature", "_UI_User_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.USER__LABEL, false, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, + null)); + } + + /** * This adds a property descriptor for the First Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -245,6 +295,7 @@ public class UserItemProvider extends AssigneeItemProvider implements IEditingDo switch (notification.getFeatureID(User.class)) { + case SecurityPackage.USER__LABEL: case SecurityPackage.USER__FIRST_NAME: case SecurityPackage.USER__LAST_NAME: case SecurityPackage.USER__EMAIL: diff --git a/plugins/org.eclipse.emf.cdo.security.editor/src/org/eclipse/emf/cdo/security/presentation/SecurityEditor.java b/plugins/org.eclipse.emf.cdo.security.editor/src/org/eclipse/emf/cdo/security/presentation/SecurityEditor.java index efba1b23f7..ddab24cf48 100644 --- a/plugins/org.eclipse.emf.cdo.security.editor/src/org/eclipse/emf/cdo/security/presentation/SecurityEditor.java +++ b/plugins/org.eclipse.emf.cdo.security.editor/src/org/eclipse/emf/cdo/security/presentation/SecurityEditor.java @@ -1361,7 +1361,7 @@ public class SecurityEditor extends MultiPageEditorPart implements IEditingDomai /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1426,7 +1426,7 @@ public class SecurityEditor extends MultiPageEditorPart implements IEditingDomai */ protected void doSaveAs(URI uri, IEditorInput editorInput) { - editingDomain.getResourceSet().getResources().get(0).setURI(uri); + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); setInputWithNotify(editorInput); setPartName(editorInput.getName()); IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars() diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.ecore b/plugins/org.eclipse.emf.cdo.security/model/security.ecore index ac6b3d4d68..2fb7329c14 100644 --- a/plugins/org.eclipse.emf.cdo.security/model/security.ecore +++ b/plugins/org.eclipse.emf.cdo.security/model/security.ecore @@ -30,14 +30,26 @@ <eClassifiers xsi:type="ecore:EClass" name="Group" eSuperTypes="#//Assignee"> <eStructuralFeatures xsi:type="ecore:EReference" name="inheritedGroups" upperBound="-1" eType="#//Group" eOpposite="#//Group/inheritingGroups"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="allInheritedGroups" upperBound="-1" + eType="#//Group" changeable="false" volatile="true" transient="true" derived="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="inheritingGroups" upperBound="-1" eType="#//Group" eOpposite="#//Group/inheritedGroups"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="allInheritingGroups" upperBound="-1" + 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="users" upperBound="-1" eType="#//User" eOpposite="#//User/groups"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="User" eSuperTypes="#//Assignee"> <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" eType="#//Group" eOpposite="#//Group/users"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="allGroups" upperBound="-1" + 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:EAttribute" name="label" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString" + changeable="false" volatile="true" transient="true" derived="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="email" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag b/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag index 9fdfc768a2..48394ff517 100644 --- a/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag +++ b/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag @@ -18,7 +18,7 @@ </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_RJPw4KYxEeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/> <element xmi:type="ecore:EClass" href="security.ecore#//SecurityElement"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RJPw4aYxEeGAP_kHrioTcA" x="145" y="30" width="198" height="63"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RJPw4aYxEeGAP_kHrioTcA" x="165" y="30" width="152" height="63"/> </children> <children xmi:type="notation:Node" xmi:id="_glO9wKYxEeGAP_kHrioTcA" type="1001"> <children xmi:type="notation:Node" xmi:id="_glSBEKYxEeGAP_kHrioTcA" type="4001"/> @@ -39,6 +39,26 @@ <children xmi:type="notation:Node" xmi:id="_kzdRsKYxEeGAP_kHrioTcA" type="1001"> <children xmi:type="notation:Node" xmi:id="_kzgVAKYxEeGAP_kHrioTcA" type="4001"/> <children xmi:type="notation:Node" xmi:id="_kzg8EKYxEeGAP_kHrioTcA" type="5001"> + <children xmi:type="notation:Node" xmi:id="_SzKPoKiPEeGRhZdyAvKGEg" type="2001"> + <element xmi:type="ecore:EAttribute" href="security.ecore#//User/label"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_SzKPoaiPEeGRhZdyAvKGEg"/> + </children> + <children xmi:type="notation:Node" xmi:id="_AEWAEqiPEeGRhZdyAvKGEg" type="2001"> + <element xmi:type="ecore:EAttribute" href="security.ecore#//User/firstName"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_AEWAE6iPEeGRhZdyAvKGEg"/> + </children> + <children xmi:type="notation:Node" xmi:id="_AEWAFKiPEeGRhZdyAvKGEg" type="2001"> + <element xmi:type="ecore:EAttribute" href="security.ecore#//User/lastName"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_AEWAFaiPEeGRhZdyAvKGEg"/> + </children> + <children xmi:type="notation:Node" xmi:id="_AEWAFqiPEeGRhZdyAvKGEg" type="2001"> + <element xmi:type="ecore:EAttribute" href="security.ecore#//User/email"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_AEWAF6iPEeGRhZdyAvKGEg"/> + </children> + <children xmi:type="notation:Node" xmi:id="_AEWAGKiPEeGRhZdyAvKGEg" type="2001"> + <element xmi:type="ecore:EAttribute" href="security.ecore#//User/locked"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_AEWAGaiPEeGRhZdyAvKGEg"/> + </children> <styles xmi:type="notation:DrawerStyle" xmi:id="_kzg8EaYxEeGAP_kHrioTcA"/> <styles xmi:type="notation:SortingStyle" xmi:id="_kzg8EqYxEeGAP_kHrioTcA"/> <styles xmi:type="notation:FilteringStyle" xmi:id="_kzg8E6YxEeGAP_kHrioTcA"/> @@ -66,7 +86,7 @@ </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_0ZWzEaYyEeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/> <element xmi:type="ecore:EClass" href="security.ecore#//Group"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_0ZWzEqYyEeGAP_kHrioTcA" x="451" y="420"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_0ZWzEqYyEeGAP_kHrioTcA" x="450" y="420"/> </children> <children xmi:type="notation:Node" xmi:id="_vaiTMKYzEeGAP_kHrioTcA" type="1001"> <children xmi:type="notation:Node" xmi:id="_vajhUKYzEeGAP_kHrioTcA" type="4001"/> @@ -154,7 +174,7 @@ </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_L9EJcaY9EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/> <element xmi:type="ecore:EClass" href="security.ecore#//UserPassword"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_L9EJcqY9EeGAP_kHrioTcA" x="203" y="545" width="162"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_L9EJcqY9EeGAP_kHrioTcA" x="203" y="560" width="162"/> </children> <styles xmi:type="notation:DiagramStyle" xmi:id="_Lqg3UKYxEeGAP_kHrioTcA"/> <element xmi:type="ecore:EPackage" href="security.ecore#/"/> @@ -162,26 +182,26 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_ix63waYxEeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_ix63wqYxEeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ix63w6YxEeGAP_kHrioTcA" points="[0, -24, -98, 71]$[0, -49, -98, 46]$[103, -49, 5, 46]$[103, -84, 5, 11]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ix63w6YxEeGAP_kHrioTcA" points="[-1, -24, -97, 71]$[-1, -55, -97, 40]$[100, -55, 4, 40]$[100, -84, 4, 11]"/> <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_olgfoKY0EeGAP_kHrioTcA" id="(0.4696969696969697,0.8356164383561644)"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_ux6-kKY0EeGAP_kHrioTcA" type="3003" source="_kzdRsKYxEeGAP_kHrioTcA" target="_vaiTMKYzEeGAP_kHrioTcA"> <styles xmi:type="notation:ConnectorStyle" xmi:id="_ux6-kaY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_ux6-kqY0EeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ux6-k6Y0EeGAP_kHrioTcA" points="[-1, -50, -73, 88]$[-1, -75, -73, 63]$[86, -75, 14, 63]$[86, -113, 14, 25]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ux6-k6Y0EeGAP_kHrioTcA" points="[-1, -50, -73, 88]$[-1, -81, -73, 57]$[71, -81, -1, 57]$[71, -113, -1, 25]"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_vUUhAKY0EeGAP_kHrioTcA" type="3003" source="_0ZWzEKYyEeGAP_kHrioTcA" target="_vaiTMKYzEeGAP_kHrioTcA"> <styles xmi:type="notation:ConnectorStyle" xmi:id="_vUUhAaY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_vUVIEKY0EeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_vUVIEaY0EeGAP_kHrioTcA" points="[-1, -20, 145, 117]$[-1, -74, 145, 63]$[-132, -74, 14, 63]$[-132, -112, 14, 25]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_vUVIEaY0EeGAP_kHrioTcA" points="[-1, -20, 144, 117]$[-1, -75, 144, 62]$[-146, -75, -1, 62]$[-146, -112, -1, 25]"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_wQRL4KY0EeGAP_kHrioTcA" type="3003" source="_x4_SoKYzEeGAP_kHrioTcA" target="_btGCwKY0EeGAP_kHrioTcA"> <styles xmi:type="notation:ConnectorStyle" xmi:id="_wQRL4aY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_wQRL4qY0EeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_wQRL46Y0EeGAP_kHrioTcA" points="[10, -33, -247, 100]$[10, -71, -247, 62]$[256, -71, -1, 62]$[256, -112, -1, 21]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_wQRL46Y0EeGAP_kHrioTcA" points="[-1, -33, -258, 100]$[-1, -69, -258, 64]$[256, -69, -1, 64]$[256, -112, -1, 21]"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_wrH74KY0EeGAP_kHrioTcA" type="3003" source="_vaiTMKYzEeGAP_kHrioTcA" target="_btGCwKY0EeGAP_kHrioTcA"> <styles xmi:type="notation:ConnectorStyle" xmi:id="_wrH74aY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> @@ -193,13 +213,13 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_5rz5QaY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_5rz5QqY0EeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5rz5Q6Y0EeGAP_kHrioTcA" points="[4, -20, 171, 90]$[4, -55, 171, 55]$[-168, -55, -1, 55]$[-168, -89, -1, 21]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5rz5Q6Y0EeGAP_kHrioTcA" points="[4, -24, 171, 108]$[4, -68, 171, 64]$[-168, -68, -1, 64]$[-168, -111, -1, 21]"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_6OjZ8KY0EeGAP_kHrioTcA" type="3003" source="_btGCwKY0EeGAP_kHrioTcA" target="_RJPJ0KYxEeGAP_kHrioTcA"> <styles xmi:type="notation:ConnectorStyle" xmi:id="_6OjZ8aY0EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_6OjZ8qY0EeGAP_kHrioTcA" fontName="Segoe UI"/> <element xsi:nil="true"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_6OjZ86Y0EeGAP_kHrioTcA" points="[2, -20, 35, 96]$[2, -45, 35, 71]$[-113, -45, -80, 71]$[-113, -80, -80, 36]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_6OjZ86Y0EeGAP_kHrioTcA" points="[-6, -20, 49, 96]$[-6, -51, 49, 65]$[-116, -51, -61, 65]$[-116, -80, -61, 36]"/> <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_6OnrYKY0EeGAP_kHrioTcA" id="(0.9040404040404041,0.4246575342465753)"/> </edges> <edges xmi:type="notation:Edge" xmi:id="__CXuQKY0EeGAP_kHrioTcA" type="3002" source="_glO9wKYxEeGAP_kHrioTcA" target="_btGCwKY0EeGAP_kHrioTcA"> @@ -236,9 +256,9 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_JwmLgaY1EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_JwmLgqY1EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/> <element xmi:type="ecore:EReference" href="security.ecore#//Role/assignees"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_JwmLg6Y1EeGAP_kHrioTcA" points="[53, -1, -204, 0]$[196, -1, -61, 0]"/> - <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_M2vdEKY1EeGAP_kHrioTcA" id="(0.5,0.5)"/> - <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_M2vdEaY1EeGAP_kHrioTcA" id="(0.5,0.5)"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_JwmLg6Y1EeGAP_kHrioTcA" points="[53, 6, -204, 7]$[196, 6, -61, 7]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_crmUYaiPEeGRhZdyAvKGEg" id="(0.5,0.5)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_crmUYqiPEeGRhZdyAvKGEg" id="(0.5,0.5)"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_Ll0nwKY1EeGAP_kHrioTcA" type="3002" source="_vaiTMKYzEeGAP_kHrioTcA" target="_x4_SoKYzEeGAP_kHrioTcA"> <children xmi:type="notation:Node" xmi:id="_Ll114KY1EeGAP_kHrioTcA" type="4011"> @@ -250,7 +270,7 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_Ll0nwaY1EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_Ll0nwqY1EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/> <element xmi:type="ecore:EReference" href="security.ecore#//Assignee/roles"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Ll0nw6Y1EeGAP_kHrioTcA" points="[-61, 0, 196, -1]$[-204, 0, 53, -1]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Ll0nw6Y1EeGAP_kHrioTcA" points="[-61, 7, 196, 6]$[-204, 7, 53, 6]"/> <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__CxjoKZEEeGAP_kHrioTcA" id="(0.5,0.5)"/> <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__CxjoaZEEeGAP_kHrioTcA" id="(0.5,0.5)"/> </edges> @@ -264,9 +284,9 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_Vog_QaY2EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_VohmUKY2EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/> <element xmi:type="ecore:EReference" href="security.ecore#//User/groups"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VohmUaY2EeGAP_kHrioTcA" points="[69, -1, -149, 0]$[168, -1, -50, 0]"/> - <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_iv_HoKY9EeGAP_kHrioTcA" id="(0.5,0.5)"/> - <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_iv_usKY9EeGAP_kHrioTcA" id="(0.5,0.5)"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VohmUaY2EeGAP_kHrioTcA" points="[69, -9, -148, 0]$[167, -9, -50, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dz6AQqiPEeGRhZdyAvKGEg" id="(0.5,0.5)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dz6AQ6iPEeGRhZdyAvKGEg" id="(0.5,0.5)"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_XSueUKY2EeGAP_kHrioTcA" type="3002" source="_0ZWzEKYyEeGAP_kHrioTcA" target="_kzdRsKYxEeGAP_kHrioTcA"> <children xmi:type="notation:Node" xmi:id="_XSvFYKY2EeGAP_kHrioTcA" type="4011"> @@ -278,7 +298,7 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_XSueUaY2EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_XSueUqY2EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/> <element xmi:type="ecore:EReference" href="security.ecore#//Group/users"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_XSueU6Y2EeGAP_kHrioTcA" points="[-50, 0, 168, -1]$[-149, 0, 69, -1]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_XSueU6Y2EeGAP_kHrioTcA" points="[-50, 0, 167, -9]$[-148, 0, 69, -9]"/> <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Ynl_gKY2EeGAP_kHrioTcA" id="(0.5,0.5)"/> <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Ynl_gaY2EeGAP_kHrioTcA" id="(0.5,0.5)"/> </edges> @@ -292,7 +312,7 @@ <styles xmi:type="notation:ConnectorStyle" xmi:id="_b7R5oaY9EeGAP_kHrioTcA" routing="Rectilinear" lineColor="4210752"/> <styles xmi:type="notation:FontStyle" xmi:id="_b7R5oqY9EeGAP_kHrioTcA" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/> <element xmi:type="ecore:EReference" href="security.ecore#//User/password"/> - <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_b7R5o6Y9EeGAP_kHrioTcA" points="[51, 52, -1, -78]$[51, 106, -1, -24]"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_b7R5o6Y9EeGAP_kHrioTcA" points="[51, 52, -1, -73]$[51, 101, -1, -24]"/> <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_b7UV4KY9EeGAP_kHrioTcA" id="(0.12857142857142856,0.4803921568627451)"/> </edges> <edges xmi:type="notation:Edge" xmi:id="_v-aXIKZFEeGAP_kHrioTcA" type="3002" source="_0ZWzEKYyEeGAP_kHrioTcA" target="_0ZWzEKYyEeGAP_kHrioTcA"> diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Group.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Group.java index 32f7e31e93..12f7a9acb9 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Group.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Group.java @@ -21,7 +21,10 @@ import org.eclipse.emf.common.util.EList; * The following features are supported: * <ul> * <li>{@link org.eclipse.emf.cdo.security.Group#getInheritedGroups <em>Inherited Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.Group#getAllInheritedGroups <em>All Inherited Groups</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.Group#getInheritingGroups <em>Inheriting Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.Group#getAllInheritingGroups <em>All Inheriting Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.Group#getAllRoles <em>All Roles</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.Group#getUsers <em>Users</em>}</li> * </ul> * </p> @@ -86,4 +89,52 @@ public interface Group extends Assignee */ EList<Group> getInheritingGroups(); + /** + * Returns the value of the '<em><b>All Inheriting Groups</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Group}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>All Inheriting Groups</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 Inheriting Groups</em>' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getGroup_AllInheritingGroups() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList<Group> getAllInheritingGroups(); + + /** + * Returns the value of the '<em><b>All Inherited Groups</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Group}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>All Inherited Groups</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 Inherited Groups</em>' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getGroup_AllInheritedGroups() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList<Group> getAllInheritedGroups(); + + /** + * Returns the value of the '<em><b>All Roles</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Role}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>All Roles</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 Roles</em>' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getGroup_AllRoles() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList<Role> getAllRoles(); + } // Group 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 b4390870fb..2acaed64c6 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 @@ -362,13 +362,40 @@ public interface SecurityPackage extends EPackage int GROUP__INHERITED_GROUPS = ASSIGNEE_FEATURE_COUNT + 0; /** + * The feature id for the '<em><b>All Inherited Groups</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GROUP__ALL_INHERITED_GROUPS = ASSIGNEE_FEATURE_COUNT + 1; + + /** * The feature id for the '<em><b>Inheriting Groups</b></em>' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int GROUP__INHERITING_GROUPS = ASSIGNEE_FEATURE_COUNT + 1; + int GROUP__INHERITING_GROUPS = ASSIGNEE_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>All Inheriting Groups</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GROUP__ALL_INHERITING_GROUPS = ASSIGNEE_FEATURE_COUNT + 3; + + /** + * The feature id for the '<em><b>All Roles</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GROUP__ALL_ROLES = ASSIGNEE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Users</b></em>' reference list. @@ -377,7 +404,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int GROUP__USERS = ASSIGNEE_FEATURE_COUNT + 2; + int GROUP__USERS = ASSIGNEE_FEATURE_COUNT + 5; /** * The number of structural features of the '<em>Group</em>' class. @@ -386,7 +413,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int GROUP_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 3; + int GROUP_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 6; /** * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.UserImpl <em>User</em>}' class. @@ -435,13 +462,40 @@ public interface SecurityPackage extends EPackage int USER__GROUPS = ASSIGNEE_FEATURE_COUNT + 0; /** + * The feature id for the '<em><b>All Groups</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int USER__ALL_GROUPS = ASSIGNEE_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>All Roles</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int USER__ALL_ROLES = ASSIGNEE_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>Label</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int USER__LABEL = ASSIGNEE_FEATURE_COUNT + 3; + + /** * The feature id for the '<em><b>First Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int USER__FIRST_NAME = ASSIGNEE_FEATURE_COUNT + 1; + int USER__FIRST_NAME = ASSIGNEE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Last Name</b></em>' attribute. @@ -450,7 +504,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int USER__LAST_NAME = ASSIGNEE_FEATURE_COUNT + 2; + int USER__LAST_NAME = ASSIGNEE_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Email</b></em>' attribute. @@ -459,7 +513,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int USER__EMAIL = ASSIGNEE_FEATURE_COUNT + 3; + int USER__EMAIL = ASSIGNEE_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>Locked</b></em>' attribute. @@ -468,7 +522,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int USER__LOCKED = ASSIGNEE_FEATURE_COUNT + 4; + int USER__LOCKED = ASSIGNEE_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Password</b></em>' containment reference. @@ -477,7 +531,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int USER__PASSWORD = ASSIGNEE_FEATURE_COUNT + 5; + int USER__PASSWORD = ASSIGNEE_FEATURE_COUNT + 8; /** * The number of structural features of the '<em>User</em>' class. @@ -486,7 +540,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int USER_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 6; + int USER_FEATURE_COUNT = ASSIGNEE_FEATURE_COUNT + 9; /** * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.UserPasswordImpl <em>User Password</em>}' class. @@ -719,6 +773,39 @@ public interface SecurityPackage extends EPackage EReference getGroup_InheritingGroups(); /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Group#getAllInheritingGroups <em>All Inheriting Groups</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>All Inheriting Groups</em>'. + * @see org.eclipse.emf.cdo.security.Group#getAllInheritingGroups() + * @see #getGroup() + * @generated + */ + EReference getGroup_AllInheritingGroups(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Group#getAllInheritedGroups <em>All Inherited Groups</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>All Inherited Groups</em>'. + * @see org.eclipse.emf.cdo.security.Group#getAllInheritedGroups() + * @see #getGroup() + * @generated + */ + EReference getGroup_AllInheritedGroups(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Group#getAllRoles <em>All Roles</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>All Roles</em>'. + * @see org.eclipse.emf.cdo.security.Group#getAllRoles() + * @see #getGroup() + * @generated + */ + EReference getGroup_AllRoles(); + + /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.User <em>User</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -740,6 +827,39 @@ public interface SecurityPackage extends EPackage EReference getUser_Groups(); /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.User#getAllGroups <em>All Groups</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>All Groups</em>'. + * @see org.eclipse.emf.cdo.security.User#getAllGroups() + * @see #getUser() + * @generated + */ + EReference getUser_AllGroups(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.User#getAllRoles <em>All Roles</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>All Roles</em>'. + * @see org.eclipse.emf.cdo.security.User#getAllRoles() + * @see #getUser() + * @generated + */ + EReference getUser_AllRoles(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.User#getLabel <em>Label</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Label</em>'. + * @see org.eclipse.emf.cdo.security.User#getLabel() + * @see #getUser() + * @generated + */ + EAttribute getUser_Label(); + + /** * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.User#getFirstName <em>First Name</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1005,6 +1125,30 @@ public interface SecurityPackage extends EPackage EReference GROUP__INHERITING_GROUPS = eINSTANCE.getGroup_InheritingGroups(); /** + * The meta object literal for the '<em><b>All Inheriting Groups</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference GROUP__ALL_INHERITING_GROUPS = eINSTANCE.getGroup_AllInheritingGroups(); + + /** + * The meta object literal for the '<em><b>All Inherited Groups</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference GROUP__ALL_INHERITED_GROUPS = eINSTANCE.getGroup_AllInheritedGroups(); + + /** + * The meta object literal for the '<em><b>All Roles</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference GROUP__ALL_ROLES = eINSTANCE.getGroup_AllRoles(); + + /** * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.UserImpl <em>User</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1023,6 +1167,30 @@ public interface SecurityPackage extends EPackage EReference USER__GROUPS = eINSTANCE.getUser_Groups(); /** + * The meta object literal for the '<em><b>All Groups</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference USER__ALL_GROUPS = eINSTANCE.getUser_AllGroups(); + + /** + * The meta object literal for the '<em><b>All Roles</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference USER__ALL_ROLES = eINSTANCE.getUser_AllRoles(); + + /** + * The meta object literal for the '<em><b>Label</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute USER__LABEL = eINSTANCE.getUser_Label(); + + /** * The meta object literal for the '<em><b>First Name</b></em>' attribute 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 5090f476d6..08e9a95182 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 @@ -21,6 +21,9 @@ import org.eclipse.emf.common.util.EList; * The following features are supported: * <ul> * <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#getLabel <em>Label</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.User#getFirstName <em>First Name</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.User#getLastName <em>Last Name</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.User#getEmail <em>Email</em>}</li> @@ -54,6 +57,53 @@ public interface User extends Assignee EList<Group> getGroups(); /** + * Returns the value of the '<em><b>All Groups</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Group}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>All Groups</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 Groups</em>' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getUser_AllGroups() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList<Group> getAllGroups(); + + /** + * Returns the value of the '<em><b>All Roles</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Role}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>All Roles</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 Roles</em>' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getUser_AllRoles() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList<Role> getAllRoles(); + + /** + * Returns the value of the '<em><b>Label</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Label</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Label</em>' attribute. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getUser_Label() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + String getLabel(); + + /** * Returns the value of the '<em><b>First Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CachedList.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CachedList.java new file mode 100644 index 0000000000..8d52f21f45 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CachedList.java @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.security.impl; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EcoreEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import java.lang.ref.SoftReference; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; + +/** + * @author Eike Stepper + */ +abstract class CachedList<E extends EObject> implements InternalEList<E>, EStructuralFeature.Setting +{ + private SoftReference<Object[]> cache; + + protected CachedList() + { + } + + private InternalEList<E> getList() + { + Object[] data = null; + if (cache != null) + { + data = cache.get(); + } + + if (data == null) + { + data = getData(); + cache = new SoftReference<Object[]>(data); + } + + InternalEObject owner = getOwner(); + EStructuralFeature feature = getFeature(); + return new EcoreEList.UnmodifiableEList.FastCompare<E>(owner, feature, data.length, data); + } + + protected abstract InternalEObject getOwner(); + + protected abstract EStructuralFeature getFeature(); + + protected abstract Object[] getData(); + + public void move(int newPosition, E object) + { + getList().move(newPosition, object); + } + + public E move(int newPosition, int oldPosition) + { + return getList().move(newPosition, oldPosition); + } + + public E basicGet(int index) + { + return getList().basicGet(index); + } + + public List<E> basicList() + { + return getList().basicList(); + } + + public Iterator<E> basicIterator() + { + return getList().basicIterator(); + } + + public ListIterator<E> basicListIterator() + { + return getList().basicListIterator(); + } + + public ListIterator<E> basicListIterator(int index) + { + return getList().basicListIterator(index); + } + + public Object[] basicToArray() + { + return getList().basicToArray(); + } + + public <T> T[] basicToArray(T[] array) + { + return getList().basicToArray(array); + } + + public int basicIndexOf(Object object) + { + return getList().basicIndexOf(object); + } + + public int basicLastIndexOf(Object object) + { + return getList().basicLastIndexOf(object); + } + + public boolean basicContains(Object object) + { + return getList().basicContains(object); + } + + public boolean basicContainsAll(Collection<?> collection) + { + return getList().basicContainsAll(collection); + } + + public NotificationChain basicRemove(Object object, NotificationChain notifications) + { + return getList().basicRemove(object, notifications); + } + + public NotificationChain basicAdd(E object, NotificationChain notifications) + { + return getList().basicAdd(object, notifications); + } + + public void addUnique(E object) + { + getList().addUnique(object); + } + + public void addUnique(int index, E object) + { + getList().addUnique(index, object); + } + + public boolean addAllUnique(Collection<? extends E> collection) + { + return getList().addAllUnique(collection); + } + + public boolean addAllUnique(int index, Collection<? extends E> collection) + { + return getList().addAllUnique(index, collection); + } + + public E setUnique(int index, E object) + { + return getList().setUnique(index, object); + } + + public int size() + { + return getList().size(); + } + + public boolean isEmpty() + { + return getList().isEmpty(); + } + + public boolean contains(Object o) + { + return getList().contains(o); + } + + public Iterator<E> iterator() + { + return getList().iterator(); + } + + public Object[] toArray() + { + return getList().toArray(); + } + + public <T> T[] toArray(T[] a) + { + return getList().toArray(a); + } + + public boolean add(E e) + { + return getList().add(e); + } + + public boolean remove(Object o) + { + return getList().remove(o); + } + + public boolean containsAll(Collection<?> c) + { + return getList().containsAll(c); + } + + public boolean addAll(Collection<? extends E> c) + { + return getList().addAll(c); + } + + public boolean addAll(int index, Collection<? extends E> c) + { + return getList().addAll(index, c); + } + + public boolean removeAll(Collection<?> c) + { + return getList().removeAll(c); + } + + public boolean retainAll(Collection<?> c) + { + return getList().retainAll(c); + } + + public void clear() + { + getList().clear(); + } + + @Override + public boolean equals(Object o) + { + return getList().equals(o); + } + + @Override + public int hashCode() + { + return getList().hashCode(); + } + + public E get(int index) + { + return getList().get(index); + } + + public E set(int index, E element) + { + return getList().set(index, element); + } + + public void add(int index, E element) + { + getList().add(index, element); + } + + public E remove(int index) + { + return getList().remove(index); + } + + public int indexOf(Object o) + { + return getList().indexOf(o); + } + + public int lastIndexOf(Object o) + { + return getList().lastIndexOf(o); + } + + public ListIterator<E> listIterator() + { + return getList().listIterator(); + } + + public ListIterator<E> listIterator(int index) + { + return getList().listIterator(index); + } + + public List<E> subList(int fromIndex, int toIndex) + { + return getList().subList(fromIndex, toIndex); + } + + public EObject getEObject() + { + return getOwner(); + } + + public EStructuralFeature getEStructuralFeature() + { + return getFeature(); + } + + public Object get(boolean resolve) + { + return getList(); + } + + public void set(Object newValue) + { + throw new UnsupportedOperationException(); + } + + public boolean isSet() + { + return !getList().isEmpty(); + } + + public void unset() + { + throw new UnsupportedOperationException(); + } + + /** + * @author Eike Stepper + */ + static abstract class RecursionSafe<E extends EObject, O extends EObject> extends CachedList<E> + { + protected RecursionSafe() + { + } + + @Override + protected Object[] getData() + { + @SuppressWarnings("unchecked") + O start = (O)getOwner(); + + Set<Object> visited = new HashSet<Object>(); + Set<E> result = new HashSet<E>(); + + getData(start, visited, result); + return result.toArray(); + } + + protected abstract void getData(O object, Set<Object> visited, Set<E> result); + } +} diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/GroupImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/GroupImpl.java index ca4a5b30ca..76c9259a40 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/GroupImpl.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/GroupImpl.java @@ -11,11 +11,16 @@ package org.eclipse.emf.cdo.security.impl; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityPackage; import org.eclipse.emf.cdo.security.User; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; + +import java.util.Set; /** * <!-- begin-user-doc --> @@ -25,7 +30,10 @@ import org.eclipse.emf.ecore.EClass; * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getInheritedGroups <em>Inherited Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getAllInheritedGroups <em>All Inherited Groups</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getInheritingGroups <em>Inheriting Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getAllInheritingGroups <em>All Inheriting Groups</em>}</li> + * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getAllRoles <em>All Roles</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.impl.GroupImpl#getUsers <em>Users</em>}</li> * </ul> * </p> @@ -34,6 +42,94 @@ import org.eclipse.emf.ecore.EClass; */ public class GroupImpl extends AssigneeImpl implements Group { + private EList<Group> allInheritedGroups = new CachedList.RecursionSafe<Group, Group>() + { + @Override + protected InternalEObject getOwner() + { + return GroupImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.GROUP__ALL_INHERITED_GROUPS; + } + + @Override + protected void getData(Group group, Set<Object> visited, Set<Group> result) + { + if (visited.add(group)) + { + result.add(group); + + for (Group inheritedGroup : group.getInheritedGroups()) + { + getData(inheritedGroup, visited, result); + } + } + } + }; + + private EList<Group> allInheritingGroups = new CachedList.RecursionSafe<Group, Group>() + { + @Override + protected InternalEObject getOwner() + { + return GroupImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.GROUP__ALL_INHERITING_GROUPS; + } + + @Override + protected void getData(Group group, Set<Object> visited, Set<Group> result) + { + if (visited.add(group)) + { + result.add(group); + + for (Group inheritingGroup : group.getInheritingGroups()) + { + getData(inheritingGroup, visited, result); + } + } + } + }; + + private EList<Role> allRoles = new CachedList.RecursionSafe<Role, Group>() + { + @Override + protected InternalEObject getOwner() + { + return GroupImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.GROUP__ALL_ROLES; + } + + @Override + protected void getData(Group group, Set<Object> visited, Set<Role> result) + { + if (visited.add(group)) + { + EList<Role> roles = group.getRoles(); + result.addAll(roles); + + for (Group inheritedGroup : group.getInheritedGroups()) + { + getData(inheritedGroup, visited, result); + } + } + } + }; + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -88,4 +184,34 @@ public class GroupImpl extends AssigneeImpl implements Group return (EList<Group>)eGet(SecurityPackage.Literals.GROUP__INHERITING_GROUPS, true); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Group> getAllInheritingGroups() + { + return allInheritingGroups; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Group> getAllInheritedGroups() + { + return allInheritedGroups; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Role> getAllRoles() + { + return allRoles; + } + } // GroupImpl diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityFactoryImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityFactoryImpl.java index 3b0f840b83..e2eb2a9ad2 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityFactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/SecurityFactoryImpl.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.security.impl; +//import org.eclipse.emf.cdo.security.*; import org.eclipse.emf.cdo.security.Directory; import org.eclipse.emf.cdo.security.Group; import org.eclipse.emf.cdo.security.Realm; @@ -44,7 +45,7 @@ public class SecurityFactoryImpl extends EFactoryImpl implements SecurityFactory try { SecurityFactory theSecurityFactory = (SecurityFactory)EPackage.Registry.INSTANCE - .getEFactory("http://www.eclipse.org/emf/CDO/security/4.1.0"); //$NON-NLS-1$ + .getEFactory("http://www.eclipse.org/emf/CDO/security/4.1.0"); //$NON-NLS-1$ if (theSecurityFactory != null) { return theSecurityFactory; @@ -79,17 +80,17 @@ public class SecurityFactoryImpl extends EFactoryImpl implements SecurityFactory switch (eClass.getClassifierID()) { case SecurityPackage.REALM: - return createRealm(); + return (EObject)createRealm(); case SecurityPackage.DIRECTORY: - return createDirectory(); + return (EObject)createDirectory(); case SecurityPackage.ROLE: - return createRole(); + return (EObject)createRole(); case SecurityPackage.GROUP: - return createGroup(); + return (EObject)createGroup(); case SecurityPackage.USER: - return createUser(); + return (EObject)createUser(); case SecurityPackage.USER_PASSWORD: - return createUserPassword(); + return (EObject)createUserPassword(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } 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 f6c2e83ec0..e230d2da94 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 @@ -130,7 +130,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage /** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * + * * <p>This method is used to initialize {@link SecurityPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> @@ -143,9 +143,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage public static SecurityPackage init() { if (isInited) - { return (SecurityPackage)EPackage.Registry.INSTANCE.getEPackage(SecurityPackage.eNS_URI); - } // Obtain or create and register package SecurityPackageImpl theSecurityPackage = (SecurityPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SecurityPackageImpl ? EPackage.Registry.INSTANCE @@ -337,7 +335,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EReference getGroup_Users() { - return (EReference)groupEClass.getEStructuralFeatures().get(2); + return (EReference)groupEClass.getEStructuralFeatures().get(5); } /** @@ -357,6 +355,26 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EReference getGroup_InheritingGroups() { + return (EReference)groupEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getGroup_AllInheritingGroups() + { + return (EReference)groupEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getGroup_AllInheritedGroups() + { return (EReference)groupEClass.getEStructuralFeatures().get(1); } @@ -365,6 +383,16 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage * <!-- end-user-doc --> * @generated */ + public EReference getGroup_AllRoles() + { + return (EReference)groupEClass.getEStructuralFeatures().get(4); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getUser() { return userEClass; @@ -385,9 +413,39 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage * <!-- end-user-doc --> * @generated */ + public EReference getUser_AllGroups() + { + return (EReference)userEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getUser_AllRoles() + { + return (EReference)userEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getUser_Label() + { + return (EAttribute)userEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EAttribute getUser_FirstName() { - return (EAttribute)userEClass.getEStructuralFeatures().get(1); + return (EAttribute)userEClass.getEStructuralFeatures().get(4); } /** @@ -397,7 +455,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EAttribute getUser_LastName() { - return (EAttribute)userEClass.getEStructuralFeatures().get(2); + return (EAttribute)userEClass.getEStructuralFeatures().get(5); } /** @@ -407,7 +465,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EAttribute getUser_Email() { - return (EAttribute)userEClass.getEStructuralFeatures().get(3); + return (EAttribute)userEClass.getEStructuralFeatures().get(6); } /** @@ -417,7 +475,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EAttribute getUser_Locked() { - return (EAttribute)userEClass.getEStructuralFeatures().get(4); + return (EAttribute)userEClass.getEStructuralFeatures().get(7); } /** @@ -427,7 +485,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EReference getUser_Password() { - return (EReference)userEClass.getEStructuralFeatures().get(5); + return (EReference)userEClass.getEStructuralFeatures().get(8); } /** @@ -477,9 +535,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage public void createPackageContents() { if (isCreated) - { return; - } isCreated = true; // Create classes and their features @@ -506,11 +562,17 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage groupEClass = createEClass(GROUP); createEReference(groupEClass, GROUP__INHERITED_GROUPS); + createEReference(groupEClass, GROUP__ALL_INHERITED_GROUPS); createEReference(groupEClass, GROUP__INHERITING_GROUPS); + createEReference(groupEClass, GROUP__ALL_INHERITING_GROUPS); + createEReference(groupEClass, GROUP__ALL_ROLES); createEReference(groupEClass, GROUP__USERS); userEClass = createEClass(USER); createEReference(userEClass, USER__GROUPS); + createEReference(userEClass, USER__ALL_GROUPS); + createEReference(userEClass, USER__ALL_ROLES); + createEAttribute(userEClass, USER__LABEL); createEAttribute(userEClass, USER__FIRST_NAME); createEAttribute(userEClass, USER__LAST_NAME); createEAttribute(userEClass, USER__EMAIL); @@ -538,9 +600,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage public void initializePackageContents() { if (isInitialized) - { return; - } isInitialized = true; // Initialize package @@ -558,19 +618,19 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage // Add supertypes to classes securityElementEClass.getESuperTypes().add(theEtypesPackage.getModelElement()); - securityItemEClass.getESuperTypes().add(getSecurityElement()); - realmEClass.getESuperTypes().add(getSecurityElement()); - directoryEClass.getESuperTypes().add(getSecurityItem()); - roleEClass.getESuperTypes().add(getSecurityItem()); - assigneeEClass.getESuperTypes().add(getSecurityItem()); - groupEClass.getESuperTypes().add(getAssignee()); - userEClass.getESuperTypes().add(getAssignee()); + securityItemEClass.getESuperTypes().add(this.getSecurityElement()); + realmEClass.getESuperTypes().add(this.getSecurityElement()); + directoryEClass.getESuperTypes().add(this.getSecurityItem()); + roleEClass.getESuperTypes().add(this.getSecurityItem()); + assigneeEClass.getESuperTypes().add(this.getSecurityItem()); + groupEClass.getESuperTypes().add(this.getAssignee()); + userEClass.getESuperTypes().add(this.getAssignee()); // Initialize classes and features; add operations and parameters initEClass(securityElementEClass, SecurityElement.class, "SecurityElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - addEOperation(securityElementEClass, getRealm(), "getRealm", 1, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ + addEOperation(securityElementEClass, this.getRealm(), "getRealm", 1, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(securityItemEClass, SecurityItem.class, "SecurityItem", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ @@ -578,7 +638,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage initEClass(realmEClass, Realm.class, "Realm", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getRealm_Items(), - getSecurityItem(), + this.getSecurityItem(), null, "items", null, 0, -1, Realm.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( @@ -589,7 +649,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage initEClass(directoryEClass, Directory.class, "Directory", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getDirectory_Items(), - getSecurityItem(), + this.getSecurityItem(), null, "items", null, 0, -1, Directory.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( @@ -600,8 +660,8 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage initEClass(roleEClass, Role.class, "Role", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getRole_Assignees(), - getAssignee(), - getAssignee_Roles(), + this.getAssignee(), + this.getAssignee_Roles(), "assignees", null, 0, -1, Role.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getRole_Id(), @@ -615,8 +675,8 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage initEClass(assigneeEClass, Assignee.class, "Assignee", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getAssignee_Roles(), - getRole(), - getRole_Assignees(), + this.getRole(), + this.getRole_Assignees(), "roles", null, 0, -1, Assignee.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getAssignee_Id(), @@ -626,26 +686,55 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage initEClass(groupEClass, Group.class, "Group", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getGroup_InheritedGroups(), - getGroup(), - getGroup_InheritingGroups(), + this.getGroup(), + this.getGroup_InheritingGroups(), "inheritedGroups", null, 0, -1, Group.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference( + getGroup_AllInheritedGroups(), + this.getGroup(), + null, + "allInheritedGroups", null, 0, -1, Group.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference( getGroup_InheritingGroups(), - getGroup(), - getGroup_InheritedGroups(), + this.getGroup(), + this.getGroup_InheritedGroups(), "inheritingGroups", null, 0, -1, Group.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference( + getGroup_AllInheritingGroups(), + this.getGroup(), + null, + "allInheritingGroups", null, 0, -1, Group.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference( + getGroup_AllRoles(), + this.getRole(), + null, + "allRoles", null, 0, -1, Group.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference( getGroup_Users(), - getUser(), - getUser_Groups(), + this.getUser(), + this.getUser_Groups(), "users", null, 0, -1, Group.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEClass(userEClass, User.class, "User", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( getUser_Groups(), - getGroup(), - getGroup_Users(), + this.getGroup(), + this.getGroup_Users(), "groups", 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_AllGroups(), + this.getGroup(), + null, + "allGroups", 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_AllRoles(), + this.getRole(), + 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$ + initEAttribute( + getUser_Label(), + theEcorePackage.getEString(), + "label", null, 0, 1, User.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute( getUser_FirstName(), theEcorePackage.getEString(), @@ -664,7 +753,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage "locked", null, 0, 1, User.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference( getUser_Password(), - getUserPassword(), + this.getUserPassword(), null, "password", 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$ 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 bca8da5863..b89ea6527d 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 @@ -11,12 +11,18 @@ package org.eclipse.emf.cdo.security.impl; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.Role; 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.EList; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; + +import java.util.HashSet; +import java.util.Set; /** * <!-- begin-user-doc --> @@ -26,6 +32,9 @@ import org.eclipse.emf.ecore.EClass; * The following features are implemented: * <ul> * <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#getLabel <em>Label</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getFirstName <em>First Name</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getLastName <em>Last Name</em>}</li> * <li>{@link org.eclipse.emf.cdo.security.impl.UserImpl#getEmail <em>Email</em>}</li> @@ -38,6 +47,64 @@ import org.eclipse.emf.ecore.EClass; */ public class UserImpl extends AssigneeImpl implements User { + private EList<Group> allGroups = new CachedList<Group>() + { + @Override + protected InternalEObject getOwner() + { + return UserImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.USER__ALL_GROUPS; + } + + @Override + protected Object[] getData() + { + Set<Group> result = new HashSet<Group>(); + + for (Group group : getGroups()) + { + result.add(group); + result.addAll(group.getAllInheritedGroups()); + } + + return result.toArray(); + } + }; + + private EList<Role> allRoles = new CachedList<Role>() + { + @Override + protected InternalEObject getOwner() + { + return UserImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.USER__ALL_ROLES; + } + + @Override + protected Object[] getData() + { + Set<Role> result = new HashSet<Role>(); + result.addAll(getRoles()); + + for (Group group : getAllGroups()) + { + result.addAll(group.getAllRoles()); + } + + return result.toArray(); + } + }; + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -73,6 +140,36 @@ public class UserImpl extends AssigneeImpl implements User /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Group> getAllGroups() + { + return allGroups; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Role> getAllRoles() + { + return allRoles; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getLabel() + { + return (String)eGet(SecurityPackage.Literals.USER__LABEL, true); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ public String getFirstName() diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecurityAdapterFactory.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecurityAdapterFactory.java index 33737ed051..35cfea28c1 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecurityAdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecurityAdapterFactory.java @@ -27,6 +27,8 @@ import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; import org.eclipse.emf.ecore.EObject; +//import org.eclipse.emf.cdo.security.*; + /** * <!-- begin-user-doc --> * The <b>Adapter Factory</b> for the model. diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecuritySwitch.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecuritySwitch.java index 0ffc6fb0d9..02ca779e9e 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecuritySwitch.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/util/SecuritySwitch.java @@ -27,6 +27,8 @@ import org.eclipse.emf.ecore.EObject; import java.util.List; +//import org.eclipse.emf.cdo.security.*; + /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. @@ -112,13 +114,9 @@ public class SecuritySwitch<T> SecurityElement securityElement = (SecurityElement)theEObject; T result = caseSecurityElement(securityElement); if (result == null) - { result = caseModelElement(securityElement); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.SECURITY_ITEM: @@ -126,17 +124,11 @@ public class SecuritySwitch<T> SecurityItem securityItem = (SecurityItem)theEObject; T result = caseSecurityItem(securityItem); if (result == null) - { result = caseSecurityElement(securityItem); - } if (result == null) - { result = caseModelElement(securityItem); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.REALM: @@ -144,17 +136,11 @@ public class SecuritySwitch<T> Realm realm = (Realm)theEObject; T result = caseRealm(realm); if (result == null) - { result = caseSecurityElement(realm); - } if (result == null) - { result = caseModelElement(realm); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.DIRECTORY: @@ -162,21 +148,13 @@ public class SecuritySwitch<T> Directory directory = (Directory)theEObject; T result = caseDirectory(directory); if (result == null) - { result = caseSecurityItem(directory); - } if (result == null) - { result = caseSecurityElement(directory); - } if (result == null) - { result = caseModelElement(directory); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.ROLE: @@ -184,21 +162,13 @@ public class SecuritySwitch<T> Role role = (Role)theEObject; T result = caseRole(role); if (result == null) - { result = caseSecurityItem(role); - } if (result == null) - { result = caseSecurityElement(role); - } if (result == null) - { result = caseModelElement(role); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.ASSIGNEE: @@ -206,21 +176,13 @@ public class SecuritySwitch<T> Assignee assignee = (Assignee)theEObject; T result = caseAssignee(assignee); if (result == null) - { result = caseSecurityItem(assignee); - } if (result == null) - { result = caseSecurityElement(assignee); - } if (result == null) - { result = caseModelElement(assignee); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.GROUP: @@ -228,25 +190,15 @@ public class SecuritySwitch<T> Group group = (Group)theEObject; T result = caseGroup(group); if (result == null) - { result = caseAssignee(group); - } if (result == null) - { result = caseSecurityItem(group); - } if (result == null) - { result = caseSecurityElement(group); - } if (result == null) - { result = caseModelElement(group); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.USER: @@ -254,25 +206,15 @@ public class SecuritySwitch<T> User user = (User)theEObject; T result = caseUser(user); if (result == null) - { result = caseAssignee(user); - } if (result == null) - { result = caseSecurityItem(user); - } if (result == null) - { result = caseSecurityElement(user); - } if (result == null) - { result = caseModelElement(user); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case SecurityPackage.USER_PASSWORD: @@ -280,9 +222,7 @@ public class SecuritySwitch<T> UserPassword userPassword = (UserPassword)theEObject; T result = caseUserPassword(userPassword); if (result == null) - { result = defaultCase(theEObject); - } return result; } default: diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java index 16e04e8119..9794a28f9c 100644 --- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java +++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java @@ -18,8 +18,10 @@ import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.net4j.CDONet4jSession; import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; import org.eclipse.emf.cdo.net4j.CDONet4jUtil; +import org.eclipse.emf.cdo.security.Group; import org.eclipse.emf.cdo.security.Realm; import org.eclipse.emf.cdo.security.RealmUtil; +import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityFactory; import org.eclipse.emf.cdo.security.SecurityItem; import org.eclipse.emf.cdo.security.User; @@ -151,6 +153,30 @@ public class SecurityManager implements ISecurityManager, IUserManager, IPermiss return realm; } + public Group getGroup(String groupID) + { + EList<SecurityItem> items = realm.getItems(); + Group group = RealmUtil.findGroup(items, groupID); + if (group == null) + { + throw new SecurityException("Group " + groupID + " not found"); + } + + return group; + } + + public Role getRole(String roleID) + { + EList<SecurityItem> items = realm.getItems(); + Role role = RealmUtil.findRole(items, roleID); + if (role == null) + { + throw new SecurityException("Role " + roleID + " not found"); + } + + return role; + } + public User getUser(String userID) { synchronized (users) diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/security/ISecurityManager.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/security/ISecurityManager.java index 250c8b0e69..afba2a5686 100644 --- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/security/ISecurityManager.java +++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/security/ISecurityManager.java @@ -10,7 +10,9 @@ */ package org.eclipse.emf.cdo.server.security; +import org.eclipse.emf.cdo.security.Group; import org.eclipse.emf.cdo.security.Realm; +import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.User; import org.eclipse.emf.cdo.server.IRepository; @@ -24,7 +26,11 @@ public interface ISecurityManager { public Realm getRealm(); - public User getUser(String userID); + public User getUser(String userID) throws SecurityException; + + public Group getGroup(String groupID) throws SecurityException; + + public Role getRole(String roleID) throws SecurityException; public void modify(RealmOperation operation); |