#196 Set any user's permission group to 'Custom' if the template was changed
This commit is contained in:
parent
53e7031117
commit
c21b5f24bb
@ -324,6 +324,11 @@ function buildCreateModal($features, $categories) {
|
|||||||
function save() {
|
function save() {
|
||||||
global $hesk_settings, $hesklang;
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
|
$templateId = hesk_POST('template_id');
|
||||||
|
$res = hesk_dbQuery("SELECT `heskprivileges`, `categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates`
|
||||||
|
WHERE `id` = ".intval($templateId));
|
||||||
|
$row = hesk_dbFetchAssoc($res);
|
||||||
|
|
||||||
// Add 'can ban emails' if 'can unban emails' is set (but not added). Same with 'can ban ips'
|
// Add 'can ban emails' if 'can unban emails' is set (but not added). Same with 'can ban ips'
|
||||||
$catArray = hesk_POST_array('categories');
|
$catArray = hesk_POST_array('categories');
|
||||||
$featArray = hesk_POST_array('features');
|
$featArray = hesk_POST_array('features');
|
||||||
@ -336,7 +341,6 @@ function save() {
|
|||||||
}
|
}
|
||||||
$categories = implode(',', $catArray);
|
$categories = implode(',', $catArray);
|
||||||
$features = implode(',', $featArray);
|
$features = implode(',', $featArray);
|
||||||
$templateId = hesk_POST('template_id');
|
|
||||||
$name = hesk_POST('name');
|
$name = hesk_POST('name');
|
||||||
|
|
||||||
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates`
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates`
|
||||||
@ -344,6 +348,12 @@ function save() {
|
|||||||
`name` = '".hesk_dbEscape($name)."'
|
`name` = '".hesk_dbEscape($name)."'
|
||||||
WHERE `id` = ".intval($templateId));
|
WHERE `id` = ".intval($templateId));
|
||||||
|
|
||||||
|
if ($row['categories'] != $categories || $row['heskprivileges'] != $features) {
|
||||||
|
// Any users with this template should be switched to "custom"
|
||||||
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` SET `permission_template` = NULL
|
||||||
|
WHERE `permission_template` = ".intval($templateId));
|
||||||
|
}
|
||||||
|
|
||||||
hesk_process_messages( $hesklang['permission_template_updated'],$_SERVER['PHP_SELF'],'SUCCESS');
|
hesk_process_messages( $hesklang['permission_template_updated'],$_SERVER['PHP_SELF'],'SUCCESS');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user