From 0ff48d7edd3da2b167ea55e35b01d04291474a18 Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Wed, 30 Aug 2023 11:41:25 +0200 Subject: [PATCH] Add security support to CDO-LM #5 --- .../about.html | 28 +++++++++++++++++ .../build.properties | 5 ++- .../pom.xml | 31 +++++++++++++++++++ .../lm/server/AbstractLifecycleManager.java | 14 +++++++++ .../plugins/pom.xml | 2 ++ 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 plugins/org.eclipse.emf.cdo.lm.security.edit/about.html create mode 100644 plugins/org.eclipse.emf.cdo.lm.security.edit/pom.xml diff --git a/plugins/org.eclipse.emf.cdo.lm.security.edit/about.html b/plugins/org.eclipse.emf.cdo.lm.security.edit/about.html new file mode 100644 index 0000000000..d35d5aed64 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.lm.security.edit/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/plugins/org.eclipse.emf.cdo.lm.security.edit/build.properties b/plugins/org.eclipse.emf.cdo.lm.security.edit/build.properties index 6e3e902e80..57a6867f66 100644 --- a/plugins/org.eclipse.emf.cdo.lm.security.edit/build.properties +++ b/plugins/org.eclipse.emf.cdo.lm.security.edit/build.properties @@ -4,7 +4,10 @@ bin.includes = .,\ icons/,\ META-INF/,\ plugin.xml,\ - plugin.properties + plugin.properties,\ + about.html jars.compile.order = . source.. = src/ output.. = bin/ +src.includes = about.html,\ + pom.xml diff --git a/plugins/org.eclipse.emf.cdo.lm.security.edit/pom.xml b/plugins/org.eclipse.emf.cdo.lm.security.edit/pom.xml new file mode 100644 index 0000000000..0bfd2cde79 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.lm.security.edit/pom.xml @@ -0,0 +1,31 @@ + + + + + 4.0.0 + + + org.eclipse.emf.cdo + org.eclipse.emf.cdo.plugins + 4.7.0-SNAPSHOT + ../../releng/org.eclipse.emf.cdo.releng.parent/plugins + + + org.eclipse.emf.cdo + org.eclipse.emf.cdo.lm.security.edit + 1.0.0-SNAPSHOT + eclipse-plugin + + \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.lm.server/src/org/eclipse/emf/cdo/lm/server/AbstractLifecycleManager.java b/plugins/org.eclipse.emf.cdo.lm.server/src/org/eclipse/emf/cdo/lm/server/AbstractLifecycleManager.java index f9eef474ab..2037b5fb3f 100644 --- a/plugins/org.eclipse.emf.cdo.lm.server/src/org/eclipse/emf/cdo/lm/server/AbstractLifecycleManager.java +++ b/plugins/org.eclipse.emf.cdo.lm.server/src/org/eclipse/emf/cdo/lm/server/AbstractLifecycleManager.java @@ -66,6 +66,7 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle; import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; +import org.eclipse.net4j.util.om.OMPlatform; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.security.IPasswordCredentials; import org.eclipse.net4j.util.security.PasswordCredentials; @@ -101,6 +102,8 @@ public abstract class AbstractLifecycleManager extends Lifecycle implements LMPa private static final boolean SECURITY_AVAILABLE; + private static final boolean CREATE_TEST_USER = OMPlatform.INSTANCE.isProperty("org.eclipse.emf.cdo.lm.server.AbstractLifecycleManager.CREATE_TEST_USER"); + private IManagedContainer container; private IJVMAcceptor acceptor; @@ -1032,6 +1035,17 @@ public Available(InternalRepository systemRepository, String moduleDefinitionPat { SecurityManagerUtil.addResourcePermissions(administrationRole, System.RESOURCE_PATH, false); } + + if (CREATE_TEST_USER) + { + User stepper = realm.getUser("Stepper"); + if (stepper == null) + { + stepper = realm.addUser(new PasswordCredentials("Stepper", "xxx")); + stepper.getRoles().add(lmRole); + stepper.getRoles().add(realm.getRole("Administration")); + } + } }); } else diff --git a/releng/org.eclipse.emf.cdo.releng.parent/plugins/pom.xml b/releng/org.eclipse.emf.cdo.releng.parent/plugins/pom.xml index dd3259b276..7e7c2fd54e 100644 --- a/releng/org.eclipse.emf.cdo.releng.parent/plugins/pom.xml +++ b/releng/org.eclipse.emf.cdo.releng.parent/plugins/pom.xml @@ -65,6 +65,8 @@ Eike Stepper - initial API and implementation ../../../plugins/org.eclipse.emf.cdo.lm.edit ../../../plugins/org.eclipse.emf.cdo.lm.modules ../../../plugins/org.eclipse.emf.cdo.lm.modules.edit + ../../../plugins/org.eclipse.emf.cdo.lm.security + ../../../plugins/org.eclipse.emf.cdo.lm.security.edit ../../../plugins/org.eclipse.emf.cdo.lm.server ../../../plugins/org.eclipse.emf.cdo.lm.ui ../../../plugins/org.eclipse.emf.cdo.migrator