Skip to content

Conversation

@im-shubham-vish
Copy link
Contributor

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

  1. Make a user the admin of a few communities.
  2. Navigate to the “New” section and click on "Community" or “Collection”. Only the communities where the user is community admin should be displayed.
  3. For the Edit section:
    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

  1. New Section:
    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.
  2. Edit Section:
    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.

@tdonohue tdonohue added bug component: Discovery related to discovery search or browse system authorization related to authorization, permissions or groups usability labels Sep 22, 2025
@tdonohue tdonohue self-requested a review September 22, 2025 15:44
@tdonohue tdonohue moved this to 👍 Reviewer Approved in DSpace Maintenance (9.x, 8.x, 7.6.x) Sep 22, 2025
@tdonohue tdonohue changed the title Backport 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) [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) Oct 2, 2025
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 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.

@tdonohue tdonohue added the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Oct 2, 2025
@tdonohue tdonohue merged commit 01cc3ab into DSpace:dspace-8_x Oct 2, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace Maintenance (9.x, 8.x, 7.6.x) Oct 2, 2025
@dspace-bot
Copy link
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

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

@tdonohue
Copy link
Member

tdonohue commented Oct 2, 2025

@im-shubham-vish : Unfortunately, it looks like this wasn't possible to port automatically to dspace-7_x. So, we'll need another manual port. Sorry, sometimes changes that touch many files at once can fail automatic backports.

@tdonohue tdonohue added this to the 8.3 milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authorization related to authorization, permissions or groups bug component: Discovery related to discovery search or browse system port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release usability

Projects

Development

Successfully merging this pull request may close these issues.

3 participants