Starting on fixing permission group creation/edit abilities
This commit is contained in:
parent
71bb5af435
commit
4bd4eec53d
@ -137,11 +137,9 @@ function createEditModal($template, $features, $categories)
|
|||||||
{
|
{
|
||||||
global $hesklang;
|
global $hesklang;
|
||||||
|
|
||||||
$disabled = 'checked="checked" disabled';
|
|
||||||
$enabledFeatures = array();
|
$enabledFeatures = array();
|
||||||
$enabledCategories = array();
|
$enabledCategories = array();
|
||||||
if ($template['heskprivileges'] != 'ALL') {
|
if ($template['heskprivileges'] !== 'ALL') {
|
||||||
$disabled = '';
|
|
||||||
$enabledFeatures = explode(',', $template['heskprivileges']);
|
$enabledFeatures = explode(',', $template['heskprivileges']);
|
||||||
$enabledCategories = explode(',', $template['categories']);
|
$enabledCategories = explode(',', $template['categories']);
|
||||||
}
|
}
|
||||||
@ -157,6 +155,12 @@ function createEditModal($template, $features, $categories)
|
|||||||
<h4 class="modal-title"><?php echo sprintf($hesklang['permissions_for_group'], $template['name']); ?></h4>
|
<h4 class="modal-title"><?php echo sprintf($hesklang['permissions_for_group'], $template['name']); ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<?php if ($template['id'] == 1): ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<i class="fa fa-info-circle"></i>
|
||||||
|
<?php echo $hesklang['protected_group']; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
@ -179,32 +183,32 @@ function createEditModal($template, $features, $categories)
|
|||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?php foreach ($categories as $category): ?>
|
<?php
|
||||||
|
foreach ($categories as $category): ?>
|
||||||
|
<?php
|
||||||
|
$checked = '';
|
||||||
|
$disabled = '';
|
||||||
|
if (in_array($category['id'], $enabledCategories) ||
|
||||||
|
$template['categories'] == 'ALL') {
|
||||||
|
$checked = 'checked ';
|
||||||
|
}
|
||||||
|
if ((!hesk_SESSION('isadmin') &&
|
||||||
|
!in_array($category['id'], $_SESSION['categories'])) ||
|
||||||
|
$template['categories'] === 'ALL') {
|
||||||
|
$disabled = ' disabled';
|
||||||
|
}?>
|
||||||
|
|
||||||
|
<?php if (in_array($category['id'], $_SESSION['categories']) || $checked): ?>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<?php
|
|
||||||
$checked = '';
|
|
||||||
if (in_array($category['id'], $enabledCategories)) {
|
|
||||||
$checked = 'checked ';
|
|
||||||
}
|
|
||||||
if ((!hesk_SESSION('isadmin') &&
|
|
||||||
!in_array($category['id'], $_SESSION['categories'])) ||
|
|
||||||
$template['categories'] === 'ALL') {
|
|
||||||
$disabled = ' disabled';
|
|
||||||
}?>
|
|
||||||
<?php if (in_array($category['id'], $_SESSION['categories'])): ?>
|
|
||||||
<input type="checkbox" name="categories[]"
|
<input type="checkbox" name="categories[]"
|
||||||
value="<?php echo $category['id']; ?>" <?php echo $checked . ' ' . $disabled; ?>>
|
value="<?php echo $category['id']; ?>" <?php echo $checked . ' ' . $disabled; ?>>
|
||||||
<?php
|
<?php echo $category['name']; ?>
|
||||||
echo $category['name'];
|
|
||||||
endif;
|
|
||||||
if ($disabled != '' && $checked != ''): ?>
|
|
||||||
<input type="hidden" name="categories[]"
|
|
||||||
value="<?php echo $category['id']; ?>" <?php echo $checked; ?>>
|
|
||||||
<?php endif; ?>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php
|
||||||
|
endif;
|
||||||
|
endforeach; ?>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -214,22 +218,20 @@ function createEditModal($template, $features, $categories)
|
|||||||
<div class="footerWithBorder blankSpace"></div>
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?php
|
<?php
|
||||||
$hiddenFields = '';
|
|
||||||
foreach ($features as $feature): ?>
|
foreach ($features as $feature): ?>
|
||||||
<?php
|
<?php
|
||||||
$checked = '';
|
$checked = '';
|
||||||
if (in_array($feature, $enabledFeatures)) {
|
$disabled = '';
|
||||||
|
if (in_array($feature, $enabledFeatures) ||
|
||||||
|
$template['heskprivileges'] === 'ALL') {
|
||||||
$checked = 'checked ';
|
$checked = 'checked ';
|
||||||
}
|
}
|
||||||
if ((!hesk_SESSION('isadmin') &&
|
if ((!hesk_SESSION('isadmin') &&
|
||||||
!strpos($_SESSION['heskprivileges'], $feature) !== false) ||
|
strpos($_SESSION['heskprivileges'], $feature) === false) ||
|
||||||
$template['heskprivileges'] === 'ALL') {
|
$template['heskprivileges'] === 'ALL') {
|
||||||
$disabled = ' disabled';
|
$disabled = ' disabled';
|
||||||
}
|
}
|
||||||
if ($disabled != '' && $checked != ''):
|
if (strpos($_SESSION['heskprivileges'], $feature) !== false || $checked): ?>
|
||||||
$hiddenFields .= '<input type="hidden" name="features[]"
|
|
||||||
value="' . $feature . '" ' . $checked . '>';
|
|
||||||
elseif (strpos($_SESSION['heskprivileges'], $feature) !== false): ?>
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="features[]"
|
<input type="checkbox" name="features[]"
|
||||||
@ -238,8 +240,7 @@ function createEditModal($template, $features, $categories)
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
endforeach;
|
endforeach; ?>
|
||||||
echo $hiddenFields; ?>
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -296,7 +297,9 @@ function buildCreateModal($features, $categories)
|
|||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?php foreach ($categories as $category): ?>
|
<?php
|
||||||
|
foreach ($categories as $category):
|
||||||
|
if (in_array($category['id'], $_SESSION['categories']) || hesk_SESSION('isadmin')): ?>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="categories[]"
|
<input type="checkbox" name="categories[]"
|
||||||
@ -306,7 +309,7 @@ function buildCreateModal($features, $categories)
|
|||||||
<?php echo $category['name']; ?>
|
<?php echo $category['name']; ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endif; endforeach; ?>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -315,7 +318,9 @@ function buildCreateModal($features, $categories)
|
|||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?php foreach ($features as $feature): ?>
|
<?php foreach ($features as $feature):
|
||||||
|
if (strpos($_SESSION['heskprivileges'], $feature) !== false || hesk_SESSION('isadmin')):
|
||||||
|
?>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="features[]"
|
<input type="checkbox" name="features[]"
|
||||||
@ -325,7 +330,7 @@ function buildCreateModal($features, $categories)
|
|||||||
<?php echo $hesklang[$feature]; ?>
|
<?php echo $hesklang[$feature]; ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endif; endforeach; ?>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2238,6 +2238,7 @@ $hesklang['show_event_start_time_help'] = 'Always show the start time on event t
|
|||||||
$hesklang['highlight_ticket_rows_based_on_priority'] = 'Highlight ticket rows based on priority';
|
$hesklang['highlight_ticket_rows_based_on_priority'] = 'Highlight ticket rows based on priority';
|
||||||
$hesklang['highlight_ticket_rows_based_on_priority_help'] = 'If enabled, each ticket on the tickets page will be highlighted based on priority. If disabled, only * Critical * and High priority tickets will be highlighted.';
|
$hesklang['highlight_ticket_rows_based_on_priority_help'] = 'If enabled, each ticket on the tickets page will be highlighted based on priority. If disabled, only * Critical * and High priority tickets will be highlighted.';
|
||||||
$hesklang['highlight_ticket_rows_based_on_priority_descr'] = 'Highlight all ticket rows based on priority';
|
$hesklang['highlight_ticket_rows_based_on_priority_descr'] = 'Highlight all ticket rows based on priority';
|
||||||
|
$hesklang['protected_group'] = 'This is a protected group; you cannot change accessible categories / features.';
|
||||||
|
|
||||||
// DO NOT CHANGE BELOW
|
// DO NOT CHANGE BELOW
|
||||||
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');
|
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user