pkp/pkp-lib#10431 Hooks in policy to relax author file upload#12390
Open
touhidurabir wants to merge 3 commits intopkp:mainfrom
Open
pkp/pkp-lib#10431 Hooks in policy to relax author file upload#12390touhidurabir wants to merge 3 commits intopkp:mainfrom
touhidurabir wants to merge 3 commits intopkp:mainfrom
Conversation
5 tasks
5fc7bc2 to
95be35b
Compare
asmecher
requested changes
Mar 19, 2026
Member
asmecher
left a comment
There was a problem hiding this comment.
Just a few minor changes here.
| } | ||
|
|
||
| // Give plugin a chance to override the submission file stage access policy | ||
| Hook::run('SubmissionFileStageAccessPolicy::effect', [$submission, $userRoles, $stageAssignments, $this->_fileStage, $this->_action, &$assignedFileStages]); |
Member
There was a problem hiding this comment.
I prefer named parameters for new hooks:
Suggested change
| Hook::run('SubmissionFileStageAccessPolicy::effect', [$submission, $userRoles, $stageAssignments, $this->_fileStage, $this->_action, &$assignedFileStages]); | |
| Hook::run('SubmissionFileStageAccessPolicy::effect', ['submission' => $submission, 'userRoles' => $userRoles, 'stageAssignments' => $stageAssignments, 'fileStage' => $this->_fileStage, 'action' => $this->_action, 'assignedFileStages' => &$assignedFileStages]); |
This makes for a lot less ambiguity in the hook callback functions, which would otherwise depend on function orders to know what parameters are being passed.
| /** | ||
| * @see AuthorizationPolicy::effect() | ||
| * | ||
| * @hook SubmissionFileStageAccessPolicy::effect [[$submission, $userRoles, $stageAssignments, $this->_fileStage, $this->_action, &$assignedFileStages]] |
Member
There was a problem hiding this comment.
I think this is incorrect, now that you're using Hook::run instead of Hook::call.
Suggested change
| * @hook SubmissionFileStageAccessPolicy::effect [[$submission, $userRoles, $stageAssignments, $this->_fileStage, $this->_action, &$assignedFileStages]] | |
| * @hook SubmissionFileStageAccessPolicy::effect [$submission, $userRoles, $stageAssignments, $this->_fileStage, $this->_action, &$assignedFileStages] |
| * @param int $submissionFileId | ||
| * @param string $submissionParameterName | ||
| * | ||
| * @hook SubmissionFileAccessPolicy::authorFileAccess [[$request, $mode, $submissionFileId, &$authorFileAccessOptionsPolicy]] |
Member
There was a problem hiding this comment.
As above
Suggested change
| * @hook SubmissionFileAccessPolicy::authorFileAccess [[$request, $mode, $submissionFileId, &$authorFileAccessOptionsPolicy]] | |
| * @hook SubmissionFileAccessPolicy::authorFileAccess [$request, $mode, $submissionFileId, &$authorFileAccessOptionsPolicy] |
| } | ||
|
|
||
| // Give plugin a chance to modify/add policies for author to access | ||
| Hook::run('SubmissionFileAccessPolicy::authorFileAccess', [$request, $mode, $submissionFileId, &$authorFileAccessOptionsPolicy]); |
Member
There was a problem hiding this comment.
As above
Suggested change
| Hook::run('SubmissionFileAccessPolicy::authorFileAccess', [$request, $mode, $submissionFileId, &$authorFileAccessOptionsPolicy]); | |
| Hook::run('SubmissionFileAccessPolicy::authorFileAccess', ['request' => $request, 'mode' => $mode, 'submissionFileId' => $submissionFileId, 'authorFileAccessOptionsPolicy' => &$authorFileAccessOptionsPolicy]); |
5268247 to
de00235
Compare
de00235 to
966ee63
Compare
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.
for #10431 .