Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@YanaDePauw
Copy link
Contributor

@YanaDePauw YanaDePauw commented Nov 10, 2023

References

Description

The DSpace code currently does not enforce that a created resource policy has either a connected group or eperson.
As a consequence, it can happen that a resource policy is created with neither.

This will then cause issues down the line where DSpace assumes that all resource policies have either a group or eperson connected to it.

Instructions for Reviewers

Verify that it is no longer possible to create a resource policy without a group or eperson.

Checklist

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@tdonohue
Copy link
Member

@YanaDePauw : This is currently failing tests & appears to have compilation errors. I suspect the new code refactors have not been applied everywhere in the codebase

@tdonohue tdonohue added bug port to main This PR needs to be ported to `main` branch for the next major release authorization Related to user authorization / permissions labels Nov 10, 2023
@tdonohue tdonohue linked an issue Nov 10, 2023 that may be closed by this pull request
@YanaDePauw
Copy link
Contributor Author

@tdonohue Is it possible that there is some caching happening for the code? The reported compile issue does not actually occur in the code. Furthermore the forked branch does not seem to have this issue.

@tdonohue
Copy link
Member

tdonohue commented Nov 10, 2023

@YanaDePauw : I don't believe we have any code caching. However, it is possible the branch this PR is based on is now slightly outdated. We've merged a lot of code changes in the last 48 hours as we are heading into the 7.6.1 release next week. So, when CI runs this PR, it might be trying to run it against the latest code on dspace-7_x branch, and encountering errors in doing so.

So, the build failures here might be a sign of a "code conflict" between this PR and some recent change on dspace-7_x. I won't have time to debug it further until I'm done reviewing PRs for 7.6.1, but that's my best guess.

UPDATE: In case the details above aren't clear...the best solution would be to try to rebase this PR against the latest code on dspace-7_x. Then try to rebuild it locally. I suspect you'll start seeing the same failures locally in that scenario (but I could be wrong)

@YanaDePauw
Copy link
Contributor Author

@tdonohue There was indeed an issue with a test that was added on dspace-7_x branch. The issue is fixed now.

@tdonohue tdonohue self-requested a review February 15, 2024 15:52
@tdonohue
Copy link
Member

@YanaDePauw : Thanks for the update! One quick question about this PR:

I notice there's no script to cleanup existing resources policies that have no group or eperson. Should that be part of the new Flyway migration here? Otherwise, I'm worried this change may cause sites to throw errors if they have these invalid policies in their databases.

@YanaDePauw
Copy link
Contributor Author

@tdonohue I added a line to the sql file to remove any faulty resource policies

@kshepherd
Copy link
Member

kshepherd commented Feb 26, 2024

@YanaDePauw is there a main port of this work yet? (at 43 changed files i am thinking it might not be super straightforward)

@tdonohue
Copy link
Member

@YanaDePauw : Would you have time to update this based on the latest code on dspace-7_x and also create a PR port for main?

I tried to install this into main and it doesn't work (lots of code conflicts). Ideally, we'd try to get this into 8.0 & 7.6.x, but this is currently difficult to test as there's no way to easily verify behavior on main as well.

@YanaDePauw
Copy link
Contributor Author

@tdonohue I'll look into this, this week.

…force-resource-policies-to-have-group-or-eperson
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.

👍 Verified this is identical to #9502 (8.x version) and tested this on 8.x. This is ready to merge as soon as #9502 is cleaned up (see comments on that PR)

@tdonohue tdonohue added this to the 7.6.2 milestone Apr 30, 2024
@tdonohue tdonohue removed the port to main This PR needs to be ported to `main` branch for the next major release label Apr 30, 2024
@tdonohue tdonohue changed the title Enforce resource policies to have group or eperson [Port to dspace-7_x] Enforce resource policies to have group or eperson Apr 30, 2024
@github-actions github-actions bot added the merge conflict PR has a merge conflict that needs resolution label May 1, 2024
@github-actions
Copy link

