-
Notifications
You must be signed in to change notification settings - Fork 0
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
email events for deputies #68
Comments
kind of confusing. heres what i've done. function tripal_hq_get_curator_emails($submission_id) {
$mail = [];
$query = db_select('tripal_hq_submission_permission', 'thsp');
$query->join('tripal_hq_permissions', 'thp', 'thp.id = thsp.hq_permission_id');
$query->condition('thsp.submission_id', $submission_id);
$query->join('users', 'u', 'u.uid = thp.uid');
$query->fields('u', ['mail']);
$deputies = $query->execute()->fetchAll();
// If specific permissions are set, only notify those in charge of it.
if (!empty($deputies)){
foreach ($deputies as $deputy) {
$mail[] = $deputy->mail;
}
return implode(', ', $mail);
}
//Otherwise, get all admins with the role.
$query = db_select('users', 'u')
->fields('u', ['mail']);
$query->join('users_roles', 'ur', 'ur.uid = u.uid');
$query->join('role_permission', 'rp', 'rp.rid = ur.rid');
$query->condition('rp.permission', 'access tripal_hq admin');
$query->condition('rp.module', 'tripal_hq');
$results = $query->execute()->fetchAll();
if (!$results) {
return '';
}
foreach ($results as $result) {
$mail[] = $result->mail;
}
return implode(', ', $mail);
} first ,check if there are deputies. If so, thats who we email. Otherwise, we email everyone with the admin permission. The obvious problem is if you dont set deputies for an organism, then requests go to everyone with the admin, which includes deputies. What should happen instead is, if theres no deputies set, send it to admins who arent deputies. We can do that by doing a JOIN IS NULL on the |
like this maybe? I should do some testing before merging. |
/remind me in 24 hours |
@bradfordcondon set a reminder for Nov 20th 2018 |
|
HQ_Permissions adds chado-based deputies. The admin email config page, and the emails themselves, should take this into account and notify deputies. One way to address would be ot add a third checkbox for deputies to the config page. the other is to make deputies implied with the "admin" box.
The text was updated successfully, but these errors were encountered: