<artifactId>org.collectionspace.services.authorization-mgt.import</artifactId>\r
<name>services.authorization-mgt.import</name>\r
<properties>\r
+ <generate_only>false</generate_only>\r
<spring.version>3.0.0.RELEASE</spring.version>\r
<spring.security.version>3.0.2.RELEASE</spring.security.version>\r
</properties>\r
<configuration>\r
<mainClass>org.collectionspace.ImportAuthz</mainClass>\r
<arguments>\r
+ <argument>-g</argument>\r
+ <argument>${generate_only}</argument>\r
<argument>-u</argument>\r
<argument>SPRING_ADMIN</argument>\r
<argument>-p</argument>\r
*/
public class ImportAuthz {
+ final private static String OPTIONS_GENERATE_ONLY = "generate only";
final private static String OPTIONS_USERNAME = "username";
final private static String OPTIONS_PASSWORD = "password";
final private static String OPTIONS_TENANT_BINDING = "tenant binding file";
final private static String MSG_SEPARATOR = "--";
+ final private static boolean generateOnly(String param) {
+ boolean result = false;
+ if (param != null) {
+ result = Boolean.parseBoolean(param);
+ }
+ return result;
+ }
public static void main(String[] args) {
Options options = createOptions();
printUsage();
System.exit(1);
}
+ String generate_only = line.getOptionValue("g");
String user = line.getOptionValue("u");
String password = line.getOptionValue("p");
String tenantBinding = line.getOptionValue("b");
AuthorizationSeedDriver driver = new AuthorizationSeedDriver(
user, password, tenantBinding, exportDir);
driver.generate();
- driver.seed();
+ //
+ // If the "-g" option was set, then we will NOT seed the AuthZ tables. Instead, we'll
+ // just merge the prototypical tenant bindings and generate the permissions XML output
+ //
+ if (generateOnly(generate_only) == false) {
+ driver.seed();
+ } {
+ System.out.println("WARNING: '-g' was set to 'true' so AuthZ tables were not seeded.");
+ }
} catch (ParseException exp) {
// oops, something went wrong
System.err.println("Parsing failed. Reason: " + exp.getMessage());
private static Options createOptions() {
Options options = new Options();
+ options.addOption("g", true, OPTIONS_GENERATE_ONLY);
options.addOption("u", true, OPTIONS_USERNAME);
options.addOption("p", true, OPTIONS_PASSWORD);
options.addOption("b", true, OPTIONS_TENANT_BINDING);
StringBuilder sb = new StringBuilder();
sb.append("\nUsage : java -cp <classpath> " + ImportAuthz.class.getName() + " <options>");
sb.append("\nOptions :");
+ sb.append("\n -g <" + OPTIONS_GENERATE_ONLY + "> generate only, do not seed AuthZ values in the security tables");
sb.append("\n -u <" + OPTIONS_USERNAME + "> cspace username");
sb.append("\n -p <" + OPTIONS_PASSWORD + "> password");
sb.append("\n -b <" + OPTIONS_TENANT_BINDING + "> tenant binding file (fully qualified path)");
Assert.assertNotNull(dimensionsGroups.get(0));
Assert.assertNotNull(dimensionsGroups.get(0).getMeasuredPart());
+ /* No longer part of the "default" domain service tests for the CollectionObject record.
if (logger.isDebugEnabled()) {
logger.debug(testName + ": Reading Natural History part ...");
}
// can add specific field-level checks as warranted.
Object conh = extractPartValue(testName, res, getNHPartName());
Assert.assertNotNull(conh);
+ */
}
// Failure outcomes
xmlns:tenant='http://collectionspace.org/services/common/tenant'>
<tenant:tenantBinding id="2" name="hearstmuseum.berkeley.edu" displayName="Phoebe A. Hearst Museum of Anthropology" version="0.1">
+
<tenant:repositoryDomain name="default-domain" storageName="hearst-domain" repositoryClient="nuxeo-java" />
+
+ <tenant:serviceBindings merge:matcher="id" id="CollectionObjects">
+ <service:object xmlns:service="http://collectionspace.org/services/common/service" >
+ <service:part id="3" merge:matcher="skip" merge:action="insert" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_naturalhistory" updated="" order="3">
+ <service:content contentType="application/xml">
+ <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/collectionobject/domain/naturalhistory http://collectionspace.org/services/collectionobject/domain/collectionobjects_naturalhistory.xsd" />
+ </service:content>
+ </service:part>
+ </service:object>
+ </tenant:serviceBindings>
+
</tenant:tenantBinding>
</tenant:TenantBindingConfig>
<types:value>en</types:value>
</types:item>
<!-- <types:item><types:key>localeLanguage</types:key><types:value>da</types:value></types:item> -->
- </tenant:properties>
+ </tenant:properties>
<!-- begin idgenerators service meta-data -->
<tenant:serviceBindings name="idgenerators" version="0.1">
<!-- other URI paths using which this service could be accessed -->
<!-- <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
/idgenerators/*/ids
</service:uriPath> -->
- </tenant:serviceBindings>
+ </tenant:serviceBindings>
<!-- end id service meta-data -->
<!-- begin collectionobject service meta-data -->
- <tenant:serviceBindings name="CollectionObjects" type="object" version="0.1">
+ <tenant:serviceBindings id="CollectionObjects" name="CollectionObjects" type="object" version="0.1">
<service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/collectionobjects/*/workflow/</service:uriPath>
<!-- other URI paths using which this service could be accessed -->
<!-- <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
<service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject" schemaLocation="http://collectionspace.org/services/collectionobject http://services.collectionspace.org/collectionobject/collectionobjects_common.xsd" />
</service:content>
</service:part>
- <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_naturalhistory" updated="" order="2">
- <service:content contentType="application/xml">
- <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/collectionobject/domain/naturalhistory http://collectionspace.org/services/collectionobject/domain/collectionobjects_naturalhistory.xsd" />
- </service:content>
- </service:part>
- <service:part id="3" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="3">
+ <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
<service:content contentType="application/xml">
<service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
</service:content>