diff --git a/account-management-db-model/pom.xml b/account-management-db-model/pom.xml index 29c4a52..2ea75f5 100644 --- a/account-management-db-model/pom.xml +++ b/account-management-db-model/pom.xml @@ -14,19 +14,6 @@ Account DB Model - - org.duracloud - common - ${duracloud.artifact.version} - - - - org.duracloud - storageprovider - ${duracloud.artifact.version} - - - org.hibernate hibernate-entitymanager @@ -36,5 +23,10 @@ org.springframework.security spring-security-core + + + org.apache.commons + commons-lang3 + diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java index a881cb8..c207298 100644 --- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java +++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java @@ -18,11 +18,6 @@ import javax.persistence.OneToMany; import javax.persistence.OneToOne; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; -import org.hibernate.annotations.LazyToOne; -import org.hibernate.annotations.LazyToOneOption; - /** * @author Erik Paulsson Date: 7/10/13 */ diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/InitUserCredential.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/InitUserCredential.java deleted file mode 100644 index e8bd989..0000000 --- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/InitUserCredential.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The contents of this file are subject to the license and copyright - * detailed in the LICENSE and NOTICE files at the root of the source - * tree and available online at - * - * http://duracloud.org/license/ - */ -package org.duracloud.account.db.model.util; - -import org.duracloud.common.model.Credential; -import org.duracloud.common.util.ChecksumUtil; - -/** - * @author Andrew Woods - * Date: Jan 31, 2011 - */ -public class InitUserCredential extends Credential { - - private static final String defaultUsername = "init"; - private static final String defaultPassword = "ipw"; - - public InitUserCredential() { - super(getInitUsername(), getInitPassword()); - } - - private static String getInitUsername() { - String username = System.getProperty("init.username"); - if (null == username) { - username = defaultUsername; - } - return username; - } - - private static String getInitPassword() { - String password = System.getProperty("init.password"); - if (null == password) { - password = defaultPassword; - } - return password; - } - - public String getInitEncodedPassword() { - ChecksumUtil util = new ChecksumUtil(ChecksumUtil.Algorithm.SHA_256); - return util.generateChecksum(getInitPassword()); - } -} diff --git a/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java b/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java new file mode 100644 index 0000000..f50f067 --- /dev/null +++ b/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java @@ -0,0 +1,17 @@ +/* + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://duracloud.org/license/ + */ +package org.duracloud.reportdata.bitintegrity; +/** + * + * @author Daniel Bernstein + * + */ +public enum BitIntegrityReportResult { + SUCCESS, + FAILURE; +} diff --git a/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java b/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java new file mode 100644 index 0000000..10421ea --- /dev/null +++ b/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java @@ -0,0 +1,191 @@ +/* + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://duracloud.org/license/ + */ +package org.duracloud.security.domain; + +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Andrew Woods + * Date: Mar 28, 2010 + */ +public class SecurityUserBean { + private String username; + private String password; + private String email; + private String ipLimits; + private boolean enabled; + private boolean accountNonExpired; + private boolean credentialsNonExpired; + private boolean accountNonLocked; + private List grantedAuthorities; + private List groups; + + public static final String SCHEMA_VERSION = "1.3"; + + public SecurityUserBean() { + this("unknown", + "unknown", + "", + "", + false, + false, + false, + false, + new ArrayList<>(), + new ArrayList<>()); + } + + public SecurityUserBean(String username, + String password, + List grantedAuthorities) { + this(username, + password, + "", + "", + true, + true, + true, + true, + grantedAuthorities, + new ArrayList<>()); + } + + public SecurityUserBean(String username, + String password, + String email, + String ipLimits, + boolean enabled, + boolean accountNonExpired, + boolean credentialsNonExpired, + boolean accountNonLocked, + List grantedAuthorities, + List groups) { + this.username = username; + this.password = password; + this.email = email; + this.ipLimits = ipLimits; + this.enabled = enabled; + this.accountNonExpired = accountNonExpired; + this.credentialsNonExpired = credentialsNonExpired; + this.accountNonLocked = accountNonLocked; + this.grantedAuthorities = grantedAuthorities; + this.groups = groups; + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public String getEmail() { + return email; + } + + public String getIpLimits() { + return ipLimits; + } + + public boolean isEnabled() { + return enabled; + } + + public boolean isAccountNonExpired() { + return accountNonExpired; + } + + public boolean isCredentialsNonExpired() { + return credentialsNonExpired; + } + + public boolean isAccountNonLocked() { + return accountNonLocked; + } + + public List getGrantedAuthorities() { + return grantedAuthorities; + } + + public void setUsername(String username) { + if (!StringUtils.isBlank(username)) { + this.username = username; + } + } + + public void setPassword(String password) { + if (!StringUtils.isBlank(password)) { + this.password = password; + } + } + + public void setEmail(String email) { + if (!StringUtils.isBlank(email)) { + this.email = email; + } + } + + public void setIpLimits(String ipLimits) { + if(!StringUtils.isBlank(ipLimits)) { + this.ipLimits = ipLimits; + } + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public void setAccountNonExpired(boolean accountNonExpired) { + this.accountNonExpired = accountNonExpired; + } + + public void setCredentialsNonExpired(boolean credentialsNonExpired) { + this.credentialsNonExpired = credentialsNonExpired; + } + + public void setAccountNonLocked(boolean accountNonLocked) { + this.accountNonLocked = accountNonLocked; + } + + public void setGrantedAuthorities(List grantedAuthorities) { + this.grantedAuthorities = grantedAuthorities; + } + + public void addGrantedAuthority(String grantedAuthority) { + if (null == this.grantedAuthorities) { + this.grantedAuthorities = new ArrayList(); + } + this.grantedAuthorities.add(grantedAuthority); + } + + public String getTopAuthorityDisplay() { + List authrorities = getGrantedAuthorities(); + if (authrorities.contains("ROLE_OWNER")) { + return "Owner"; + } else if (authrorities.contains("ROLE_ADMIN")) { + return "Administrator"; + } else { + return "User"; + } + } + + public void addGroup(String group) { + if (null == this.groups) { + groups = new ArrayList<>(); + } + groups.add(group); + } + + public List getGroups() { + return groups; + } +} diff --git a/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java b/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java new file mode 100644 index 0000000..1e5eece --- /dev/null +++ b/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://duracloud.org/license/ + */ +package org.duracloud.storage.domain; + +public enum StorageProviderType { + AMAZON_S3("amazon-s3"), + AMAZON_GLACIER("amazon-glacier"), + RACKSPACE("rackspace"), + SDSC("sdsc"), + IRODS("irods"), + SNAPSHOT("snapshot"), + UNKNOWN("unknown"), + TEST_RETRY("test-retry"), + TEST_VERIFY_CREATE("test-verify-create"), + TEST_VERIFY_DELETE("test-verify-delete"); + + private final String text; + + private StorageProviderType(String pt) { + text = pt; + } + + public static StorageProviderType fromString(String pt) { + for (StorageProviderType pType : values()) { + if (pType.text.equalsIgnoreCase(pt)|| + pType.name().equalsIgnoreCase(pt)) { + return pType; + } + } + return StorageProviderType.UNKNOWN; + } + + @Override + public String toString() { + return text; + } + + public String getName(){ + return name(); + } +} diff --git a/account-management-db-repo/pom.xml b/account-management-db-repo/pom.xml index 8108c81..a96d142 100644 --- a/account-management-db-repo/pom.xml +++ b/account-management-db-repo/pom.xml @@ -28,12 +28,6 @@ common ${project.version} - - - org.duracloud - security - ${duracloud.artifact.version} - diff --git a/mill-db-repo/pom.xml b/mill-db-repo/pom.xml index ed7123f..8c61a28 100644 --- a/mill-db-repo/pom.xml +++ b/mill-db-repo/pom.xml @@ -23,15 +23,9 @@ - org.duracloud - common - ${duracloud.artifact.version} - - - - org.duracloud - reportdata - ${duracloud.artifact.version} + org.duracloud.db + account-management-db-model + ${project.version} diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java index b386886..6700e52 100644 --- a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java +++ b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java @@ -7,30 +7,23 @@ */ package org.duracloud.mill.auditor; -import org.duracloud.common.error.DuraCloudCheckedException; - -import java.lang.Exception; /** - * * @author Daniel Bernstein * March 11, 2014 - * */ -public class AuditLogWriteFailedException extends DuraCloudCheckedException { - +public class AuditLogWriteFailedException extends Exception { + private static final long serialVersionUID = 1L; private AuditLogItem logItem; - - public AuditLogWriteFailedException( - Exception ex, AuditLogItem logItem) { + + public AuditLogWriteFailedException(Exception ex, AuditLogItem logItem) { super(ex); this.logItem = logItem; } - - public AuditLogWriteFailedException( - String message, AuditLogItem logItem) { + + public AuditLogWriteFailedException(String message, AuditLogItem logItem) { super(message); - this.logItem = logItem; + this.logItem = logItem; } public AuditLogItem getLogItem() { diff --git a/pom.xml b/pom.xml index 96932a4..a68b4b2 100644 --- a/pom.xml +++ b/pom.xml @@ -157,7 +157,6 @@ INFO UTF-8 - 4.0.0 4.2.5.RELEASE 4.0.4.RELEASE 1.10.1.RELEASE @@ -530,8 +529,8 @@ org.hibernate hibernate-validator - ${hibernate.version} - + ${hibernate.version} + org.jboss.logging jboss-logging @@ -540,15 +539,9 @@ com.fasterxml classmate - + - - - org.duracloud - common-json - ${duracloud.artifact.version} - - + org.hibernate.javax.persistence hibernate-jpa-2.1-api