[Port dspace-8_x] Fix for #8916 #8917 #8918 to 8.x: The Community Administrator should not be able to view all communities/collections in the create/edit community and collection sections (Previous PR #9814 #4639)#4724
Merged
tdonohue merged 1 commit intoDSpace:dspace-8_xfrom Oct 2, 2025
Conversation
tdonohue
approved these changes
Oct 2, 2025
Member
tdonohue
left a comment
There was a problem hiding this comment.
👍 Thanks @im-shubham-vish ! I finally had time today to test this against an 8.x instance of DSpace. I can verify it works. Also checked the code is the same as in #4639.
Contributor
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-4724-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-4724-to-dspace-7_x
git switch --create backport-4724-to-dspace-7_x
git cherry-pick -x 7d0379283d75ed9cf277ca66ebba340dcc22abce |
Member
|
@im-shubham-vish : Unfortunately, it looks like this wasn't possible to port automatically to |
10 tasks
Member
|
Backported to 7.x in #5123 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
Description
The Community Administrator should not be able to view all communities/collections in the create/edit community and collection sections.
This PR backports the fix to dspace-8_x and includes minor adjustments required for Angular 8.x compatibility.
Additional Backport Changes
• Replaced if structural checks with *ngIf in template files.
• Imported CommonModule into authorized-community-selector.component.ts to support Angular 8.x templates.
Instructions for Reviewers
Currently, users can see all communities/collections in the create/edit community and collection sections. However, the expected behaviour is that only the communities/collections where the user is a community or collection admin should be displayed.
List of changes in this PR:
• Added new method getAuthorizedCommunity in community-data.service.ts to get all communities for the user is authorized to.
• Added authorized-community-selector.component.ts wrapper to show the autocomplete results in community edit section instead of using common DSpace Object selector.
• Updated create-collection-parent-selector.component.ts, create-community-parent-selector.component.ts, edit-community-selector.component.ts to get authorized communities list at the time of new collection & community creation.
• Updated edit-collection-selector.component.ts to list out already existing collections in which the user authorized to inside edit collection module.
• Updated src/themes/.../create-community-parent-selector.component.ts to list already existing authorized communities.
• Updated wrapper dso selector create-community-parent-selector.component.html to select authorized communities only inside the create community module.
• Added create-collection-parent-selector.component.html, edit-community-selector.component.html, edit-collection-selector.component.html to select authorized parent communities & collections only inside the create and edit community & collection module.
• Added authorized-community-selector.component.spec.ts against the new dso selector wrapper added to test the listing of all authorized communities and collections in edit and create section.
• Updated create-community-parent-selector.component.spec.ts, edit-community-selector.component.spec.ts, create-collection-parent-selector.component.spec.ts, edit-collection-selector.component.spec.ts to test the listing of all authorized communities & collections inside edit & create community and collection module.
How to Test
o Go to Edit > click “Community”. Again, only the communities where the user is an admin should be shown.
o For collections, go to Edit > click “Collection”. Only the collections where the user is a collection or community admin should be listed. If the user is a community admin for a community, all collections within that community should also be shown.
Bug Reproduction Steps
o Log in as a community admin, go to New > Community. Currently, all communities are shown in the list.
o Similarly, for collections, go to the New section > click Collection. Here, all collections are shown in the list.
o Log in as a community admin, go to Edit > Community. Currently, all communities are shown in the list.
o Similarly, for collections, go to Edit > click Collection. Here, all collections are shown in the list.