Author: channa
Date: Fri Jan 25 15:08:25 2008
New Revision: 12934
Log:
Checking for server.xml parameter and provisioning status is done at each
start; therefore creating admin user is possible on subsequent starts. Fix for
MASHUP-590.
Modified:
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
Modified:
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
==============================================================================
---
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
(original)
+++
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
Fri Jan 25 15:08:25 2008
@@ -651,6 +651,7 @@
boolean createPrimary;
String primaryName = null;
String primaryPassword;
+ SecureRegistry secureRegistry;
ServerConfiguration serverConfig = ServerConfiguration.getInstance();
@@ -740,6 +741,11 @@
configCtx.getAxisConfiguration().addParameter(RegistryConstants.REGISTRY,
registry);
configCtx.getAxisConfiguration().addParameter(RegistryConstants.REGISTRY_REALM,
realm);
+ // Instantiating a secure registry, in order to create user
profiles.
+ secureRegistry = RegistryUtils.createSecureRegistry(
+ MashupConstants.SYSTEM_USER,
MashupConstants.SYSTEM_USER_PASSWORD, registry,
+ realm);
+
if
(!registry.resourceExists(MashupConstants.QUERYSTORE_QUERY_PATH)) {
// add queries to generate user profiles
@@ -926,11 +932,6 @@
ac.authorizeRole(MashupConstants.EVERYONE_ROLE,
MashupConstants.ALL_MASHUPS_QUERY_PATH,
UserManagerConstants.READ);
- // Instantiating a secure registry, in order to create user
profiles.
- SecureRegistry secureRegistry =
RegistryUtils.createSecureRegistry(
- MashupConstants.SYSTEM_USER,
MashupConstants.SYSTEM_USER_PASSWORD, registry,
- realm);
-
// Create the anonymous user profile.
RegistryUtils.createUser(secureRegistry, realm,
RegistryConstants.ANONYMOUS_USER,
"Visitor", "none",
@@ -943,17 +944,18 @@
// Create the 'Samples' user and profile.
RegistryUtils.createUser(secureRegistry, realm,
MashupConstants.SAMPLES_USER,
"Samples", "none", "Samples User");
+ }
- if (createPrimary && !MashupUtils.isInitialSetupComplete()) {
- //Create the admin profile using information from a config
file.
- RegistryUtils
- .createUser(secureRegistry, realm, primaryName,
primaryName, "none",
- "System Administrator");
- // Assign system user the 'admin' role and make primary.
- us.addUserToRole(primaryName,
RegistryConstants.ADMIN_ROLE);
- RegistryUtils.makeUserPrimary(realm, primaryName);
- MashupUtils.setInitialSetupComplete(true);
- }
+ // If primary user has not been created, do so.
+ if (createPrimary && !MashupUtils.isInitialSetupComplete()) {
+ //Create the admin profile using information from a config
file.
+ RegistryUtils
+ .createUser(secureRegistry, realm, primaryName,
primaryName, "none",
+ "System Administrator");
+ // Assign system user the 'admin' role and make primary.
+ us.addUserToRole(primaryName, RegistryConstants.ADMIN_ROLE);
+ RegistryUtils.makeUserPrimary(realm, primaryName);
+ MashupUtils.setInitialSetupComplete(true);
}
} catch (UserManagerException e) {
e.printStackTrace();
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev