Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection permissions check #463

Merged
merged 18 commits into from
Sep 5, 2024
Merged

Conversation

g-saracca
Copy link
Contributor

@g-saracca g-saracca commented Aug 16, 2024

What this PR does / why we need it:

  • Checks user permissions to create a Collection & create a Dataset on a specific collection, if the user doesn't have permissions neither to create a collection or a dataset, the Add Data dropdown inside the Collection page will not appear; if it has permissions to create a collection or dataset it will be visible with the proper buttons enabled or disabled in it.
  • Checks user permissions to create a Collection inside the Create Collection page.
  • Checks user permissions to create a Dataset inside the Create Dataset page.
  • Check user permissions on the root collection to enable or disabled buttons inside the Add Data drop-down located in the application header.

Which issue(s) this PR closes:

Closes #434

Special notes for your reviewer:
I have also changed the alias 'root' used in several components for an exported constant, to avoid mistakes and improve reusability, as it is done in js-dataverse.

Suggestions on how to test this:

  1. Create a Collection and a Dataset in the JSF version with User A, publish both Collection and Dataset.
  2. With User A, Navigate to that collection and check that you are able to see the Add Data dropdown with both the New Collection and New Dataset buttons enabled in it, click on both buttons and check that you can successfully the create dataset form and the create collection form.
  3. Create another user "B" in the JSF version.
  4. Navigate in the SPA to the Collection created from user A, and the Add Data dropdown shouldn't be visible.
  5. Log in with user "A" and navigate to the created Collection in JSF, click Edit => Permissions, go to Users Groups and assign roles to user "B" as Dataset Creator to be able to add datasets to that Collection.
  6. Log in with user "B" and navigate to that collection in the SPA and check that in the Add Data dropdown you have only the New Dataset button enabled.
  7. Log out from user B, Log in with user A and navigate again to that Collection and assign a different role (Curator for example), so user B will be able to Add Dataset and Add Collection.
  8. Again log in with user A and navigate to that collection in the SPA and check that in the Add Data dropdown you have both the New Collecction and the New Dataset buttons enabled.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Screenshot 2024-08-16 at 15 56 54
Screenshot 2024-08-16 at 15 56 30

Is there a release notes update needed for this change?:
No

Additional documentation:
No

@g-saracca g-saracca marked this pull request as ready for review August 16, 2024 19:03
@coveralls
Copy link

coveralls commented Aug 16, 2024

Coverage Status

coverage: 97.44% (+0.03%) from 97.406%
when pulling 43aad32 on feat/434-collection-permission-check
into 08511d7 on develop.

@g-saracca g-saracca self-assigned this Aug 22, 2024
@g-saracca g-saracca removed their assignment Aug 23, 2024
@g-saracca
Copy link
Contributor Author

g-saracca commented Aug 23, 2024

Ready for Review again, some e2e tests for the FileRepository were failing randomly, there is an open issue for that already.

@cmbz cmbz added the FY25 Sprint 5 FY25 sprint 5 label Aug 28, 2024
@ekraffmiller ekraffmiller self-assigned this Aug 30, 2024
Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

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

Looks good! Just some small suggested changes

…sButton.spec.tsx

Co-authored-by: Ellen Kraffmiller <ekraffmiller@hmdc.harvard.edu>
g-saracca and others added 3 commits September 3, 2024 14:38
…pec.ts

Co-authored-by: Ellen Kraffmiller <ekraffmiller@hmdc.harvard.edu>
…pec.ts

Co-authored-by: Ellen Kraffmiller <ekraffmiller@hmdc.harvard.edu>
@g-saracca
Copy link
Contributor Author

@ekraffmiller thanks! all changes done

@g-saracca g-saracca removed their assignment Sep 3, 2024
ekraffmiller
ekraffmiller previously approved these changes Sep 3, 2024
Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

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

looks good, approved!

@GPortas GPortas self-assigned this Sep 4, 2024
@g-saracca
Copy link
Contributor Author

Merge conflicts solved

Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

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

I have tested the permissions flow and works as expected.

Merging!

@GPortas GPortas merged commit dc857c3 into develop Sep 5, 2024
11 of 14 checks passed
@GPortas GPortas deleted the feat/434-collection-permission-check branch September 5, 2024 14:42
@GPortas GPortas added SPA.Q3 Not related to any specific Q3 feature Original size: 3 labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 4 FY25 Sprint 4 FY25 Sprint 5 FY25 sprint 5 GREI Re-arch GREI re-architecture-related Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA: Collection Page SPA: Create Dataset Form SPA: New Collection Page SPA: Permissions SPA.Q3 Not related to any specific Q3 feature
Projects
Status: Done 🧹
Development

Successfully merging this pull request may close these issues.

Collection and New Collection Page Permissions Check
5 participants