mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 19:43:10 +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());
|
||||
|
||||
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) {
|
||||
parent.addSubCommunity(newCommunity);
|
||||
newCommunity.addParentCommunity(parent);
|
||||
@@ -129,6 +118,16 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
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",
|
||||
"community_id=" + newCommunity.getID())
|
||||
+ ",handle=" + newCommunity.getHandle());
|
||||
|
Reference in New Issue
Block a user