diff --git a/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/web.xml b/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/web.xml index c07648532..ac7f9ed0c 100644 --- a/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/web.xml +++ b/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/web.xml @@ -7,4 +7,21 @@ LibreCCM Devel Bundle for Wildfly + + ShiroFilter + org.apache.shiro.web.servlet.ShiroFilter + + + + ShiroFilter + /* + REQUEST + FORWARD + INCLUDE + ERROR + + + + org.apache.shiro.web.env.EnvironmentLoaderListener + diff --git a/ccm-core/pom.xml b/ccm-core/pom.xml index 4ead49617..f83c7cce1 100644 --- a/ccm-core/pom.xml +++ b/ccm-core/pom.xml @@ -172,6 +172,10 @@ org.apache.shiro shiro-core + + org.apache.shiro + shiro-web + com.h2database diff --git a/ccm-core/src/main/java/org/libreccm/core/AbstractEntityRepository.java b/ccm-core/src/main/java/org/libreccm/core/AbstractEntityRepository.java index dd1dff3ca..3ded6522f 100644 --- a/ccm-core/src/main/java/org/libreccm/core/AbstractEntityRepository.java +++ b/ccm-core/src/main/java/org/libreccm/core/AbstractEntityRepository.java @@ -18,10 +18,12 @@ */ package org.libreccm.core; - +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.inject.Inject; +import javax.persistence.EntityGraph; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; @@ -29,14 +31,16 @@ import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; /** - * A base class providing common method needed by every repository. - * + * A base class providing common method needed by every repository. + * * @author Jens Pelzetter * @param Type of the primary key of the entity * @param Type of the entity. */ public abstract class AbstractEntityRepository { + static final String FETCH_GRAPH_HINT_KEY = "javax.persistence.fetchgraph"; + /** * The {@link EntityManager} instance to use. Provided by the container via * CDI. @@ -46,7 +50,7 @@ public abstract class AbstractEntityRepository { /** * Getter method for retrieving the injected {@link EntityManager}. - * + * * @return The {@code EntityManager} used by the repository. */ protected EntityManager getEntityManager() { @@ -54,19 +58,19 @@ public abstract class AbstractEntityRepository { } /** - * The class of entities for which this repository can be used. - * For creating a repository class overwrite this method. - * - * @return The {@code Class} of the Entity which are managed by this + * The class of entities for which this repository can be used. For creating + * a repository class overwrite this method. + * + * @return The {@code Class} of the Entity which are managed by this * repository. */ public abstract Class getEntityClass(); /** * Finds an entity by it ID. - * + * * @param entityId The ID of the entity to retrieve. - * + * * @return The entity identified by the provided ID of {@code null} if there * is no such entity. */ @@ -74,20 +78,32 @@ public abstract class AbstractEntityRepository { return entityManager.find(getEntityClass(), entityId); } + public E findById(final K entityId, final String entityGraphName) { + final EntityGraph entityGraph = (EntityGraph) entityManager. + getEntityGraph(entityGraphName); + return findById(entityId, entityGraph); + } + + public E findById(final K entityId, final EntityGraph entityGraph) { + final Map hints = new HashMap<>(); + hints.put(FETCH_GRAPH_HINT_KEY, entityGraph); + return entityManager.find(getEntityClass(), entityId, hints); + } + /** - * Finds all instances of the entity of the type this repository is - * responsible for. - * - * @return The list of entities in the database which are of the type + * Finds all instances of the entity of the type this repository is + * responsible for. + * + * @return The list of entities in the database which are of the type * provided by {@link #getEntityClass()}. */ public List findAll() { // We are using the Critiera API here because otherwise we can't // pass the type of the entity dynmacially. final CriteriaBuilder criteriaBuilder = entityManager - .getCriteriaBuilder(); + .getCriteriaBuilder(); final CriteriaQuery criteriaQuery = criteriaBuilder.createQuery( - getEntityClass()); + getEntityClass()); final Root root = criteriaQuery.from(getEntityClass()); criteriaQuery.select(root); @@ -97,18 +113,18 @@ public abstract class AbstractEntityRepository { } /** - * Used by {@link #save(java.lang.Object)} to determine if the provided + * Used by {@link #save(java.lang.Object)} to determine if the provided * entity is a a new one. - * + * * @param entity The entity to check. - * @return {@code true} if the entity is new (isn't in the database yet), + * @return {@code true} if the entity is new (isn't in the database yet), * {@code false} otherwise. */ public abstract boolean isNew(final E entity); /** * Save a new or changed entity. - * + * * @param entity The entity to save. */ public void save(final E entity) { @@ -121,7 +137,7 @@ public abstract class AbstractEntityRepository { /** * Deletes an entity from the database. - * + * * @param entity The entity to delete. */ public void delete(final E entity) { diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java index 3583dc041..ba2740e1e 100644 --- a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java +++ b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -40,6 +41,7 @@ import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.OneToMany; import javax.persistence.Table; +import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @@ -69,7 +71,7 @@ import javax.xml.bind.annotation.XmlRootElement; //persistence system we can't yet refactor it to make PMD happy. Also I think //this is a false warning. @SuppressWarnings("PMD.TooManyMethods") -public class CcmObject implements Serializable { +public class CcmObject implements Identifiable, Serializable { private static final long serialVersionUID = 201504261329L; @@ -83,6 +85,11 @@ public class CcmObject implements Serializable { @XmlElement(name = "object-id", namespace = CORE_XML_NS) private long objectId; + @Column(name = "UUID", nullable = false) + @NotNull + @XmlElement(name = "uuid") + private String uuid; + /** * A human readable name identifying this {@code CcmObject} */ @@ -120,6 +127,15 @@ public class CcmObject implements Serializable { public void setObjectId(final long objectId) { this.objectId = objectId; } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } public String getDisplayName() { return displayName; diff --git a/ccm-core/src/main/java/org/libreccm/core/Identifiable.java b/ccm-core/src/main/java/org/libreccm/core/Identifiable.java new file mode 100644 index 000000000..a1edde7df --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/core/Identifiable.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.core; + +/** + * + * @author Jens Pelzetter + */ +public interface Identifiable { + + String getUuid(); + +} diff --git a/ccm-core/src/main/java/org/libreccm/security/Shiro.java b/ccm-core/src/main/java/org/libreccm/security/Shiro.java index 028531e0d..b0a1efdb1 100644 --- a/ccm-core/src/main/java/org/libreccm/security/Shiro.java +++ b/ccm-core/src/main/java/org/libreccm/security/Shiro.java @@ -22,9 +22,13 @@ import com.arsdigita.kernel.KernelConfig; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.RequestScoped; +import javax.enterprise.inject.Default; import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.inject.Named; +import javax.inject.Singleton; +import javax.servlet.ServletContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -34,6 +38,8 @@ import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.SimplePrincipalCollection; import org.apache.shiro.subject.Subject; +import org.apache.shiro.web.env.EnvironmentLoader; +import org.apache.shiro.web.env.WebEnvironment; /** * This application scoped CDI bean acts as bridge between CDI and Shiro. It @@ -44,11 +50,15 @@ import org.apache.shiro.subject.Subject; * @author Jens Pelzetter */ @ApplicationScoped +//@Singleton public class Shiro { private static final Logger LOGGER = LogManager.getLogger( Shiro.class); + @Inject + private ServletContext servletContext; + @Inject private UserRepository userRepository; @@ -68,12 +78,20 @@ public class Shiro { */ @PostConstruct public void init() { - LOGGER.debug("Shiro initialising..."); - securityManager = new IniSecurityManagerFactory(INI_FILE) - .createInstance(); - LOGGER.debug("Shiro SecurityManager created sucessfully."); +// LOGGER.debug("Shiro initialising..."); +// securityManager = new IniSecurityManagerFactory( +// INI_FILE) +// .createInstance(); +// LOGGER.debug("Shiro SecurityManager created sucessfully."); +// SecurityUtils.setSecurityManager(securityManager); +// LOGGER.debug("Shiro initialised successfully."); + //securityManager = SecurityUtils.getSecurityManager(); + + final WebEnvironment environment = (WebEnvironment) servletContext. + getAttribute(EnvironmentLoader.ENVIRONMENT_ATTRIBUTE_KEY); + + securityManager = environment.getSecurityManager(); SecurityUtils.setSecurityManager(securityManager); - LOGGER.debug("Shiro initialised successfully."); } /** @@ -85,6 +103,11 @@ public class Shiro { @Named("securityManager") public SecurityManager getSecurityManager() { return securityManager; +// return SecurityUtils.getSecurityManager(); +// final WebEnvironment environment = (WebEnvironment) servletContext. +// getAttribute(EnvironmentLoader.ENVIRONMENT_ATTRIBUTE_KEY); +// +// return environment.getSecurityManager(); } /** diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_0__create_tables.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_0__create_tables.sql index df0bffeb0..b3fb2a901 100644 --- a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_0__create_tables.sql +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_0__create_tables.sql @@ -64,6 +64,7 @@ create table CCM_CORE.CCM_OBJECTS ( OBJECT_ID bigint not null, DISPLAY_NAME varchar(255), + UUID varchar(255) not null; primary key (OBJECT_ID) ); diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_0__create_tables.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_0__create_tables.sql index 42e26a635..0ece7f763 100644 --- a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_0__create_tables.sql +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_0__create_tables.sql @@ -65,6 +65,7 @@ create table CCM_CORE.CCM_OBJECTS ( OBJECT_ID int8 not null, DISPLAY_NAME varchar(255), + UUID varchar(255) not null; primary key (OBJECT_ID) ); diff --git a/ccm-core/src/test/resources-wildfly8-remote-h2-mem/scripts/create_ccm_core_schema.sql b/ccm-core/src/test/resources-wildfly8-remote-h2-mem/scripts/create_ccm_core_schema.sql index c91120514..ae332dcfa 100644 --- a/ccm-core/src/test/resources-wildfly8-remote-h2-mem/scripts/create_ccm_core_schema.sql +++ b/ccm-core/src/test/resources-wildfly8-remote-h2-mem/scripts/create_ccm_core_schema.sql @@ -70,6 +70,7 @@ CREATE SCHEMA ccm_core; create table CCM_CORE.CCM_OBJECTS ( OBJECT_ID bigint not null, DISPLAY_NAME varchar(255), + UUID varchar(255) not null, primary key (OBJECT_ID) ); diff --git a/ccm-core/src/test/resources-wildfly8-remote-pgsql/scripts/create_ccm_core_schema.sql b/ccm-core/src/test/resources-wildfly8-remote-pgsql/scripts/create_ccm_core_schema.sql index 4d263b96f..4587fc532 100644 --- a/ccm-core/src/test/resources-wildfly8-remote-pgsql/scripts/create_ccm_core_schema.sql +++ b/ccm-core/src/test/resources-wildfly8-remote-pgsql/scripts/create_ccm_core_schema.sql @@ -71,6 +71,7 @@ CREATE SCHEMA ccm_core; create table CCM_CORE.CCM_OBJECTS ( OBJECT_ID int8 not null, DISPLAY_NAME varchar(255), + UUID varchar(255) not null, primary key (OBJECT_ID) ); diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml index 0f1b30f33..8b60ca8ad 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml @@ -1,18 +1,25 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml index ab90c4bcf..36beea2c3 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml @@ -1,20 +1,28 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 - object_id: -2300 display_name: category-new + uuid: d9c8ad5d-0450-4d81-be25-721188710880 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml index 2cb591c62..1deb3c631 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml @@ -1,26 +1,37 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 - object_id: 1 display_name: com + uuid: 4f77ec24-b4c2-4023-a6b9-50a33d6f7cef - object_id: 2 display_name: example + uuid: 58e81db1-d99f-4ba6-8bad-2abe72bfaa98 - object_id: 3 display_name: categories + uuid: 0ca06e59-466c-41f2-9c37-c40fba388081 - object_id: 4 display_name: test + uuid: 59aa434c-0220-4841-bf3f-f58d311607aa ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml index 662c98cef..2eadb28b1 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml @@ -1,18 +1,25 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml index 3402359ae..7928e7846 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml @@ -1,18 +1,25 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml index 80a4ba1cd..12f16047f 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml @@ -1,19 +1,26 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: 3b7c7685-340b-48d2-8f27-781a04833634 - object_id: -2000 display_name: test_root + uuid: 35a74731-d700-431a-b0cf-6d548f3d77c9 - object_id: -2100 display_name: foo + uuid: 6b5e0a4b-6a09-4108-ac43-f46b59bc2bc6 - object_id: -2200 display_name: bar + uuid: 0482f4e1-d1f0-44a1-8bef-2b978e00e9a8 - object_id: -3100 display_name: object1 + uuid: b82ea94b-875b-46b1-9078-40e457f25868 - object_id: -3200 display_name: object2 + uuid: 06a838e5-d396-49e4-bcf2-1dabed441406 - object_id: -3300 display_name: object3 - + uuid: 95f03070-9ea1-4e33-8e1b-8108075aac28 + ccm_core.categories: - object_id: -2000 unique_id: test0001 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data2.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data2.yml index 52fc228cd..8d9737d21 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data2.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data2.yml @@ -1,20 +1,28 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: dc1788a7-79b3-4298-94f2-e23cba97301d - object_id: -2000 display_name: test_root + uuid: c78a2311-3751-4b69-b6ed-358b29571407 - object_id: -2100 display_name: foo + uuid: 6b25f081-0144-419f-886c-1fcdfba2aa54 - object_id: -2200 display_name: bar + uuid: dc76f9b8-f69f-408d-918a-bd80d4755166 - object_id: -3100 display_name: object1 + uuid: 2cd8b84e-3dc5-4268-98eb-e297f7f93cd4 - object_id: -3200 display_name: object2 + uuid: ce0c5964-f3ce-4d9e-93c8-7d57ce03a505 - object_id: -3300 display_name: object3 + uuid: c66c5063-8912-4dec-8195-a0b45161419d - object_id: -2300 display_name: category-new + uuid: 2b801a2c-0c0e-4a52-b17b-58fb5b775b09 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml index 14750c723..b84a18b61 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml @@ -1,14 +1,19 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: d76c9183-5558-4ca6-bd56-3cdd8bdadad6 - object_id: -2000 display_name: test_root + uuid: 1d533dba-08f2-4d65-948a-3bba953dabab - object_id: -2100 display_name: foo + uuid: a83d238a-1df7-4b54-a886-a93f4e816888 - object_id: -2200 display_name: bar + uuid: 7fd42bcd-c49f-4d8a-be1c-fd88f2e9a7c0 - object_id: -2300 display_name: new-category + uuid: dfe81433-de5c-47f2-aaf6-5013636211ee ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml index 30c247ee8..06f866094 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml @@ -1,12 +1,16 @@ ccm_core.ccm_objects: - object_id: -1000 display_name: test + uuid: d76c9183-5558-4ca6-bd56-3cdd8bdadad6 - object_id: -2000 display_name: test_root + uuid: 1d533dba-08f2-4d65-948a-3bba953dabab - object_id: -2100 display_name: foo + uuid: a83d238a-1df7-4b54-a886-a93f4e816888 - object_id: -2200 display_name: bar + uuid: 7fd42bcd-c49f-4d8a-be1c-fd88f2e9a7c0 ccm_core.categories: - object_id: -2000 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/RegistrySetupTest/after-setup.xml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/RegistrySetupTest/after-setup.xml index 432332103..927d1dabb 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/RegistrySetupTest/after-setup.xml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/RegistrySetupTest/after-setup.xml @@ -1,9 +1,11 @@ + display_name="registry" + uuid="a53b066b-6101-405f-8ba5-b46f1c9d2b51" /> + display_name="registry-root" + uuid="0b5eb4c6-3fa7-4c92-88df-0077faa4bbc7" /> + display_name="Test Object 1" + uuid="14c5303e-19b7-4710-939d-7e7d5eeef155" /> + display_name="Test Object 2" + uuid="921bc481-cd82-4138-9791-6df2cfbbebde" /> + display_name="Test Object 3" + uuid="6ad52a5f-31a1-4686-affc-c36741e7e949" /> \ No newline at end of file diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml index be22757e5..d2fd17b76 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml @@ -1,7 +1,10 @@ ccm_core.ccm_objects: - object_id: -10 display_name: Test Object 1 + uuid: 14c5303e-19b7-4710-939d-7e7d5eeef155 - object_id: -20 display_name: Test Object 2 + uuid: 921bc481-cd82-4138-9791-6df2cfbbebde - object_id: -30 - display_name: Test Object 3 \ No newline at end of file + display_name: Test Object 3 + uuid: 6ad52a5f-31a1-4686-affc-c36741e7e949 \ No newline at end of file diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-copy.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-copy.yml index 824a8b503..bd2eaccf1 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-copy.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-copy.yml @@ -6,10 +6,13 @@ ccm_core.ccm_roles: ccm_core.ccm_objects: - object_id: -20001 display_name: object1 + uuid: 17239bc1-5db3-4448-b37c-cac0fddd7342 - object_id: -20002 display_name: object2 + uuid: 686a5d09-36ec-46ba-9c97-a5d6db4b9008 - object_id: -20003 display_name: object3 + uuid: 1c31700a-f9db-4188-812f-12dba4186c75 ccm_core.permissions: - permission_id: -30001 granted_privilege: privilege1 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-grant.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-grant.yml index 6ef94b200..d07791b22 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-grant.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-grant.yml @@ -6,10 +6,13 @@ ccm_core.ccm_roles: ccm_core.ccm_objects: - object_id: -20001 display_name: object1 + uuid: 17239bc1-5db3-4448-b37c-cac0fddd7342 - object_id: -20002 display_name: object2 + uuid: 686a5d09-36ec-46ba-9c97-a5d6db4b9008 - object_id: -20003 display_name: object3 + uuid: 1c31700a-f9db-4188-812f-12dba4186c75 ccm_core.permissions: - permission_id: -30001 granted_privilege: privilege1 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-revoke.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-revoke.yml index ba6d1b312..f9021f1ff 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-revoke.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/after-revoke.yml @@ -6,10 +6,13 @@ ccm_core.ccm_roles: ccm_core.ccm_objects: - object_id: -20001 display_name: object1 + uuid: 17239bc1-5db3-4448-b37c-cac0fddd7342 - object_id: -20002 display_name: object2 + uuid: 686a5d09-36ec-46ba-9c97-a5d6db4b9008 - object_id: -20003 display_name: object3 + uuid: 1c31700a-f9db-4188-812f-12dba4186c75 ccm_core.permissions: - permission_id: -30003 granted_privilege: privilege2 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/data.yml index b14c08a6a..6320a0401 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/PermissionManagerTest/data.yml @@ -6,10 +6,13 @@ ccm_core.ccm_roles: ccm_core.ccm_objects: - object_id: -20001 display_name: object1 + uuid: 17239bc1-5db3-4448-b37c-cac0fddd7342 - object_id: -20002 display_name: object2 + uuid: 686a5d09-36ec-46ba-9c97-a5d6db4b9008 - object_id: -20003 display_name: object3 + uuid: 1c31700a-f9db-4188-812f-12dba4186c75 ccm_core.permissions: - permission_id: -30001 granted_privilege: privilege1 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/ShiroTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/ShiroTest/data.yml index 348d0bca9..41af26026 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/ShiroTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/ShiroTest/data.yml @@ -111,24 +111,34 @@ ccm_core.role_memberships: ccm_core.ccm_objects: - object_id: -100 display_name: registry + uuid: ab0688be-5b4c-479b-a2a3-3919181bc1ff - object_id: -200 display_name: registry-root + uuid: 281570ba-b6b6-4d32-a018-5ab6ad0e6200 - object_id: -201 display_name: com + uuid: babf3f56-2119-4521-b6af-d6c3e88fd96e - object_id: -202 display_name: arsdigita + uuid: f9aac564-bf4f-4a66-8382-3562ce3c8717 - object_id: -203 display_name: kernel + uuid: 5d017f89-b5ea-4381-9bb7-0bc72b5289a9 - object_id: -204 display_name: KernelConfig + uuid: 8dfd244f-d74b-493f-8254-62df65ebef35 - object_id: -20001 display_name: object1 + uuid: d05fb5f0-7b66-470d-b4f7-d14f4d08d4b6 - object_id: -20002 display_name: object2 + uuid: bec86ea9-7d28-4faf-992d-0f880dbbd3ea - object_id: -20003 display_name: object3 + uuid: 142041c0-163f-4359-931a-1faf465ee564 - object_id: -301 display_name: screenName + uuid: 56e14b70-8025-4f1d-a16d-a5ac34658f92 ccm_core.permissions: # permission for privilege1 granted to role1 - permission_id: -30001 diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/security/UserManagerTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/security/UserManagerTest/data.yml index 732fe8f0c..b567ef1d1 100644 --- a/ccm-core/src/test/resources/datasets/org/libreccm/security/UserManagerTest/data.yml +++ b/ccm-core/src/test/resources/datasets/org/libreccm/security/UserManagerTest/data.yml @@ -44,16 +44,22 @@ ccm_core.users: ccm_core.ccm_objects: - object_id: -100 display_name: registry + uuid: d6186227-7c90-42e6-a5d0-ca274b622df7 - object_id: -200 display_name: registry-root + uuid: c4a64ce4-242a-443a-b5bd-e84d34203e3a - object_id: -201 display_name: com + uuid: 8388e1e3-5878-464a-a9fe-95e95c9331a6 - object_id: -202 display_name: arsdigita + uuid: b2ba60a1-34a0-459e-b6d2-d1be04c0bf3f - object_id: -203 display_name: kernel + uuid: bcba7ad2-22a1-4c94-a5f1-aefc25091038 - object_id: -204 display_name: KernelConfig + uuid: 5643aea7-0abb-4060-bf3d-7365e2a02757 ccm_core.categories: - object_id: -200 unique_id: bb93a964-bf66-424c-a22d-074d001db3b8 diff --git a/pom.xml b/pom.xml index 61e0a2d66..9058c1bde 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,8 @@ - + 4.0.0 @@ -270,6 +273,12 @@ shiro-core 1.2.4 + + org.apache.shiro + shiro-web + 1.2.4 + +