001    package de.deepamehta.plugins.accesscontrol.migrations;
002    
003    import de.deepamehta.plugins.accesscontrol.service.AccessControlService;
004    import de.deepamehta.plugins.workspaces.service.WorkspacesService;
005    
006    import de.deepamehta.core.service.Inject;
007    import de.deepamehta.core.service.Migration;
008    
009    
010    
011    /**
012     * Sets "admin" as the owner of the "DeepaMehta" workspace.
013     * Runs ALWAYS.
014     * <p>
015     * Part of DM 4.5
016     */
017    public 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.DEEPAMEHTA_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 DeepaMehta
034            // workspace has been created by the "admin" user. Instead the creator/modifier of the DeepaMehhta
035            // workspace remain undefined as the DeepaMehta workspace is actually created by the system itself.
036        }
037    }