Skip to content

Commit

Permalink
Add security support to CDO-LM #5
Browse files Browse the repository at this point in the history
  • Loading branch information
estepper committed Aug 30, 2023
1 parent a3b8de6 commit 0ff48d7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
28 changes: 28 additions & 0 deletions plugins/org.eclipse.emf.cdo.lm.security.edit/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>

<p>June 5, 2007</p>
<h3>License</h3>

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

<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party (&quot;Redistributor&quot;) 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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 31 additions & 0 deletions plugins/org.eclipse.emf.cdo.lm.security.edit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Eike Stepper - initial API and implementation
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.plugins</artifactId>
<version>4.7.0-SNAPSHOT</version>
<relativePath>../../releng/org.eclipse.emf.cdo.releng.parent/plugins</relativePath>
</parent>

<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.lm.security.edit</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions releng/org.eclipse.emf.cdo.releng.parent/plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Eike Stepper - initial API and implementation
<module>../../../plugins/org.eclipse.emf.cdo.lm.edit</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.modules</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.modules.edit</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.security</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.security.edit</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.server</module>
<module>../../../plugins/org.eclipse.emf.cdo.lm.ui</module>
<module>../../../plugins/org.eclipse.emf.cdo.migrator</module>
Expand Down

0 comments on commit 0ff48d7

Please sign in to comment.