From 6f1faab6f60b6c691c05a5629ff89497906e10c9 Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Sat, 9 Jun 2012 13:04:57 +0200 Subject: [381472] Design a repository administration API https://bugs.eclipse.org/bugs/show_bug.cgi?id=381472 --- .../icons/full/obj16/ClassCheck.gif | Bin 0 -> 206 bytes .../icons/full/obj16/Container.gif | Bin 129 -> 0 bytes .../icons/full/obj16/Directory.gif | Bin 129 -> 219 bytes .../icons/full/obj16/Group.gif | Bin 129 -> 603 bytes .../icons/full/obj16/PackageCheck.gif | Bin 0 -> 207 bytes .../icons/full/obj16/Realm.gif | Bin 129 -> 239 bytes .../icons/full/obj16/ResourceCheck.gif | Bin 0 -> 346 bytes .../icons/full/obj16/Role.gif | Bin 129 -> 528 bytes .../icons/full/obj16/SecurityRealm.gif | Bin 129 -> 0 bytes .../icons/full/obj16/User.gif | Bin 129 -> 308 bytes .../icons/full/obj16/UserLocked.gif | Bin 0 -> 313 bytes .../icons/full/obj16/UserPassword.gif | Bin 129 -> 132 bytes .../icons/full/ovr16/READ.gif | Bin 0 -> 143 bytes .../icons/full/ovr16/WRITE.gif | Bin 0 -> 181 bytes .../plugin.properties | 22 +- .../cdo/security/provider/CheckItemProvider.java | 171 +++++++ .../security/provider/ClassCheckItemProvider.java | 146 ++++++ .../provider/PackageCheckItemProvider.java | 146 ++++++ .../cdo/security/provider/RealmItemProvider.java | 64 +++ .../provider/ResourceCheckItemProvider.java | 157 +++++++ .../cdo/security/provider/RoleItemProvider.java | 50 +- .../SecurityItemProviderAdapterFactory.java | 81 ++++ .../model/security.ecore | 32 +- .../model/security.ecorediag | 247 ++++++++-- .../src/org/eclipse/emf/cdo/security/Check.java | 85 ++++ .../org/eclipse/emf/cdo/security/ClassCheck.java | 42 ++ .../org/eclipse/emf/cdo/security/PackageCheck.java | 42 ++ .../org/eclipse/emf/cdo/security/Permission.java | 220 +++++++++ .../src/org/eclipse/emf/cdo/security/Realm.java | 68 +++ .../org/eclipse/emf/cdo/security/RealmUtil.java | 97 ++++ .../eclipse/emf/cdo/security/ResourceCheck.java | 49 ++ .../src/org/eclipse/emf/cdo/security/Role.java | 28 +- .../eclipse/emf/cdo/security/SecurityFactory.java | 27 ++ .../eclipse/emf/cdo/security/SecurityPackage.java | 513 ++++++++++++++++++++- .../eclipse/emf/cdo/security/impl/CheckImpl.java | 102 ++++ .../emf/cdo/security/impl/ClassCheckImpl.java | 58 +++ .../emf/cdo/security/impl/PackageCheckImpl.java | 59 +++ .../eclipse/emf/cdo/security/impl/RealmImpl.java | 139 ++++++ .../emf/cdo/security/impl/ResourceCheckImpl.java | 66 +++ .../eclipse/emf/cdo/security/impl/RoleImpl.java | 18 +- .../emf/cdo/security/impl/SecurityFactoryImpl.java | 102 ++++ .../emf/cdo/security/impl/SecurityPackageImpl.java | 280 ++++++++++- .../cdo/security/util/SecurityAdapterFactory.java | 88 ++++ .../emf/cdo/security/util/SecuritySwitch.java | 106 +++++ .../server/internal/security/SecurityManager.java | 31 +- .../icons/full/obj16/buddies.gif | Bin 603 -> 0 bytes .../icons/full/obj16/buddy.gif | Bin 308 -> 0 bytes .../icons/full/obj16/buddy_disabled.gif | Bin 313 -> 0 bytes .../icons/full/obj16/folder.gif | Bin 219 -> 0 bytes 49 files changed, 3232 insertions(+), 104 deletions(-) create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ClassCheck.gif delete mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Container.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/PackageCheck.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ResourceCheck.gif delete mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/SecurityRealm.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserLocked.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/READ.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/WRITE.gif create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/CheckItemProvider.java create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ClassCheckItemProvider.java create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/PackageCheckItemProvider.java create mode 100644 plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ResourceCheckItemProvider.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Check.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ClassCheck.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/PackageCheck.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Permission.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ResourceCheck.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CheckImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ClassCheckImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/PackageCheckImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceCheckImpl.java delete mode 100644 plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddies.gif delete mode 100644 plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy.gif delete mode 100644 plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy_disabled.gif delete mode 100644 plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/folder.gif diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ClassCheck.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ClassCheck.gif new file mode 100644 index 0000000000..2b8da630d8 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ClassCheck.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Container.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Container.gif deleted file mode 100644 index c00aedf413..0000000000 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Container.gif and /dev/null differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Directory.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Directory.gif index 134551bff7..42e027c933 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Directory.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Directory.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Group.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Group.gif index 90d10f9470..952ed084bd 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Group.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Group.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/PackageCheck.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/PackageCheck.gif new file mode 100644 index 0000000000..30c5c10cc4 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/PackageCheck.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Realm.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Realm.gif index 33a997a160..8e3d48a637 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Realm.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Realm.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ResourceCheck.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ResourceCheck.gif new file mode 100644 index 0000000000..27c7cbbe48 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/ResourceCheck.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Role.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Role.gif index be22463d29..daa3652e9b 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Role.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/Role.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/SecurityRealm.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/SecurityRealm.gif deleted file mode 100644 index 14af8aaee9..0000000000 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/SecurityRealm.gif and /dev/null differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/User.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/User.gif index 48e3cf2268..5eed04350e 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/User.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/User.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserLocked.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserLocked.gif new file mode 100644 index 0000000000..c684f405b5 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserLocked.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserPassword.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserPassword.gif index 2124f3e3ab..c6021728de 100644 Binary files a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserPassword.gif and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/obj16/UserPassword.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/READ.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/READ.gif new file mode 100644 index 0000000000..94db8466f1 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/READ.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/WRITE.gif b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/WRITE.gif new file mode 100644 index 0000000000..b23966fbe9 Binary files /dev/null and b/plugins/org.eclipse.emf.cdo.security.edit/icons/full/ovr16/WRITE.gif differ diff --git a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties index ffc4ef785c..2e78589916 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.security.edit/plugin.properties @@ -37,15 +37,15 @@ _UI_SecurityRealm_name_feature = Name _UI_Container_items_feature = Items _UI_Container_name_feature = Name _UI_Role_assignees_feature = Assignees -_UI_Role_id_feature = Id +_UI_Role_id_feature = ID _UI_Role_type_feature = Type _UI_Assignee_roles_feature = Roles -_UI_Assignee_id_feature = Id +_UI_Assignee_id_feature = ID _UI_Group_users_feature = Users _UI_User_groups_feature = Groups _UI_User_firstName_feature = First Name _UI_User_lastName_feature = Last Name -_UI_User_email_feature = Email +_UI_User_email_feature = E-Mail _UI_User_locked_feature = Locked _UI_User_password_feature = Password _UI_UserPassword_encrypted_feature = Encrypted @@ -65,3 +65,19 @@ _UI_User_allGroups_feature = All Groups _UI_User_allRoles_feature = All Roles _UI_User_label_feature = Label _UI_Group_allInheritingGroups_feature = All Inheriting Groups +_UI_Check_type = Check +_UI_ClassCheck_type = Class Check +_UI_PackageCheck_type = Package Check +_UI_ResourceCheck_type = Resource Check +_UI_Role_checks_feature = Checks +_UI_Check_role_feature = Role +_UI_Check_permission_feature = Permission +_UI_ClassCheck_classes_feature = Classes +_UI_PackageCheck_packages_feature = Packages +_UI_ResourceCheck_pattern_feature = Pattern +_UI_Permission_READ_literal = READ +_UI_Permission_WRITE_literal = WRITE +_UI_Realm_allUsers_feature = All Users +_UI_Realm_allGroups_feature = All Groups +_UI_Realm_allRoles_feature = All Roles +_UI_Realm_allChecks_feature = All Checks diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/CheckItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/CheckItemProvider.java new file mode 100644 index 0000000000..e48ff137b6 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/CheckItemProvider.java @@ -0,0 +1,171 @@ +/** + */ +package org.eclipse.emf.cdo.security.provider; + +import org.eclipse.emf.cdo.security.Check; +import org.eclipse.emf.cdo.security.Permission; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import java.util.Collection; +import java.util.List; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.cdo.security.Check} object. + * + * + * @generated + */ +public class CheckItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public CheckItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addPermissionPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Permission feature. + * + * + * @generated + */ + protected void addPermissionPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Check_permission_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Check_permission_feature", "_UI_Check_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.CHECK__PERMISSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, null)); + } + + /** + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) + { + return hasChildren(object, true); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() + { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) + { + Permission labelValue = ((Check)object).getPermission(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? getString("_UI_Check_type") : //$NON-NLS-1$ + getString("_UI_Check_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(Check.class)) + { + case SecurityPackage.CHECK__PERMISSION: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() + { + return ((IChildCreationExtender)adapterFactory).getResourceLocator(); + } + +} diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ClassCheckItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ClassCheckItemProvider.java new file mode 100644 index 0000000000..2631c29fc4 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ClassCheckItemProvider.java @@ -0,0 +1,146 @@ +/** + */ +package org.eclipse.emf.cdo.security.provider; + +import org.eclipse.emf.cdo.security.ClassCheck; +import org.eclipse.emf.cdo.security.Permission; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +import java.util.Collection; +import java.util.List; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.cdo.security.ClassCheck} object. + * + * + * @generated + */ +public class ClassCheckItemProvider extends CheckItemProvider implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ClassCheckItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addClassesPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Classes feature. + * + * + * @generated + */ + protected void addClassesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_ClassCheck_classes_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ClassCheck_classes_feature", "_UI_ClassCheck_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.CLASS_CHECK__CLASSES, true, false, true, null, null, null)); + } + + /** + * This returns ClassCheck.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ClassCheck")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() + { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) + { + Permission labelValue = ((ClassCheck)object).getPermission(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? getString("_UI_ClassCheck_type") : //$NON-NLS-1$ + getString("_UI_ClassCheck_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/PackageCheckItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/PackageCheckItemProvider.java new file mode 100644 index 0000000000..61d97265a0 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/PackageCheckItemProvider.java @@ -0,0 +1,146 @@ +/** + */ +package org.eclipse.emf.cdo.security.provider; + +import org.eclipse.emf.cdo.security.PackageCheck; +import org.eclipse.emf.cdo.security.Permission; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +import java.util.Collection; +import java.util.List; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.cdo.security.PackageCheck} object. + * + * + * @generated + */ +public class PackageCheckItemProvider extends CheckItemProvider implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public PackageCheckItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addPackagesPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Packages feature. + * + * + * @generated + */ + protected void addPackagesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_PackageCheck_packages_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_PackageCheck_packages_feature", "_UI_PackageCheck_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.PACKAGE_CHECK__PACKAGES, true, false, true, null, null, null)); + } + + /** + * This returns PackageCheck.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/PackageCheck")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() + { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) + { + Permission labelValue = ((PackageCheck)object).getPermission(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? getString("_UI_PackageCheck_type") : //$NON-NLS-1$ + getString("_UI_PackageCheck_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RealmItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RealmItemProvider.java index b75fc58340..6794166b79 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RealmItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RealmItemProvider.java @@ -69,11 +69,75 @@ public class RealmItemProvider extends SecurityElementItemProvider implements IE { super.getPropertyDescriptors(object); + addAllUsersPropertyDescriptor(object); + addAllGroupsPropertyDescriptor(object); + addAllRolesPropertyDescriptor(object); + addAllChecksPropertyDescriptor(object); addNamePropertyDescriptor(object); } return itemPropertyDescriptors; } + /** + * This adds a property descriptor for the All Users feature. + * + * + * @generated + */ + protected void addAllUsersPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Realm_allUsers_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Realm_allUsers_feature", "_UI_Realm_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.REALM__ALL_USERS, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Groups feature. + * + * + * @generated + */ + protected void addAllGroupsPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Realm_allGroups_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Realm_allGroups_feature", "_UI_Realm_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.REALM__ALL_GROUPS, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Roles feature. + * + * + * @generated + */ + protected void addAllRolesPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Realm_allRoles_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Realm_allRoles_feature", "_UI_Realm_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.REALM__ALL_ROLES, false, false, false, null, null, null)); + } + + /** + * This adds a property descriptor for the All Checks feature. + * + * + * @generated + */ + protected void addAllChecksPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_Realm_allChecks_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Realm_allChecks_feature", "_UI_Realm_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.REALM__ALL_CHECKS, false, false, false, null, null, null)); + } + /** * This adds a property descriptor for the Name feature. * diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ResourceCheckItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ResourceCheckItemProvider.java new file mode 100644 index 0000000000..5650b1fd88 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/ResourceCheckItemProvider.java @@ -0,0 +1,157 @@ +/** + */ +package org.eclipse.emf.cdo.security.provider; + +import org.eclipse.emf.cdo.security.Permission; +import org.eclipse.emf.cdo.security.ResourceCheck; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemColorProvider; +import org.eclipse.emf.edit.provider.IItemFontProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITableItemColorProvider; +import org.eclipse.emf.edit.provider.ITableItemFontProvider; +import org.eclipse.emf.edit.provider.ITableItemLabelProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import java.util.Collection; +import java.util.List; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.cdo.security.ResourceCheck} object. + * + * + * @generated + */ +public class ResourceCheckItemProvider extends CheckItemProvider implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, + ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider +{ + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ResourceCheckItemProvider(AdapterFactory adapterFactory) + { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) + { + if (itemPropertyDescriptors == null) + { + super.getPropertyDescriptors(object); + + addPatternPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Pattern feature. + * + * + * @generated + */ + protected void addPatternPropertyDescriptor(Object object) + { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ResourceCheck_pattern_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ResourceCheck_pattern_feature", "_UI_ResourceCheck_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SecurityPackage.Literals.RESOURCE_CHECK__PATTERN, true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns ResourceCheck.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) + { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceCheck")); //$NON-NLS-1$ + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() + { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) + { + Permission labelValue = ((ResourceCheck)object).getPermission(); + String label = labelValue == null ? null : labelValue.toString(); + return label == null || label.length() == 0 ? getString("_UI_ResourceCheck_type") : //$NON-NLS-1$ + getString("_UI_ResourceCheck_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) + { + updateChildren(notification); + + switch (notification.getFeatureID(ResourceCheck.class)) + { + case SecurityPackage.RESOURCE_CHECK__PATTERN: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) + { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RoleItemProvider.java b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RoleItemProvider.java index d796a4ba7a..ddcdae5f79 100644 --- a/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RoleItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.security.edit/src/org/eclipse/emf/cdo/security/provider/RoleItemProvider.java @@ -11,10 +11,12 @@ package org.eclipse.emf.cdo.security.provider; import org.eclipse.emf.cdo.security.Role; +import org.eclipse.emf.cdo.security.SecurityFactory; import org.eclipse.emf.cdo.security.SecurityPackage; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemColorProvider; @@ -69,7 +71,6 @@ public class RoleItemProvider extends SecurityItemItemProvider implements IEditi addAssigneesPropertyDescriptor(object); addIdPropertyDescriptor(object); - addTypePropertyDescriptor(object); } return itemPropertyDescriptors; } @@ -105,20 +106,36 @@ public class RoleItemProvider extends SecurityItemItemProvider implements IEditi } /** - * This adds a property descriptor for the Type feature. + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * * * @generated */ - protected void addTypePropertyDescriptor(Object object) + @Override + public Collection getChildrenFeatures(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_Role_type_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Role_type_feature", "_UI_Role_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SecurityPackage.Literals.ROLE__TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, - null)); + if (childrenFeatures == null) + { + super.getChildrenFeatures(object); + childrenFeatures.add(SecurityPackage.Literals.ROLE__CHECKS); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) + { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); } /** @@ -173,9 +190,11 @@ public class RoleItemProvider extends SecurityItemItemProvider implements IEditi switch (notification.getFeatureID(Role.class)) { case SecurityPackage.ROLE__ID: - case SecurityPackage.ROLE__TYPE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; + case SecurityPackage.ROLE__CHECKS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; } super.notifyChanged(notification); } @@ -191,6 +210,15 @@ public class RoleItemProvider extends SecurityItemItemProvider implements IEditi protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(SecurityPackage.Literals.ROLE__CHECKS, + SecurityFactory.eINSTANCE.createClassCheck())); + + newChildDescriptors.add(createChildParameter(SecurityPackage.Literals.ROLE__CHECKS, + SecurityFactory.eINSTANCE.createPackageCheck())); + + newChildDescriptors.add(createChildParameter(SecurityPackage.Literals.ROLE__CHECKS, + SecurityFactory.eINSTANCE.createResourceCheck())); } } 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 26b612adbb..e48f472ca7 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 @@ -256,6 +256,81 @@ public class SecurityItemProviderAdapterFactory extends SecurityAdapterFactory i return userPasswordItemProvider; } + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.security.ClassCheck} instances. + * + * + * @generated + */ + protected ClassCheckItemProvider classCheckItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.cdo.security.ClassCheck}. + * + * + * @generated + */ + @Override + public Adapter createClassCheckAdapter() + { + if (classCheckItemProvider == null) + { + classCheckItemProvider = new ClassCheckItemProvider(this); + } + + return classCheckItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.security.PackageCheck} instances. + * + * + * @generated + */ + protected PackageCheckItemProvider packageCheckItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.cdo.security.PackageCheck}. + * + * + * @generated + */ + @Override + public Adapter createPackageCheckAdapter() + { + if (packageCheckItemProvider == null) + { + packageCheckItemProvider = new PackageCheckItemProvider(this); + } + + return packageCheckItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.security.ResourceCheck} instances. + * + * + * @generated + */ + protected ResourceCheckItemProvider resourceCheckItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.cdo.security.ResourceCheck}. + * + * + * @generated + */ + @Override + public Adapter createResourceCheckAdapter() + { + if (resourceCheckItemProvider == null) + { + resourceCheckItemProvider = new ResourceCheckItemProvider(this); + } + + return resourceCheckItemProvider; + } + /** * This returns the root adapter factory that contains this factory. * @@ -409,6 +484,12 @@ public class SecurityItemProviderAdapterFactory extends SecurityAdapterFactory i userItemProvider.dispose(); if (userPasswordItemProvider != null) userPasswordItemProvider.dispose(); + if (classCheckItemProvider != null) + classCheckItemProvider.dispose(); + if (packageCheckItemProvider != null) + packageCheckItemProvider.dispose(); + if (resourceCheckItemProvider != null) + resourceCheckItemProvider.dispose(); } } diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.ecore b/plugins/org.eclipse.emf.cdo.security/model/security.ecore index 2fb7329c14..7980d16ad9 100644 --- a/plugins/org.eclipse.emf.cdo.security/model/security.ecore +++ b/plugins/org.eclipse.emf.cdo.security/model/security.ecore @@ -9,6 +9,14 @@ + + + + @@ -20,7 +28,8 @@ - + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag b/plugins/org.eclipse.emf.cdo.security/model/security.ecorediag index 38a3250525..5963a3890d 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 @@ - + @@ -34,7 +34,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -74,7 +74,7 @@ - + @@ -83,10 +83,6 @@ - - - - @@ -98,7 +94,7 @@ - + @@ -118,7 +114,7 @@ - + @@ -134,7 +130,7 @@ - + @@ -170,7 +166,7 @@ - + @@ -190,7 +186,136 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + @@ -198,7 +323,7 @@ - + @@ -207,7 +332,7 @@ - + @@ -220,7 +345,7 @@ - + @@ -234,7 +359,7 @@ - + @@ -242,7 +367,7 @@ - + @@ -256,15 +381,15 @@ - - - + + + - + @@ -278,7 +403,7 @@ - + @@ -292,7 +417,7 @@ - + @@ -336,7 +461,7 @@ - + @@ -372,8 +497,78 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Check.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Check.java new file mode 100644 index 0000000000..a4586c4c88 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Check.java @@ -0,0 +1,85 @@ +/** + */ +package org.eclipse.emf.cdo.security; + +import org.eclipse.emf.cdo.CDOObject; + +/** + * + * A representation of the model object 'Check'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.emf.cdo.security.Check#getRole Role}
  • + *
  • {@link org.eclipse.emf.cdo.security.Check#getPermission Permission}
  • + *
+ *

+ * + * @see org.eclipse.emf.cdo.security.SecurityPackage#getCheck() + * @model abstract="true" + * @extends CDOObject + * @generated + */ +public interface Check extends CDOObject +{ + /** + * Returns the value of the 'Role' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.emf.cdo.security.Role#getChecks Checks}'. + * + *

+ * If the meaning of the 'Role' container reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Role' container reference. + * @see #setRole(Role) + * @see org.eclipse.emf.cdo.security.SecurityPackage#getCheck_Role() + * @see org.eclipse.emf.cdo.security.Role#getChecks + * @model opposite="checks" required="true" transient="false" + * @generated + */ + Role getRole(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.security.Check#getRole Role}' container reference. + * + * + * @param value the new value of the 'Role' container reference. + * @see #getRole() + * @generated + */ + void setRole(Role value); + + /** + * Returns the value of the 'Permission' attribute. + * The default value is "WRITE". + * The literals are from the enumeration {@link org.eclipse.emf.cdo.security.Permission}. + * + *

+ * If the meaning of the 'Permission' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Permission' attribute. + * @see org.eclipse.emf.cdo.security.Permission + * @see #setPermission(Permission) + * @see org.eclipse.emf.cdo.security.SecurityPackage#getCheck_Permission() + * @model default="WRITE" + * @generated + */ + Permission getPermission(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.security.Check#getPermission Permission}' attribute. + * + * + * @param value the new value of the 'Permission' attribute. + * @see org.eclipse.emf.cdo.security.Permission + * @see #getPermission() + * @generated + */ + void setPermission(Permission value); + +} // Check diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ClassCheck.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ClassCheck.java new file mode 100644 index 0000000000..a79877c3ad --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ClassCheck.java @@ -0,0 +1,42 @@ +/** + */ +package org.eclipse.emf.cdo.security; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +/** + * + * A representation of the model object 'Class Check'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.emf.cdo.security.ClassCheck#getClasses Classes}
  • + *
+ *

+ * + * @see org.eclipse.emf.cdo.security.SecurityPackage#getClassCheck() + * @model + * @generated + */ +public interface ClassCheck extends Check +{ + /** + * Returns the value of the 'Classes' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EClass}. + * + *

+ * If the meaning of the 'Classes' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Classes' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getClassCheck_Classes() + * @model required="true" + * @generated + */ + EList getClasses(); + +} // ClassCheck diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/PackageCheck.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/PackageCheck.java new file mode 100644 index 0000000000..4aaeb80620 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/PackageCheck.java @@ -0,0 +1,42 @@ +/** + */ +package org.eclipse.emf.cdo.security; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EPackage; + +/** + * + * A representation of the model object 'Package Check'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.emf.cdo.security.PackageCheck#getPackages Packages}
  • + *
+ *

+ * + * @see org.eclipse.emf.cdo.security.SecurityPackage#getPackageCheck() + * @model + * @generated + */ +public interface PackageCheck extends Check +{ + /** + * Returns the value of the 'Packages' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EPackage}. + * + *

+ * If the meaning of the 'Packages' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Packages' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getPackageCheck_Packages() + * @model required="true" + * @generated + */ + EList getPackages(); + +} // PackageCheck diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Permission.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Permission.java new file mode 100644 index 0000000000..0ff84fdb8c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Permission.java @@ -0,0 +1,220 @@ +/** + */ +package org.eclipse.emf.cdo.security; + +import org.eclipse.emf.common.util.Enumerator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * + * A representation of the literals of the enumeration 'Permission', + * and utility methods for working with them. + * + * @see org.eclipse.emf.cdo.security.SecurityPackage#getPermission() + * @model + * @generated + */ +public enum Permission implements Enumerator +{ + /** + * The 'READ' literal object. + * + * + * @see #READ_VALUE + * @generated + * @ordered + */ + READ(0, "READ", "READ"), //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * The 'WRITE' literal object. + * + * + * @see #WRITE_VALUE + * @generated + * @ordered + */ + WRITE(1, "WRITE", "WRITE"); //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * The 'READ' literal value. + * + *

+ * If the meaning of 'READ' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #READ + * @model + * @generated + * @ordered + */ + public static final int READ_VALUE = 0; + + /** + * The 'WRITE' literal value. + * + *

+ * If the meaning of 'WRITE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WRITE + * @model + * @generated + * @ordered + */ + public static final int WRITE_VALUE = 1; + + /** + * An array of all the 'Permission' enumerators. + * + * + * @generated + */ + private static final Permission[] VALUES_ARRAY = new Permission[] { READ, WRITE, }; + + /** + * A public read-only list of all the 'Permission' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Permission' literal with the specified literal value. + * + * + * @generated + */ + public static Permission get(String literal) + { + for (int i = 0; i < VALUES_ARRAY.length; ++i) + { + Permission result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) + { + return result; + } + } + return null; + } + + /** + * Returns the 'Permission' literal with the specified name. + * + * + * @generated + */ + public static Permission getByName(String name) + { + for (int i = 0; i < VALUES_ARRAY.length; ++i) + { + Permission result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) + { + return result; + } + } + return null; + } + + /** + * Returns the 'Permission' literal with the specified integer value. + * + * + * @generated + */ + public static Permission get(int value) + { + switch (value) + { + case READ_VALUE: + return READ; + case WRITE_VALUE: + return WRITE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Permission(int value, String name, String literal) + { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() + { + return value; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() + { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() + { + return literal; + } + +} // Permission diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Realm.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Realm.java index 312e694bd2..005e6ece3c 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Realm.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Realm.java @@ -21,6 +21,10 @@ import org.eclipse.emf.common.util.EList; * The following features are supported: *
    *
  • {@link org.eclipse.emf.cdo.security.Realm#getItems Items}
  • + *
  • {@link org.eclipse.emf.cdo.security.Realm#getAllUsers All Users}
  • + *
  • {@link org.eclipse.emf.cdo.security.Realm#getAllGroups All Groups}
  • + *
  • {@link org.eclipse.emf.cdo.security.Realm#getAllRoles All Roles}
  • + *
  • {@link org.eclipse.emf.cdo.security.Realm#getAllChecks All Checks}
  • *
  • {@link org.eclipse.emf.cdo.security.Realm#getName Name}
  • *
*

@@ -47,6 +51,70 @@ public interface Realm extends SecurityElement */ EList getItems(); + /** + * Returns the value of the 'All Users' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.User}. + * + *

+ * If the meaning of the 'All Users' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'All Users' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getRealm_AllUsers() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList getAllUsers(); + + /** + * Returns the value of the 'All Groups' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Group}. + * + *

+ * If the meaning of the 'All Groups' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'All Groups' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getRealm_AllGroups() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList getAllGroups(); + + /** + * Returns the value of the 'All Roles' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Role}. + * + *

+ * If the meaning of the 'All Roles' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'All Roles' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getRealm_AllRoles() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList getAllRoles(); + + /** + * Returns the value of the 'All Checks' reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Check}. + * + *

+ * If the meaning of the 'All Checks' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'All Checks' reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getRealm_AllChecks() + * @model transient="true" changeable="false" volatile="true" derived="true" + * @generated + */ + EList getAllChecks(); + /** * Returns the value of the 'Name' attribute. * diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/RealmUtil.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/RealmUtil.java index 71adfd8190..593dc4aece 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/RealmUtil.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/RealmUtil.java @@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.security; import org.eclipse.net4j.util.ObjectUtil; +import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; /** @@ -102,4 +103,100 @@ public final class RealmUtil return null; } + + public static BasicEList allUsers(EList items) + { + BasicEList result = new BasicEList(); + allUsers(items, result); + return result; + } + + public static BasicEList allGroups(EList items) + { + BasicEList result = new BasicEList(); + allGroups(items, result); + return result; + } + + public static BasicEList allRoles(EList items) + { + BasicEList result = new BasicEList(); + allRoles(items, result); + return result; + } + + public static BasicEList allChecks(EList items) + { + BasicEList result = new BasicEList(); + allChecks(items, result); + return result; + } + + private static void allUsers(EList items, EList result) + { + for (SecurityItem item : items) + { + if (item instanceof User) + { + User user = (User)item; + result.add(user); + } + else if (item instanceof Directory) + { + Directory directory = (Directory)item; + allUsers(directory.getItems(), result); + } + } + } + + private static void allGroups(EList items, EList result) + { + for (SecurityItem item : items) + { + if (item instanceof Group) + { + Group group = (Group)item; + result.add(group); + } + else if (item instanceof Directory) + { + Directory directory = (Directory)item; + allGroups(directory.getItems(), result); + } + } + } + + private static void allRoles(EList items, EList result) + { + for (SecurityItem item : items) + { + if (item instanceof Role) + { + Role role = (Role)item; + result.add(role); + } + else if (item instanceof Directory) + { + Directory directory = (Directory)item; + allRoles(directory.getItems(), result); + } + } + } + + private static void allChecks(EList items, EList result) + { + for (SecurityItem item : items) + { + if (item instanceof Role) + { + Role role = (Role)item; + result.addAll(role.getChecks()); + } + else if (item instanceof Directory) + { + Directory directory = (Directory)item; + allChecks(directory.getItems(), result); + } + } + } } diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ResourceCheck.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ResourceCheck.java new file mode 100644 index 0000000000..d15808783f --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/ResourceCheck.java @@ -0,0 +1,49 @@ +/** + */ +package org.eclipse.emf.cdo.security; + +/** + * + * A representation of the model object 'Resource Check'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.emf.cdo.security.ResourceCheck#getPattern Pattern}
  • + *
+ *

+ * + * @see org.eclipse.emf.cdo.security.SecurityPackage#getResourceCheck() + * @model + * @generated + */ +public interface ResourceCheck extends Check +{ + /** + * Returns the value of the 'Pattern' attribute. + * + *

+ * If the meaning of the 'Pattern' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Pattern' attribute. + * @see #setPattern(String) + * @see org.eclipse.emf.cdo.security.SecurityPackage#getResourceCheck_Pattern() + * @model + * @generated + */ + String getPattern(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.security.ResourceCheck#getPattern Pattern}' attribute. + * + * + * @param value the new value of the 'Pattern' attribute. + * @see #getPattern() + * @generated + */ + void setPattern(String value); + +} // ResourceCheck diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Role.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Role.java index 7fdbf89aab..1db7b742db 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Role.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/Role.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.EList; *
    *
  • {@link org.eclipse.emf.cdo.security.Role#getAssignees Assignees}
  • *
  • {@link org.eclipse.emf.cdo.security.Role#getId Id}
  • - *
  • {@link org.eclipse.emf.cdo.security.Role#getType Type}
  • + *
  • {@link org.eclipse.emf.cdo.security.Role#getChecks Checks}
  • *
*

* @@ -77,29 +77,21 @@ public interface Role extends SecurityItem void setId(String value); /** - * Returns the value of the 'Type' attribute. + * Returns the value of the 'Checks' containment reference list. + * The list contents are of type {@link org.eclipse.emf.cdo.security.Check}. + * It is bidirectional and its opposite is '{@link org.eclipse.emf.cdo.security.Check#getRole Role}'. * *

- * If the meaning of the 'Type' attribute isn't clear, + * If the meaning of the 'Checks' containment reference list isn't clear, * there really should be more of a description here... *

* - * @return the value of the 'Type' attribute. - * @see #setType(String) - * @see org.eclipse.emf.cdo.security.SecurityPackage#getRole_Type() - * @model - * @generated - */ - String getType(); - - /** - * Sets the value of the '{@link org.eclipse.emf.cdo.security.Role#getType Type}' attribute. - * - * - * @param value the new value of the 'Type' attribute. - * @see #getType() + * @return the value of the 'Checks' containment reference list. + * @see org.eclipse.emf.cdo.security.SecurityPackage#getRole_Checks() + * @see org.eclipse.emf.cdo.security.Check#getRole + * @model opposite="role" containment="true" * @generated */ - void setType(String value); + EList getChecks(); } // Role diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityFactory.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityFactory.java index 78297dda13..fbc1a0519b 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityFactory.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/SecurityFactory.java @@ -84,6 +84,33 @@ public interface SecurityFactory extends EFactory */ UserPassword createUserPassword(); + /** + * Returns a new object of class 'Class Check'. + * + * + * @return a new object of class 'Class Check'. + * @generated + */ + ClassCheck createClassCheck(); + + /** + * Returns a new object of class 'Package Check'. + * + * + * @return a new object of class 'Package Check'. + * @generated + */ + PackageCheck createPackageCheck(); + + /** + * Returns a new object of class 'Resource Check'. + * + * + * @return a new object of class 'Resource Check'. + * @generated + */ + ResourceCheck createResourceCheck(); + /** * Returns the package supported by this factory. * 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 2acaed64c6..44bd901a24 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 @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.etypes.EtypesPackage; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -160,6 +161,42 @@ public interface SecurityPackage extends EPackage */ int REALM__ITEMS = SECURITY_ELEMENT_FEATURE_COUNT + 0; + /** + * The feature id for the 'All Users' reference list. + * + * + * @generated + * @ordered + */ + int REALM__ALL_USERS = SECURITY_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'All Groups' reference list. + * + * + * @generated + * @ordered + */ + int REALM__ALL_GROUPS = SECURITY_ELEMENT_FEATURE_COUNT + 2; + + /** + * The feature id for the 'All Roles' reference list. + * + * + * @generated + * @ordered + */ + int REALM__ALL_ROLES = SECURITY_ELEMENT_FEATURE_COUNT + 3; + + /** + * The feature id for the 'All Checks' reference list. + * + * + * @generated + * @ordered + */ + int REALM__ALL_CHECKS = SECURITY_ELEMENT_FEATURE_COUNT + 4; + /** * The feature id for the 'Name' attribute. * @@ -167,7 +204,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int REALM__NAME = SECURITY_ELEMENT_FEATURE_COUNT + 1; + int REALM__NAME = SECURITY_ELEMENT_FEATURE_COUNT + 5; /** * The number of structural features of the 'Realm' class. @@ -176,7 +213,7 @@ public interface SecurityPackage extends EPackage * @generated * @ordered */ - int REALM_FEATURE_COUNT = SECURITY_ELEMENT_FEATURE_COUNT + 2; + int REALM_FEATURE_COUNT = SECURITY_ELEMENT_FEATURE_COUNT + 6; /** * The feature id for the 'Annotations' containment reference list. @@ -252,13 +289,13 @@ public interface SecurityPackage extends EPackage int ROLE__ID = SECURITY_ITEM_FEATURE_COUNT + 1; /** - * The feature id for the 'Type' attribute. + * The feature id for the 'Checks' containment reference list. * * * @generated * @ordered */ - int ROLE__TYPE = SECURITY_ITEM_FEATURE_COUNT + 2; + int ROLE__CHECKS = SECURITY_ITEM_FEATURE_COUNT + 2; /** * The number of structural features of the 'Role' class. @@ -570,6 +607,191 @@ public interface SecurityPackage extends EPackage */ int USER_PASSWORD_FEATURE_COUNT = 1; + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.CheckImpl Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.CheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getCheck() + * @generated + */ + int CHECK = 9; + + /** + * The feature id for the 'Role' container reference. + * + * + * @generated + * @ordered + */ + int CHECK__ROLE = 0; + + /** + * The feature id for the 'Permission' attribute. + * + * + * @generated + * @ordered + */ + int CHECK__PERMISSION = 1; + + /** + * The number of structural features of the 'Check' class. + * + * + * @generated + * @ordered + */ + int CHECK_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.ClassCheckImpl Class Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.ClassCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getClassCheck() + * @generated + */ + int CLASS_CHECK = 10; + + /** + * The feature id for the 'Role' container reference. + * + * + * @generated + * @ordered + */ + int CLASS_CHECK__ROLE = CHECK__ROLE; + + /** + * The feature id for the 'Permission' attribute. + * + * + * @generated + * @ordered + */ + int CLASS_CHECK__PERMISSION = CHECK__PERMISSION; + + /** + * The feature id for the 'Classes' reference list. + * + * + * @generated + * @ordered + */ + int CLASS_CHECK__CLASSES = CHECK_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Class Check' class. + * + * + * @generated + * @ordered + */ + int CLASS_CHECK_FEATURE_COUNT = CHECK_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.PackageCheckImpl Package Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.PackageCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getPackageCheck() + * @generated + */ + int PACKAGE_CHECK = 11; + + /** + * The feature id for the 'Role' container reference. + * + * + * @generated + * @ordered + */ + int PACKAGE_CHECK__ROLE = CHECK__ROLE; + + /** + * The feature id for the 'Permission' attribute. + * + * + * @generated + * @ordered + */ + int PACKAGE_CHECK__PERMISSION = CHECK__PERMISSION; + + /** + * The feature id for the 'Packages' reference list. + * + * + * @generated + * @ordered + */ + int PACKAGE_CHECK__PACKAGES = CHECK_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Package Check' class. + * + * + * @generated + * @ordered + */ + int PACKAGE_CHECK_FEATURE_COUNT = CHECK_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.security.impl.ResourceCheckImpl Resource Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.ResourceCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getResourceCheck() + * @generated + */ + int RESOURCE_CHECK = 12; + + /** + * The feature id for the 'Role' container reference. + * + * + * @generated + * @ordered + */ + int RESOURCE_CHECK__ROLE = CHECK__ROLE; + + /** + * The feature id for the 'Permission' attribute. + * + * + * @generated + * @ordered + */ + int RESOURCE_CHECK__PERMISSION = CHECK__PERMISSION; + + /** + * The feature id for the 'Pattern' attribute. + * + * + * @generated + * @ordered + */ + int RESOURCE_CHECK__PATTERN = CHECK_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Resource Check' class. + * + * + * @generated + * @ordered + */ + int RESOURCE_CHECK_FEATURE_COUNT = CHECK_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.security.Permission Permission}' enum. + * + * + * @see org.eclipse.emf.cdo.security.Permission + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getPermission() + * @generated + */ + int PERMISSION = 13; + /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.SecurityElement Element}'. * @@ -601,6 +823,50 @@ public interface SecurityPackage extends EPackage */ EReference getRealm_Items(); + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Realm#getAllUsers All Users}'. + * + * + * @return the meta object for the reference list 'All Users'. + * @see org.eclipse.emf.cdo.security.Realm#getAllUsers() + * @see #getRealm() + * @generated + */ + EReference getRealm_AllUsers(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Realm#getAllGroups All Groups}'. + * + * + * @return the meta object for the reference list 'All Groups'. + * @see org.eclipse.emf.cdo.security.Realm#getAllGroups() + * @see #getRealm() + * @generated + */ + EReference getRealm_AllGroups(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Realm#getAllRoles All Roles}'. + * + * + * @return the meta object for the reference list 'All Roles'. + * @see org.eclipse.emf.cdo.security.Realm#getAllRoles() + * @see #getRealm() + * @generated + */ + EReference getRealm_AllRoles(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.Realm#getAllChecks All Checks}'. + * + * + * @return the meta object for the reference list 'All Checks'. + * @see org.eclipse.emf.cdo.security.Realm#getAllChecks() + * @see #getRealm() + * @generated + */ + EReference getRealm_AllChecks(); + /** * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.Realm#getName Name}'. * @@ -687,15 +953,15 @@ public interface SecurityPackage extends EPackage EAttribute getRole_Id(); /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.Role#getType Type}'. + * Returns the meta object for the containment reference list '{@link org.eclipse.emf.cdo.security.Role#getChecks Checks}'. * * - * @return the meta object for the attribute 'Type'. - * @see org.eclipse.emf.cdo.security.Role#getType() + * @return the meta object for the containment reference list 'Checks'. + * @see org.eclipse.emf.cdo.security.Role#getChecks() * @see #getRole() * @generated */ - EAttribute getRole_Type(); + EReference getRole_Checks(); /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.Assignee Assignee}'. @@ -935,6 +1201,111 @@ public interface SecurityPackage extends EPackage */ EAttribute getUserPassword_Encrypted(); + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.Check Check}'. + * + * + * @return the meta object for class 'Check'. + * @see org.eclipse.emf.cdo.security.Check + * @generated + */ + EClass getCheck(); + + /** + * Returns the meta object for the container reference '{@link org.eclipse.emf.cdo.security.Check#getRole Role}'. + * + * + * @return the meta object for the container reference 'Role'. + * @see org.eclipse.emf.cdo.security.Check#getRole() + * @see #getCheck() + * @generated + */ + EReference getCheck_Role(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.Check#getPermission Permission}'. + * + * + * @return the meta object for the attribute 'Permission'. + * @see org.eclipse.emf.cdo.security.Check#getPermission() + * @see #getCheck() + * @generated + */ + EAttribute getCheck_Permission(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.ClassCheck Class Check}'. + * + * + * @return the meta object for class 'Class Check'. + * @see org.eclipse.emf.cdo.security.ClassCheck + * @generated + */ + EClass getClassCheck(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.ClassCheck#getClasses Classes}'. + * + * + * @return the meta object for the reference list 'Classes'. + * @see org.eclipse.emf.cdo.security.ClassCheck#getClasses() + * @see #getClassCheck() + * @generated + */ + EReference getClassCheck_Classes(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.PackageCheck Package Check}'. + * + * + * @return the meta object for class 'Package Check'. + * @see org.eclipse.emf.cdo.security.PackageCheck + * @generated + */ + EClass getPackageCheck(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.security.PackageCheck#getPackages Packages}'. + * + * + * @return the meta object for the reference list 'Packages'. + * @see org.eclipse.emf.cdo.security.PackageCheck#getPackages() + * @see #getPackageCheck() + * @generated + */ + EReference getPackageCheck_Packages(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.security.ResourceCheck Resource Check}'. + * + * + * @return the meta object for class 'Resource Check'. + * @see org.eclipse.emf.cdo.security.ResourceCheck + * @generated + */ + EClass getResourceCheck(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.security.ResourceCheck#getPattern Pattern}'. + * + * + * @return the meta object for the attribute 'Pattern'. + * @see org.eclipse.emf.cdo.security.ResourceCheck#getPattern() + * @see #getResourceCheck() + * @generated + */ + EAttribute getResourceCheck_Pattern(); + + /** + * Returns the meta object for enum '{@link org.eclipse.emf.cdo.security.Permission Permission}'. + * + * + * @return the meta object for enum 'Permission'. + * @see org.eclipse.emf.cdo.security.Permission + * @generated + */ + EEnum getPermission(); + /** * Returns the factory that creates the instances of the model. * @@ -986,6 +1357,38 @@ public interface SecurityPackage extends EPackage */ EReference REALM__ITEMS = eINSTANCE.getRealm_Items(); + /** + * The meta object literal for the 'All Users' reference list feature. + * + * + * @generated + */ + EReference REALM__ALL_USERS = eINSTANCE.getRealm_AllUsers(); + + /** + * The meta object literal for the 'All Groups' reference list feature. + * + * + * @generated + */ + EReference REALM__ALL_GROUPS = eINSTANCE.getRealm_AllGroups(); + + /** + * The meta object literal for the 'All Roles' reference list feature. + * + * + * @generated + */ + EReference REALM__ALL_ROLES = eINSTANCE.getRealm_AllRoles(); + + /** + * The meta object literal for the 'All Checks' reference list feature. + * + * + * @generated + */ + EReference REALM__ALL_CHECKS = eINSTANCE.getRealm_AllChecks(); + /** * The meta object literal for the 'Name' attribute feature. * @@ -1057,12 +1460,12 @@ public interface SecurityPackage extends EPackage EAttribute ROLE__ID = eINSTANCE.getRole_Id(); /** - * The meta object literal for the 'Type' attribute feature. + * The meta object literal for the 'Checks' containment reference list feature. * * * @generated */ - EAttribute ROLE__TYPE = eINSTANCE.getRole_Type(); + EReference ROLE__CHECKS = eINSTANCE.getRole_Checks(); /** * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.AssigneeImpl Assignee}' class. @@ -1248,6 +1651,96 @@ public interface SecurityPackage extends EPackage */ EAttribute USER_PASSWORD__ENCRYPTED = eINSTANCE.getUserPassword_Encrypted(); + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.CheckImpl Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.CheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getCheck() + * @generated + */ + EClass CHECK = eINSTANCE.getCheck(); + + /** + * The meta object literal for the 'Role' container reference feature. + * + * + * @generated + */ + EReference CHECK__ROLE = eINSTANCE.getCheck_Role(); + + /** + * The meta object literal for the 'Permission' attribute feature. + * + * + * @generated + */ + EAttribute CHECK__PERMISSION = eINSTANCE.getCheck_Permission(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.ClassCheckImpl Class Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.ClassCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getClassCheck() + * @generated + */ + EClass CLASS_CHECK = eINSTANCE.getClassCheck(); + + /** + * The meta object literal for the 'Classes' reference list feature. + * + * + * @generated + */ + EReference CLASS_CHECK__CLASSES = eINSTANCE.getClassCheck_Classes(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.PackageCheckImpl Package Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.PackageCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getPackageCheck() + * @generated + */ + EClass PACKAGE_CHECK = eINSTANCE.getPackageCheck(); + + /** + * The meta object literal for the 'Packages' reference list feature. + * + * + * @generated + */ + EReference PACKAGE_CHECK__PACKAGES = eINSTANCE.getPackageCheck_Packages(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.security.impl.ResourceCheckImpl Resource Check}' class. + * + * + * @see org.eclipse.emf.cdo.security.impl.ResourceCheckImpl + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getResourceCheck() + * @generated + */ + EClass RESOURCE_CHECK = eINSTANCE.getResourceCheck(); + + /** + * The meta object literal for the 'Pattern' attribute feature. + * + * + * @generated + */ + EAttribute RESOURCE_CHECK__PATTERN = eINSTANCE.getResourceCheck_Pattern(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.security.Permission Permission}' enum. + * + * + * @see org.eclipse.emf.cdo.security.Permission + * @see org.eclipse.emf.cdo.security.impl.SecurityPackageImpl#getPermission() + * @generated + */ + EEnum PERMISSION = eINSTANCE.getPermission(); + } } // SecurityPackage diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CheckImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CheckImpl.java new file mode 100644 index 0000000000..641b0eab43 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/CheckImpl.java @@ -0,0 +1,102 @@ +/** + */ +package org.eclipse.emf.cdo.security.impl; + +import org.eclipse.emf.cdo.security.Check; +import org.eclipse.emf.cdo.security.Permission; +import org.eclipse.emf.cdo.security.Role; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.internal.cdo.CDOObjectImpl; + +import org.eclipse.emf.ecore.EClass; + +/** + * + * An implementation of the model object 'Check'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.emf.cdo.security.impl.CheckImpl#getRole Role}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.CheckImpl#getPermission Permission}
  • + *
+ *

+ * + * @generated + */ +public abstract class CheckImpl extends CDOObjectImpl implements Check +{ + /** + * + * + * @generated + */ + protected CheckImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return SecurityPackage.Literals.CHECK; + } + + /** + * + * + * @generated + */ + @Override + protected int eStaticFeatureCount() + { + return 0; + } + + /** + * + * + * @generated + */ + public Role getRole() + { + return (Role)eGet(SecurityPackage.Literals.CHECK__ROLE, true); + } + + /** + * + * + * @generated + */ + public void setRole(Role newRole) + { + eSet(SecurityPackage.Literals.CHECK__ROLE, newRole); + } + + /** + * + * + * @generated + */ + public Permission getPermission() + { + return (Permission)eGet(SecurityPackage.Literals.CHECK__PERMISSION, true); + } + + /** + * + * + * @generated + */ + public void setPermission(Permission newPermission) + { + eSet(SecurityPackage.Literals.CHECK__PERMISSION, newPermission); + } + +} // CheckImpl diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ClassCheckImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ClassCheckImpl.java new file mode 100644 index 0000000000..b978875aa1 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ClassCheckImpl.java @@ -0,0 +1,58 @@ +/** + */ +package org.eclipse.emf.cdo.security.impl; + +import org.eclipse.emf.cdo.security.ClassCheck; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +/** + * + * An implementation of the model object 'Class Check'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.emf.cdo.security.impl.ClassCheckImpl#getClasses Classes}
  • + *
+ *

+ * + * @generated + */ +public class ClassCheckImpl extends CheckImpl implements ClassCheck +{ + /** + * + * + * @generated + */ + protected ClassCheckImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return SecurityPackage.Literals.CLASS_CHECK; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + public EList getClasses() + { + return (EList)eGet(SecurityPackage.Literals.CLASS_CHECK__CLASSES, true); + } + +} // ClassCheckImpl diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/PackageCheckImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/PackageCheckImpl.java new file mode 100644 index 0000000000..c2f4bea543 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/PackageCheckImpl.java @@ -0,0 +1,59 @@ +/** + */ +package org.eclipse.emf.cdo.security.impl; + +import org.eclipse.emf.cdo.security.PackageCheck; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; + +/** + * + * An implementation of the model object 'Package Check'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.emf.cdo.security.impl.PackageCheckImpl#getPackages Packages}
  • + *
+ *

+ * + * @generated + */ +public class PackageCheckImpl extends CheckImpl implements PackageCheck +{ + /** + * + * + * @generated + */ + protected PackageCheckImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return SecurityPackage.Literals.PACKAGE_CHECK; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + public EList getPackages() + { + return (EList)eGet(SecurityPackage.Literals.PACKAGE_CHECK__PACKAGES, true); + } + +} // PackageCheckImpl diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RealmImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RealmImpl.java index d9fff79b5e..433d19737a 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RealmImpl.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RealmImpl.java @@ -10,12 +10,19 @@ */ 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.Realm; +import org.eclipse.emf.cdo.security.RealmUtil; +import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityItem; 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; /** * @@ -25,6 +32,10 @@ import org.eclipse.emf.ecore.EClass; * The following features are implemented: *
    *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getItems Items}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getAllUsers All Users}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getAllGroups All Groups}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getAllRoles All Roles}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getAllChecks All Checks}
  • *
  • {@link org.eclipse.emf.cdo.security.impl.RealmImpl#getName Name}
  • *
*

@@ -33,6 +44,94 @@ import org.eclipse.emf.ecore.EClass; */ public class RealmImpl extends SecurityElementImpl implements Realm { + private EList allUsers = new CachedList() + { + @Override + protected InternalEObject getOwner() + { + return RealmImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.REALM__ALL_USERS; + } + + @Override + protected Object[] getData() + { + EList items = getItems(); + return RealmUtil.allUsers(items).data(); + } + }; + + private EList allGroups = new CachedList() + { + @Override + protected InternalEObject getOwner() + { + return RealmImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.REALM__ALL_GROUPS; + } + + @Override + protected Object[] getData() + { + EList items = getItems(); + return RealmUtil.allGroups(items).data(); + } + }; + + private EList allRoles = new CachedList() + { + @Override + protected InternalEObject getOwner() + { + return RealmImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.REALM__ALL_ROLES; + } + + @Override + protected Object[] getData() + { + EList items = getItems(); + return RealmUtil.allRoles(items).data(); + } + }; + + private EList allChecks = new CachedList() + { + @Override + protected InternalEObject getOwner() + { + return RealmImpl.this; + } + + @Override + protected EStructuralFeature getFeature() + { + return SecurityPackage.Literals.REALM__ALL_CHECKS; + } + + @Override + protected Object[] getData() + { + EList items = getItems(); + return RealmUtil.allChecks(items).data(); + } + }; + /** * * @@ -65,6 +164,46 @@ public class RealmImpl extends SecurityElementImpl implements Realm return (EList)eGet(SecurityPackage.Literals.REALM__ITEMS, true); } + /** + * + * + * @generated NOT + */ + public EList getAllUsers() + { + return allUsers; + } + + /** + * + * + * @generated NOT + */ + public EList getAllGroups() + { + return allGroups; + } + + /** + * + * + * @generated NOT + */ + public EList getAllRoles() + { + return allRoles; + } + + /** + * + * + * @generated NOT + */ + public EList getAllChecks() + { + return allChecks; + } + /** * * diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceCheckImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceCheckImpl.java new file mode 100644 index 0000000000..16b64de451 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceCheckImpl.java @@ -0,0 +1,66 @@ +/** + */ +package org.eclipse.emf.cdo.security.impl; + +import org.eclipse.emf.cdo.security.ResourceCheck; +import org.eclipse.emf.cdo.security.SecurityPackage; + +import org.eclipse.emf.ecore.EClass; + +/** + * + * An implementation of the model object 'Resource Check'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.emf.cdo.security.impl.ResourceCheckImpl#getPattern Pattern}
  • + *
+ *

+ * + * @generated + */ +public class ResourceCheckImpl extends CheckImpl implements ResourceCheck +{ + /** + * + * + * @generated + */ + protected ResourceCheckImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return SecurityPackage.Literals.RESOURCE_CHECK; + } + + /** + * + * + * @generated + */ + public String getPattern() + { + return (String)eGet(SecurityPackage.Literals.RESOURCE_CHECK__PATTERN, true); + } + + /** + * + * + * @generated + */ + public void setPattern(String newPattern) + { + eSet(SecurityPackage.Literals.RESOURCE_CHECK__PATTERN, newPattern); + } + +} // ResourceCheckImpl diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RoleImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RoleImpl.java index 091bb3bac6..c660d8dfff 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RoleImpl.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/RoleImpl.java @@ -11,6 +11,7 @@ package org.eclipse.emf.cdo.security.impl; import org.eclipse.emf.cdo.security.Assignee; +import org.eclipse.emf.cdo.security.Check; import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityPackage; @@ -26,7 +27,7 @@ import org.eclipse.emf.ecore.EClass; *
    *
  • {@link org.eclipse.emf.cdo.security.impl.RoleImpl#getAssignees Assignees}
  • *
  • {@link org.eclipse.emf.cdo.security.impl.RoleImpl#getId Id}
  • - *
  • {@link org.eclipse.emf.cdo.security.impl.RoleImpl#getType Type}
  • + *
  • {@link org.eclipse.emf.cdo.security.impl.RoleImpl#getChecks Checks}
  • *
*

* @@ -91,19 +92,10 @@ public class RoleImpl extends SecurityItemImpl implements Role * * @generated */ - public String getType() - { - return (String)eGet(SecurityPackage.Literals.ROLE__TYPE, true); - } - - /** - * - * - * @generated - */ - public void setType(String newType) + @SuppressWarnings("unchecked") + public EList getChecks() { - eSet(SecurityPackage.Literals.ROLE__TYPE, newType); + return (EList)eGet(SecurityPackage.Literals.ROLE__CHECKS, true); } } // RoleImpl 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 e2eb2a9ad2..dceacf8f9b 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 @@ -11,9 +11,13 @@ package org.eclipse.emf.cdo.security.impl; //import org.eclipse.emf.cdo.security.*; +import org.eclipse.emf.cdo.security.ClassCheck; import org.eclipse.emf.cdo.security.Directory; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.PackageCheck; +import org.eclipse.emf.cdo.security.Permission; import org.eclipse.emf.cdo.security.Realm; +import org.eclipse.emf.cdo.security.ResourceCheck; import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityFactory; import org.eclipse.emf.cdo.security.SecurityPackage; @@ -21,6 +25,7 @@ import org.eclipse.emf.cdo.security.User; import org.eclipse.emf.cdo.security.UserPassword; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; @@ -91,11 +96,51 @@ public class SecurityFactoryImpl extends EFactoryImpl implements SecurityFactory return (EObject)createUser(); case SecurityPackage.USER_PASSWORD: return (EObject)createUserPassword(); + case SecurityPackage.CLASS_CHECK: + return (EObject)createClassCheck(); + case SecurityPackage.PACKAGE_CHECK: + return (EObject)createPackageCheck(); + case SecurityPackage.RESOURCE_CHECK: + return (EObject)createResourceCheck(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + case SecurityPackage.PERMISSION: + return createPermissionFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + case SecurityPackage.PERMISSION: + return convertPermissionToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + /** * * @@ -162,6 +207,63 @@ public class SecurityFactoryImpl extends EFactoryImpl implements SecurityFactory return userPassword; } + /** + * + * + * @generated + */ + public ClassCheck createClassCheck() + { + ClassCheckImpl classCheck = new ClassCheckImpl(); + return classCheck; + } + + /** + * + * + * @generated + */ + public PackageCheck createPackageCheck() + { + PackageCheckImpl packageCheck = new PackageCheckImpl(); + return packageCheck; + } + + /** + * + * + * @generated + */ + public ResourceCheck createResourceCheck() + { + ResourceCheckImpl resourceCheck = new ResourceCheckImpl(); + return resourceCheck; + } + + /** + * + * + * @generated + */ + public Permission createPermissionFromString(EDataType eDataType, String initialValue) + { + Permission result = Permission.get(initialValue); + if (result == null) + throw new IllegalArgumentException( + "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return result; + } + + /** + * + * + * @generated + */ + public String convertPermissionToString(EDataType eDataType, Object instanceValue) + { + return instanceValue == null ? null : instanceValue.toString(); + } + /** * * 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 e230d2da94..44d5687591 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 @@ -12,9 +12,14 @@ package org.eclipse.emf.cdo.security.impl; import org.eclipse.emf.cdo.etypes.EtypesPackage; import org.eclipse.emf.cdo.security.Assignee; +import org.eclipse.emf.cdo.security.Check; +import org.eclipse.emf.cdo.security.ClassCheck; import org.eclipse.emf.cdo.security.Directory; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.PackageCheck; +import org.eclipse.emf.cdo.security.Permission; import org.eclipse.emf.cdo.security.Realm; +import org.eclipse.emf.cdo.security.ResourceCheck; import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityElement; import org.eclipse.emf.cdo.security.SecurityFactory; @@ -25,6 +30,7 @@ import org.eclipse.emf.cdo.security.UserPassword; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EcorePackage; @@ -101,6 +107,41 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ private EClass userPasswordEClass = null; + /** + * + * + * @generated + */ + private EClass checkEClass = null; + + /** + * + * + * @generated + */ + private EClass classCheckEClass = null; + + /** + * + * + * @generated + */ + private EClass packageCheckEClass = null; + + /** + * + * + * @generated + */ + private EClass resourceCheckEClass = null; + + /** + * + * + * @generated + */ + private EEnum permissionEEnum = null; + /** * Creates an instance of the model Package, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package @@ -198,6 +239,46 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage return (EReference)realmEClass.getEStructuralFeatures().get(0); } + /** + * + * + * @generated + */ + public EReference getRealm_AllUsers() + { + return (EReference)realmEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getRealm_AllGroups() + { + return (EReference)realmEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getRealm_AllRoles() + { + return (EReference)realmEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getRealm_AllChecks() + { + return (EReference)realmEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -205,7 +286,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage */ public EAttribute getRealm_Name() { - return (EAttribute)realmEClass.getEStructuralFeatures().get(1); + return (EAttribute)realmEClass.getEStructuralFeatures().get(5); } /** @@ -283,9 +364,9 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage * * @generated */ - public EAttribute getRole_Type() + public EReference getRole_Checks() { - return (EAttribute)roleEClass.getEStructuralFeatures().get(2); + return (EReference)roleEClass.getEStructuralFeatures().get(2); } /** @@ -508,6 +589,106 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage return (EAttribute)userPasswordEClass.getEStructuralFeatures().get(0); } + /** + * + * + * @generated + */ + public EClass getCheck() + { + return checkEClass; + } + + /** + * + * + * @generated + */ + public EReference getCheck_Role() + { + return (EReference)checkEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getCheck_Permission() + { + return (EAttribute)checkEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getClassCheck() + { + return classCheckEClass; + } + + /** + * + * + * @generated + */ + public EReference getClassCheck_Classes() + { + return (EReference)classCheckEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getPackageCheck() + { + return packageCheckEClass; + } + + /** + * + * + * @generated + */ + public EReference getPackageCheck_Packages() + { + return (EReference)packageCheckEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getResourceCheck() + { + return resourceCheckEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getResourceCheck_Pattern() + { + return (EAttribute)resourceCheckEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EEnum getPermission() + { + return permissionEEnum; + } + /** * * @@ -545,6 +726,10 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage realmEClass = createEClass(REALM); createEReference(realmEClass, REALM__ITEMS); + createEReference(realmEClass, REALM__ALL_USERS); + createEReference(realmEClass, REALM__ALL_GROUPS); + createEReference(realmEClass, REALM__ALL_ROLES); + createEReference(realmEClass, REALM__ALL_CHECKS); createEAttribute(realmEClass, REALM__NAME); directoryEClass = createEClass(DIRECTORY); @@ -554,7 +739,7 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage roleEClass = createEClass(ROLE); createEReference(roleEClass, ROLE__ASSIGNEES); createEAttribute(roleEClass, ROLE__ID); - createEAttribute(roleEClass, ROLE__TYPE); + createEReference(roleEClass, ROLE__CHECKS); assigneeEClass = createEClass(ASSIGNEE); createEReference(assigneeEClass, ASSIGNEE__ROLES); @@ -581,6 +766,22 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage userPasswordEClass = createEClass(USER_PASSWORD); createEAttribute(userPasswordEClass, USER_PASSWORD__ENCRYPTED); + + checkEClass = createEClass(CHECK); + createEReference(checkEClass, CHECK__ROLE); + createEAttribute(checkEClass, CHECK__PERMISSION); + + classCheckEClass = createEClass(CLASS_CHECK); + createEReference(classCheckEClass, CLASS_CHECK__CLASSES); + + packageCheckEClass = createEClass(PACKAGE_CHECK); + createEReference(packageCheckEClass, PACKAGE_CHECK__PACKAGES); + + resourceCheckEClass = createEClass(RESOURCE_CHECK); + createEAttribute(resourceCheckEClass, RESOURCE_CHECK__PATTERN); + + // Create enums + permissionEEnum = createEEnum(PERMISSION); } /** @@ -625,6 +826,9 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage assigneeEClass.getESuperTypes().add(this.getSecurityItem()); groupEClass.getESuperTypes().add(this.getAssignee()); userEClass.getESuperTypes().add(this.getAssignee()); + classCheckEClass.getESuperTypes().add(this.getCheck()); + packageCheckEClass.getESuperTypes().add(this.getCheck()); + resourceCheckEClass.getESuperTypes().add(this.getCheck()); // Initialize classes and features; add operations and parameters initEClass(securityElementEClass, SecurityElement.class, @@ -641,6 +845,26 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage 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$ + initEReference( + getRealm_AllUsers(), + this.getUser(), + null, + "allUsers", 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$ + initEReference( + getRealm_AllGroups(), + this.getGroup(), + null, + "allGroups", 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$ + initEReference( + getRealm_AllRoles(), + this.getRole(), + null, + "allRoles", 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$ + initEReference( + getRealm_AllChecks(), + this.getCheck(), + null, + "allChecks", 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( getRealm_Name(), theEcorePackage.getEString(), @@ -667,10 +891,11 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage getRole_Id(), theEcorePackage.getEString(), "id", null, 0, 1, Role.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute( - getRole_Type(), - theEcorePackage.getEString(), - "type", null, 0, 1, Role.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference( + getRole_Checks(), + this.getCheck(), + this.getCheck_Role(), + "checks", 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$ initEClass(assigneeEClass, Assignee.class, "Assignee", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference( @@ -764,6 +989,45 @@ public class SecurityPackageImpl extends EPackageImpl implements SecurityPackage theEcorePackage.getEString(), "encrypted", null, 0, 1, UserPassword.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEClass(checkEClass, Check.class, "Check", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference( + getCheck_Role(), + this.getRole(), + this.getRole_Checks(), + "role", null, 1, 1, Check.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute( + getCheck_Permission(), + this.getPermission(), + "permission", "WRITE", 0, 1, Check.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ + + initEClass(classCheckEClass, ClassCheck.class, + "ClassCheck", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference( + getClassCheck_Classes(), + theEcorePackage.getEClass(), + null, + "classes", null, 1, -1, ClassCheck.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(packageCheckEClass, PackageCheck.class, + "PackageCheck", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference( + getPackageCheck_Packages(), + theEcorePackage.getEPackage(), + null, + "packages", null, 1, -1, PackageCheck.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(resourceCheckEClass, ResourceCheck.class, + "ResourceCheck", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute( + getResourceCheck_Pattern(), + theEcorePackage.getEString(), + "pattern", null, 0, 1, ResourceCheck.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + // Initialize enums and add enum literals + initEEnum(permissionEEnum, Permission.class, "Permission"); //$NON-NLS-1$ + addEEnumLiteral(permissionEEnum, Permission.READ); + addEEnumLiteral(permissionEEnum, Permission.WRITE); + // Create resource createResource(eNS_URI); } 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 35cfea28c1..8b950dad0a 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 @@ -12,9 +12,13 @@ package org.eclipse.emf.cdo.security.util; import org.eclipse.emf.cdo.etypes.ModelElement; import org.eclipse.emf.cdo.security.Assignee; +import org.eclipse.emf.cdo.security.Check; +import org.eclipse.emf.cdo.security.ClassCheck; import org.eclipse.emf.cdo.security.Directory; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.PackageCheck; import org.eclipse.emf.cdo.security.Realm; +import org.eclipse.emf.cdo.security.ResourceCheck; import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityElement; import org.eclipse.emf.cdo.security.SecurityItem; @@ -145,6 +149,30 @@ public class SecurityAdapterFactory extends AdapterFactoryImpl return createUserPasswordAdapter(); } + @Override + public Adapter caseCheck(Check object) + { + return createCheckAdapter(); + } + + @Override + public Adapter caseClassCheck(ClassCheck object) + { + return createClassCheckAdapter(); + } + + @Override + public Adapter casePackageCheck(PackageCheck object) + { + return createPackageCheckAdapter(); + } + + @Override + public Adapter caseResourceCheck(ResourceCheck object) + { + return createResourceCheckAdapter(); + } + @Override public Adapter caseModelElement(ModelElement object) { @@ -307,6 +335,66 @@ public class SecurityAdapterFactory extends AdapterFactoryImpl return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.security.Check Check}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.security.Check + * @generated + */ + public Adapter createCheckAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.security.ClassCheck Class Check}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.security.ClassCheck + * @generated + */ + public Adapter createClassCheckAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.security.PackageCheck Package Check}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.security.PackageCheck + * @generated + */ + public Adapter createPackageCheckAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.security.ResourceCheck Resource Check}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.security.ResourceCheck + * @generated + */ + public Adapter createResourceCheckAdapter() + { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.etypes.ModelElement Model Element}'. * 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 02ca779e9e..973dae5fc1 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 @@ -12,9 +12,13 @@ package org.eclipse.emf.cdo.security.util; import org.eclipse.emf.cdo.etypes.ModelElement; import org.eclipse.emf.cdo.security.Assignee; +import org.eclipse.emf.cdo.security.Check; +import org.eclipse.emf.cdo.security.ClassCheck; import org.eclipse.emf.cdo.security.Directory; import org.eclipse.emf.cdo.security.Group; +import org.eclipse.emf.cdo.security.PackageCheck; import org.eclipse.emf.cdo.security.Realm; +import org.eclipse.emf.cdo.security.ResourceCheck; import org.eclipse.emf.cdo.security.Role; import org.eclipse.emf.cdo.security.SecurityElement; import org.eclipse.emf.cdo.security.SecurityItem; @@ -225,6 +229,44 @@ public class SecuritySwitch result = defaultCase(theEObject); return result; } + case SecurityPackage.CHECK: + { + Check check = (Check)theEObject; + T result = caseCheck(check); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case SecurityPackage.CLASS_CHECK: + { + ClassCheck classCheck = (ClassCheck)theEObject; + T result = caseClassCheck(classCheck); + if (result == null) + result = caseCheck(classCheck); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case SecurityPackage.PACKAGE_CHECK: + { + PackageCheck packageCheck = (PackageCheck)theEObject; + T result = casePackageCheck(packageCheck); + if (result == null) + result = caseCheck(packageCheck); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case SecurityPackage.RESOURCE_CHECK: + { + ResourceCheck resourceCheck = (ResourceCheck)theEObject; + T result = caseResourceCheck(resourceCheck); + if (result == null) + result = caseCheck(resourceCheck); + if (result == null) + result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } @@ -374,6 +416,70 @@ public class SecuritySwitch return null; } + /** + * Returns the result of interpreting the object as an instance of 'Check'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Check'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCheck(Check object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Class Check'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Class Check'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseClassCheck(ClassCheck object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Package Check'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Package Check'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePackageCheck(PackageCheck object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Resource Check'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Resource Check'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseResourceCheck(ResourceCheck object) + { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Model Element'. * 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 6fdc5ecdf6..e02de42f08 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 @@ -414,19 +414,6 @@ public class SecurityManager implements ISecurityManager */ private final class WriteAccessHandler implements IRepository.WriteAccessHandler { - private void handleRevisionsBeforeCommitting(CommitContext commitContext, CDOBranchPoint securityContext, - User user, InternalCDORevision[] revisions) - { - for (InternalCDORevision revision : revisions) - { - CDOPermission permission = getPermission(revision, commitContext, securityContext, user); - if (permission != CDOPermission.WRITE) - { - throw new SecurityException("User " + user + " is not allowed to write to " + revision); - } - } - } - public void handleTransactionBeforeCommitting(ITransaction transaction, CommitContext commitContext, OMMonitor monitor) throws RuntimeException { @@ -450,9 +437,25 @@ public class SecurityManager implements ISecurityManager handleRevisionsBeforeCommitting(commitContext, securityContext, user, commitContext.getDirtyObjects()); } + private void handleRevisionsBeforeCommitting(CommitContext commitContext, CDOBranchPoint securityContext, + User user, InternalCDORevision[] revisions) + { + for (InternalCDORevision revision : revisions) + { + CDOPermission permission = getPermission(revision, commitContext, securityContext, user); + if (permission != CDOPermission.WRITE) + { + throw new SecurityException("User " + user + " is not allowed to write to " + revision); + } + } + } + + /** + * @deprecated Not used. + */ + @Deprecated public void handleTransactionAfterCommitted(ITransaction transaction, CommitContext commitContext, OMMonitor monitor) { - // Do nothing } } } diff --git a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddies.gif b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddies.gif deleted file mode 100644 index 952ed084bd..0000000000 Binary files a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddies.gif and /dev/null differ diff --git a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy.gif b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy.gif deleted file mode 100644 index 5eed04350e..0000000000 Binary files a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy.gif and /dev/null differ diff --git a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy_disabled.gif b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy_disabled.gif deleted file mode 100644 index c684f405b5..0000000000 Binary files a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/buddy_disabled.gif and /dev/null differ diff --git a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/folder.gif b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/folder.gif deleted file mode 100644 index 42e027c933..0000000000 Binary files a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/folder.gif and /dev/null differ -- cgit v1.2.3