Fix only record owners can access workflow status API #8667
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.
/{metadataUuid}/status/workflow/last
APICurrently, only the record owner can call the workflow status
/{metadataUuid}/status/workflow/last
API for a given record. This means that ifuser1
creates a record and grants edit privileges togroupA
, editors ingroupA
will not be able to check the workflow status, even though they have edit access.This behavior is inconsistent with the UI logic and does not consider the
metadata/history/accesslevel
setting.This PR aims to fix this issue by changing the API permission check to be consistent with the
metadata/history/accesslevel
setting. After this fix whenmetadata/history/accesslevel
is set to:/status/search
APIThe
/status/search
API was updated to do some checks when themetadata/history/accesslevel
was implemented in #7450 but the logic doesn't actually check that the user has the required profile.The profile is only used to determine if the user needs view privileges (RegisteredUser) or edit privileges (Editor or Administrator). This means that with
metadata/history/accesslevel
set to administrator an editor can see the history as long as they have edit privileges on the record.As I implemented updated logic to actually check the profile in the
/{metadataUuid}/status/workflow/last
API I have brought similar logic into the/status/search
API.Messages
Messages have been replaced with message keys to support multilingual translations, and the original message about record ownership has been removed since it is no longer used.
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentation