Commit 68019961 authored by Jörg Richter's avatar Jörg Richter

Consolidate Access Control migrations, pt. 2

parent 75e0aa58
Pipeline #6609 passed with stages
in 3 minutes and 22 seconds
......@@ -10,13 +10,13 @@ import systems.dmx.core.service.Migration;
/**
* Create the "System" and "Administration" workspaces.
* Create "System" and "Administration" workspaces.
* <p>
* Part of DMX 5.0
* Runs ALWAYS
* <p>
* Note: the "admin" user account is created in migration 6. At this moment both must exist, the "Login enabled"
* config topic type (created in migration 5), and the "Administration" workspace (created here).
* Note: the "admin" user account is created in migration 4. At this moment both must exist, the "Login enabled"
* config topic type (created in migration 1), and the "Administration" workspace (created here).
*/
public class Migration2 extends Migration {
......
package systems.dmx.accesscontrol.migrations;
import systems.dmx.accesscontrol.AccessControlService;
import systems.dmx.workspaces.WorkspacesService;
import systems.dmx.core.service.Inject;
import systems.dmx.core.service.Migration;
import systems.dmx.core.service.accesscontrol.Credentials;
/**
* Create "admin" user account.
* Set "admin" as the owner of the "DMX" workspace.
* <p>
* Part of DMX 5.0
* Runs ALWAYS
* <p>
* Note: both must exist already, the "Login enabled" config topic type (created in migration 5), and the
* "Administration" workspace (created in migration 2).
*/
public class Migration6 extends Migration {
public class Migration3 extends Migration {
// ---------------------------------------------------------------------------------------------- Instance Variables
@Inject
private AccessControlService acService;
@Inject
private WorkspacesService wsService;
// -------------------------------------------------------------------------------------------------- Public Methods
@Override
public void run() {
acService.createUserAccount(new Credentials(
AccessControlService.ADMIN_USERNAME,
AccessControlService.ADMIN_INITIAL_PASSWORD
));
acService.setWorkspaceOwner(wsService.getWorkspace(WorkspacesService.DMX_WORKSPACE_URI),
AccessControlService.ADMIN_USERNAME);
// Note: we don't set a particular creator/modifier here as we don't want suggest that the DMX workspace has
// been created by the "admin" user. Instead the creator/modifier of the DMX workspace remain undefined as the
// DMX workspace is actually created by the system itself.
}
}
package systems.dmx.accesscontrol.migrations;
import systems.dmx.accesscontrol.AccessControlService;
import systems.dmx.workspaces.WorkspacesService;
import systems.dmx.core.service.Inject;
import systems.dmx.core.service.Migration;
import systems.dmx.core.service.accesscontrol.Credentials;
/**
* Set "admin" as the owner of the "DMX" workspace.
* Create "admin" user account.
* <p>
* Part of DMX 5.0
* Runs ALWAYS
* <p>
* Note: both must exist already, the "Login enabled" config topic type (created in migration 1), and the
* "Administration" workspace (created in migration 2).
*/
public class Migration4 extends Migration {
......@@ -21,17 +24,13 @@ public class Migration4 extends Migration {
@Inject
private AccessControlService acService;
@Inject
private WorkspacesService wsService;
// -------------------------------------------------------------------------------------------------- Public Methods
@Override
public void run() {
acService.setWorkspaceOwner(wsService.getWorkspace(WorkspacesService.DMX_WORKSPACE_URI),
AccessControlService.ADMIN_USERNAME);
// Note: we don't set a particular creator/modifier here as we don't want suggest that the DMX
// workspace has been created by the "admin" user. Instead the creator/modifier of the DeepaMehhta
// workspace remain undefined as the DMX workspace is actually created by the system itself.
acService.createUserAccount(new Credentials(
AccessControlService.ADMIN_USERNAME,
AccessControlService.ADMIN_INITIAL_PASSWORD
));
}
}
......@@ -2,40 +2,62 @@
# Runs ALWAYS
{
"topic_types": [
// User Account
"topic_types": [
// User Account
{
"value": "Username",
"uri": "dmx.accesscontrol.username",
"dataTypeUri": "dmx.core.text"
},
{
"value": "Password",
"uri": "dmx.accesscontrol.password",
"dataTypeUri": "dmx.core.text"
},
{
"value": "User Account",
"uri": "dmx.accesscontrol.user_account",
"dataTypeUri": "dmx.core.identity",
"assocDefs": [
{
"value": "Username",
"uri": "dmx.accesscontrol.username",
"dataTypeUri": "dmx.core.text"
"childTypeUri": "dmx.accesscontrol.username",
"childCardinalityUri": "dmx.core.one"
},
{
"value": "Password",
"uri": "dmx.accesscontrol.password",
"dataTypeUri": "dmx.core.text"
},
"childTypeUri": "dmx.accesscontrol.password",
"childCardinalityUri": "dmx.core.one"
}
],
"viewConfigTopics": [
{
"typeUri": "dmx.webclient.view_config",
"childs": {
"dmx.webclient.icon": "\uf21b"
}
}
]
},
// Config
{
"value": "Login enabled",
"uri": "dmx.accesscontrol.login_enabled",
"dataTypeUri": "dmx.core.boolean"
}
],
"assoc_types": [
{
"value": "Membership",
"uri": "dmx.accesscontrol.membership",
"dataTypeUri": "dmx.core.text",
"viewConfigTopics": [
{
"value": "User Account",
"uri": "dmx.accesscontrol.user_account",
"dataTypeUri": "dmx.core.identity",
"assocDefs": [
{
"childTypeUri": "dmx.accesscontrol.username",
"childCardinalityUri": "dmx.core.one"
},
{
"childTypeUri": "dmx.accesscontrol.password",
"childCardinalityUri": "dmx.core.one"
}
],
"viewConfigTopics": [
{
"typeUri": "dmx.webclient.view_config",
"childs": {
"dmx.webclient.icon": "\uf21b"
}
}
]
"typeUri": "dmx.webclient.view_config",
"childs": {
"dmx.webclient.color": "hsl(40, 70%, 53%)",
"dmx.webclient.color#dmx.webclient.background_color": "hsl(40, 80%, 96%)"
}
}
]
]
}
]
}
# Part of DMX 5.0
# Runs ALWAYS
{
"assoc_types": [
{
"value": "Membership",
"uri": "dmx.accesscontrol.membership",
"dataTypeUri": "dmx.core.text",
"viewConfigTopics": [
{
"typeUri": "dmx.webclient.view_config",
"childs": {
"dmx.webclient.color": "hsl(40, 70%, 53%)",
"dmx.webclient.color#dmx.webclient.background_color": "hsl(40, 80%, 96%)"
}
}
]
}
]
}
# Part of DMX 5.0
# Runs ALWAYS
{
"topic_types": [
{
"value": "Login enabled",
"uri": "dmx.accesscontrol.login_enabled",
"dataTypeUri": "dmx.core.boolean"
}
]
}
dmx.plugin.model_version = 6
dmx.plugin.model_version = 4
dmx.plugin.activate_after = systems.dmx.webclient
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment