001package systems.dmx.accesscontrol.migrations;
002
003import systems.dmx.accesscontrol.AccessControlService;
004import systems.dmx.workspaces.WorkspacesService;
005
006import systems.dmx.core.service.Inject;
007import systems.dmx.core.service.Migration;
008
009
010
011/**
012 * Sets "admin" as the owner of the "DMX" workspace.
013 * Runs ALWAYS.
014 * <p>
015 * Part of DM 4.5
016 */
017public class Migration7 extends Migration {
018
019    // ---------------------------------------------------------------------------------------------- Instance Variables
020
021    @Inject
022    private AccessControlService acService;
023
024    @Inject
025    private WorkspacesService wsService;
026
027    // -------------------------------------------------------------------------------------------------- Public Methods
028
029    @Override
030    public void run() {
031        acService.setWorkspaceOwner(wsService.getWorkspace(WorkspacesService.DMX_WORKSPACE_URI),
032            AccessControlService.ADMIN_USERNAME);
033        // Note: we don't set a particular creator/modifier here as we don't want suggest that the DMX
034        // workspace has been created by the "admin" user. Instead the creator/modifier of the DeepaMehhta
035        // workspace remain undefined as the DMX workspace is actually created by the system itself.
036    }
037}