-
Notifications
You must be signed in to change notification settings - Fork 447
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
base: main
Are you sure you want to change the base?
pkp/pkp-lib#10571 limit email template access by user groups #10581
Conversation
0352bec
to
ba47e2b
Compare
3cb222d
to
cf0580b
Compare
8b6f076
to
75b9ed1
Compare
…il templates within a mailable
75b9ed1
to
405e376
Compare
->getMany() | ||
->getMany(); | ||
|
||
$templates = Repo::emailTemplate() |
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.
This $templates
variable is directly replacing the one above. Is that what you meant to do? If so, the above one should be removed.
$emailTemplates->add($emailTemplate); | ||
} | ||
Repo::emailTemplate() | ||
->getCollector($context->getId()) | ||
->alternateTo([$this->mailable::getEmailTemplateKey()]) | ||
->getMany() | ||
->each(fn (EmailTemplate $e) => $emailTemplates->add($e)); | ||
->each(function (EmailTemplate $e) use ($context, $request, $emailTemplates) { |
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.
Just a suggestion, but since this isn't an arrow function anymore, I would be more verbose about the variable name, just to make it easier to read at a glance.
}, | ||
"assignableTemplateUserGroups": { | ||
"type": "array", | ||
"description": "List of User Groups that can be assigned to the template", |
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.
Period at the end.
}, | ||
"isUnrestricted": { | ||
"type": "boolean", | ||
"description": "Boolean indicating if an email template is available to all user groups within the roles associated with the template's mailable.", |
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.
Extra space between indicating
and if
.
"type": "integer", | ||
"apiSummary": true | ||
}, | ||
"name": { |
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'm not sure if the individual items support descriptions off the top of my head, but the name being an integer is a little confusing. Assuming this is correct, a description would be helpful to understand what the number is supposed to represent in terms of the name.
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.
That's an error on my part. It should be a string.
@@ -46,6 +48,14 @@ public function __construct(string $action, array $locales) | |||
'isMultilingual' => true, | |||
'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist', | |||
'plugins' => 'paste,link,lists', | |||
]))->addField(new FieldEmailTemplateUnrestricted('isUnrestricted', [ |
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 think a lot more of the setup logic for the Vue components can be done in PHP so that these can both be done with existing FieldOptions
components. I mentioned this in the ui-library
PR as well and we can chat about it more in our next one-on-one (probably easier to share screen and code together than writing it all out here).
* | ||
*/ | ||
public function installEmailTemplates( | ||
string $templatesFile, | ||
array $locales = [], | ||
?string $emailKey = null, | ||
bool $skipExisting = false | ||
bool $skipExisting = false, | ||
$recordTemplateGroupAccess = false |
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.
@@ -0,0 +1,34 @@ | |||
<?php |
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.
Needs file docblock.
@@ -0,0 +1,74 @@ | |||
<?php |
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.
Needs file docblock.
/** | ||
* @file classes/migration/upgrade/v3_5_0/PreflightCheckMigration.php | ||
* | ||
* Copyright (c) 2014-2021 Simon Fraser University |
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.
Should be 2024 here and below.
For #10571