-
Notifications
You must be signed in to change notification settings - Fork 451
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
pkp/pkp-lib#10571 limit email template access by user groups #10581
Closed
taslangraham
wants to merge
17
commits into
pkp:main
from
taslangraham:i10571_limit_template_access_by_sender_and_receiver_role
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
45a86ac
pkp/pkp-lib#10571 WIP: Add checks to limit email template access by u…
taslangraham f702945
pkp/pkp-lib#10571 WIP: Allow admins and managers to assign user group…
taslangraham ced55fc
pkp/pkp-lib#10571 WIP: add support for unrestricted templates
taslangraham 13fdaf2
pkp/pkp-lib#10571 Convert queries to eloquent
taslangraham 7ba258c
Update migration logic
taslangraham 7b9785c
pkp/pkp-lib#10571 Update emailTemplate schema
taslangraham 5411845
pkp/pkp-lib#10571 Update locales
taslangraham 0f4d4f5
Added back accidentally deleted migration and fix errors
taslangraham de58aab
pkp/pkp-lib#10571 Move migration into v3.6 folder
taslangraham 362d0be
pkp/pkp-lib#10571 add additional access checks
taslangraham c4fe1b7
pkp/pkp-lib#10571 Add migration to install process
taslangraham 20aaeaa
pkp/pkp-lib#10571 Make default templates unrestricted on Context crea…
taslangraham 7b1fae9
pkp/pkp-lib#10571 Make templates assignable to all user groups
taslangraham cf5219a
pkp/pkp-lib#10571 Allow restriction to be set during template install…
taslangraham 2ae5004
Code cleanup
taslangraham 80068ac
pkp/pkp-lib#10571 Update access on template deletion and template res…
taslangraham d2e9586
pkp/pkp-lib#10571 Remove unnecessary email form components and clean …
taslangraham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
ewhanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @file classes/emailTemplate/EmailTemplateAccessGroup.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class EmailTemplateAccessGroup | ||
* | ||
* @ingroup emailTemplate | ||
* | ||
* @brief Eloquent model for email template user group access | ||
*/ | ||
|
||
namespace PKP\emailTemplate; | ||
|
||
use Eloquence\Behaviours\HasCamelCasing; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class EmailTemplateAccessGroup extends Model | ||
{ | ||
use HasCamelCasing; | ||
|
||
public $timestamps = false; | ||
protected $primaryKey = 'email_template_user_group_access_id'; | ||
protected $table = 'email_template_user_group_access'; | ||
protected $fillable = ['userGroupId', 'contextId', 'emailKey']; | ||
|
||
|
||
/** | ||
* Scope a query to only include email template access records for email templates with specific keys. | ||
*/ | ||
public function scopeWithEmailKey(Builder $query, ?array $keys): Builder | ||
ewhanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return $query->when(!empty($keys), function ($query) use ($keys) { | ||
return $query->whereIn('email_key', $keys); | ||
}); | ||
} | ||
|
||
/** | ||
* Scope a query to only include email template access records that are related to a specific context ID. | ||
*/ | ||
public function scopeWithContextId(Builder $query, int $contextId): Builder | ||
{ | ||
return $query->where('context_id', $contextId); | ||
} | ||
|
||
/** | ||
* Scope a query to only include email template access records for specific user group IDs. | ||
*/ | ||
public function scopeWithGroupIds(Builder $query, array $ids): Builder | ||
{ | ||
return $query->whereIn('user_group_id', $ids); | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mention this directly below, but I don't think this optional parameter will be necessary. I think the assumption of "unrestricted if no additional data provided" below is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, we talked about it and decided to keep thing
$recordTemplateGroupAccess
parameter as described here to avoid any issues as part of the upgrade process.