mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
[CSTPER-221] Fixed Authorization denied during subCommunity creation
We need to persist the newCommunity before adding the handle metadata value. The failing test was * CommunityRestRepositoryIT.createSubCommunityAuthorizedTest
This commit is contained in:
@@ -94,17 +94,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
|
|
||||||
Community newCommunity = communityDAO.create(context, new Community());
|
Community newCommunity = communityDAO.create(context, new Community());
|
||||||
|
|
||||||
try {
|
|
||||||
if (handle == null) {
|
|
||||||
identifierService.register(context, newCommunity);
|
|
||||||
} else {
|
|
||||||
identifierService.register(context, newCommunity, handle);
|
|
||||||
}
|
|
||||||
} catch (IllegalStateException | IdentifierException ex) {
|
|
||||||
throw new IllegalStateException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.addSubCommunity(newCommunity);
|
parent.addSubCommunity(newCommunity);
|
||||||
newCommunity.addParentCommunity(parent);
|
newCommunity.addParentCommunity(parent);
|
||||||
@@ -129,6 +118,16 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
getIdentifiers(context, newCommunity)));
|
getIdentifiers(context, newCommunity)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (handle == null) {
|
||||||
|
identifierService.register(context, newCommunity);
|
||||||
|
} else {
|
||||||
|
identifierService.register(context, newCommunity, handle);
|
||||||
|
}
|
||||||
|
} catch (IllegalStateException | IdentifierException ex) {
|
||||||
|
throw new IllegalStateException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
log.info(LogManager.getHeader(context, "create_community",
|
log.info(LogManager.getHeader(context, "create_community",
|
||||||
"community_id=" + newCommunity.getID())
|
"community_id=" + newCommunity.getID())
|
||||||
+ ",handle=" + newCommunity.getHandle());
|
+ ",handle=" + newCommunity.getHandle());
|
||||||
|
Reference in New Issue
Block a user