Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
Issue #373
  • Loading branch information
rsoika committed Dec 7, 2021
1 parent 2b69275 commit 7674c14
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
27 changes: 1 addition & 26 deletions src/main/java/org/imixs/marty/security/SetupUserDBService.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*******************************************************************************/
package org.imixs.marty.security;

import java.util.Optional;
import java.util.logging.Logger;

import javax.annotation.security.DeclareRoles;
Expand All @@ -40,7 +39,6 @@
import org.imixs.workflow.engine.ModelService;
import org.imixs.workflow.engine.SetupEvent;
import org.imixs.workflow.exceptions.AccessDeniedException;
import org.imixs.workflow.exceptions.ModelException;

/**
* The SetupService EJB initializes the system settings by its method 'init()'.
Expand Down Expand Up @@ -69,13 +67,9 @@ public class SetupUserDBService {
private ModelService modelService;

@Inject
@ConfigProperty(name = "setup.mode", defaultValue = "auto")
@ConfigProperty(name = "security.setup.mode", defaultValue = "auto")
String setupMode;

@Inject
@ConfigProperty(name = "setup.system.model", defaultValue = "")
Optional<String> systemModelVersion;

private static Logger logger = Logger.getLogger(SetupUserDBService.class.getName());

/**
Expand All @@ -101,7 +95,6 @@ public String init() {

// read setup mode...
logger.info("...setup.mode = " + setupMode);
logger.info("...setup.system.model = " + systemModelVersion);

// init userIDs for user db?
if ("auto".equalsIgnoreCase(setupMode)) {
Expand All @@ -122,27 +115,9 @@ public String init() {
logger.finest("......UserDB is disabled.");
}

// test systemModelVersion
if (!systemModelVersion.isPresent() || systemModelVersion.get().isEmpty()) {
logger.warning("Missing imixs.property named 'setup.system.model' - system model can not be validated!");
} else {
// try to load system model
try {
modelService.getModel(systemModelVersion.get());
logger.info("...System Model '" + systemModelVersion + "' OK");
} catch (ModelException e) {
// no model found!
logger.warning(
"Missing system model - please upload the system model version '" + systemModelVersion + "'");
}

}

logger.info("...SystemSetup: " + result);
return result;

}



}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class UserGroupPlugin extends AbstractPlugin {
UserGroupService userGroupService = null;;

@Inject
@ConfigProperty(name = "setup.mode", defaultValue = "auto")
@ConfigProperty(name = "security.setup.mode", defaultValue = "auto")
String setupMode;


Expand Down
4 changes: 2 additions & 2 deletions src/site/markdown/concepts/userdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ After the first deployment the connected database contains three tables:

## The Default User 'admin'

When the Imxis-Marty components are deployed the first time and the imixs.properties 'setup.mode=auto' is set, a default admin account with the UserID='admin' and the password 'adminadmin' will be created automatically. The password for this account should be changed after the first login!
When the Imxis-Marty components are deployed the first time and the imixs.properties 'security.setup.mode=auto' is set, a default admin account with the UserID='admin' and the password 'adminadmin' will be created automatically. The password for this account should be changed after the first login!

The initialization of the userdb is triggered by the *[SetupService](./install/setup.html)*. This service will call the *UserGroupService* EJB method *initUserIDs()* which is responsible for the creation of the admin account.

Expand All @@ -34,7 +34,7 @@ The initialization of the userdb is triggered by the *[SetupService](./install/s

2. The admin account will be created in lower case per default. Only if the property 'security.userid.input.mode' is set to 'UPPER' the account will be created in upper case ('ADMIN').

3. To disable the creation of an admin account the imixs.property 'setup.mode' must be set to 'NONE'.
3. To disable the creation of an admin account the imixs.property 'security.setup.mode' must be set to 'NONE'.

### How to Restore the Default User 'admin'

Expand Down
4 changes: 2 additions & 2 deletions src/site/markdown/install/setup.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Initial Setup User DB

Imixs-Marty provides a SetupUserDBService to initialize the user db. The Service can be controlled by the
imixs.property 'setup.mode':
imixs.property `security.setup.mode`:


| mode | Description |
|---------------------------------------------------------------------------|
|-----------------------------------------------------------------------------------|
|auto (default) | initializes the userDb default user and uploads the default models|
|none | no action |

Expand Down

0 comments on commit 7674c14

Please sign in to comment.