github-actions bot commented May 1, 2024

Hi @YanaDePauw,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

…force-resource-policies-to-have-group-or-eperson
@github-actions github-actions bot removed the merge conflict PR has a merge conflict that needs resolution label May 3, 2024
@tdonohue tdonohue merged commit 5b89eff into DSpace:dspace-7_x May 3, 2024
milanmajchrak pushed a commit to dataquest-dev/DSpace that referenced this pull request Feb 12, 2025
…e-policies-to-have-group-or-eperson

[Port to dspace-7_x] Enforce resource policies to have group or eperson
milanmajchrak added a commit to dataquest-dev/DSpace that referenced this pull request Feb 14, 2025
* Sync a few dependency exclusions from dspace-8_x to dspace-7_x to fix convergence issues

* Merge pull request DSpace#10306 from DSpace/dependabot/maven/dspace-7_x/net.minidev-json-smart-2.5.1

Bump net.minidev:json-smart from 2.5.0 to 2.5.1

* Merge pull request DSpace#9520 from DSpace/backport-9296-to-dspace-7_x

[Port dspace-7_x] Fix resource policy type not set for bitstreams when importing items

* Added removed resource policies when adding bitstreams in the AbstractMETSIngester

* Merge pull request DSpace#9596 from paulo-graca/bugfixes/issue-7464

Fixing issue DSpace#7464 for DSpace 7

* Merge pull request DSpace#9191 from atmire/w2p-106812_enforce-resource-policies-to-have-group-or-eperson

[Port to dspace-7_x] Enforce resource policies to have group or eperson

* Fixed Tests following the Resource Policy refactoring

* Merge pull request DSpace#9364 from DSpace/backport-9336-to-dspace-7_x

[Port dspace-7_x] Add more SWORDv2 Integration Tests

* Added test to depositItemWithEmbargo when the user is in the submitter group

* Throw a proper exception with more info when Authorization or Crosswalk exception instead of RuntimeException.

* Update all GitHub Actions. Add newly required CODECOV_TOKEN to codecov action

* Revert unwanted change

* Removed mets-embargo.xml because it is not used

---------

Co-authored-by: Tim Donohue <[email protected]>
milanmajchrak added a commit to dataquest-dev/DSpace that referenced this pull request Feb 14, 2025
* Sync a few dependency exclusions from dspace-8_x to dspace-7_x to fix convergence issues

* Merge pull request DSpace#10306 from DSpace/dependabot/maven/dspace-7_x/net.minidev-json-smart-2.5.1

Bump net.minidev:json-smart from 2.5.0 to 2.5.1

* Merge pull request DSpace#9520 from DSpace/backport-9296-to-dspace-7_x

[Port dspace-7_x] Fix resource policy type not set for bitstreams when importing items

* Added removed resource policies when adding bitstreams in the AbstractMETSIngester

* Merge pull request DSpace#9596 from paulo-graca/bugfixes/issue-7464

Fixing issue DSpace#7464 for DSpace 7

* Merge pull request DSpace#9191 from atmire/w2p-106812_enforce-resource-policies-to-have-group-or-eperson

[Port to dspace-7_x] Enforce resource policies to have group or eperson

* Fixed Tests following the Resource Policy refactoring

* Merge pull request DSpace#9364 from DSpace/backport-9336-to-dspace-7_x

[Port dspace-7_x] Add more SWORDv2 Integration Tests

* Added test to depositItemWithEmbargo when the user is in the submitter group

* Throw a proper exception with more info when Authorization or Crosswalk exception instead of RuntimeException.

* Update all GitHub Actions. Add newly required CODECOV_TOKEN to codecov action

* Revert unwanted change

* Removed mets-embargo.xml because it is not used

---------

Co-authored-by: Tim Donohue <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authorization Related to user authorization / permissions bug

Projects

Development

Successfully merging this pull request may close these issues.

Resource policies with null groups and eperson

3 participants