Added new permission for operators to see Notifications

This commit is contained in:
Borja Rubio 2013-11-08 11:22:55 +01:00
parent 9a0c9f42a1
commit 01eff99db9
4 changed files with 10 additions and 4 deletions

View File

@ -21,14 +21,16 @@ $can_administrate = 0;
$can_takeover = 1;
$can_viewthreads = 2;
$can_modifyprofile = 3;
$can_viewnotifications = 4;
$can_count = 4;
$can_count = 5;
$permission_ids = array(
$can_administrate => "admin",
$can_takeover => "takeover",
$can_viewthreads => "viewthreads",
$can_modifyprofile => "modifyprofile"
$can_modifyprofile => "modifyprofile",
$can_viewnotifications => "viewnotifications"
);
function operator_by_login($login)
@ -356,13 +358,14 @@ function is_capable($perm, $operator)
function prepare_menu($operator, $hasright = true)
{
global $page, $settings, $can_administrate;
global $page, $settings, $can_administrate,$can_viewnotifications;
$page['operator'] = topage(get_operator_name($operator));
if ($hasright) {
loadsettings();
$page['showban'] = $settings['enableban'] == "1";
$page['showgroups'] = $settings['enablegroups'] == "1";
$page['showstat'] = $settings['enablestatistics'] == "1";
$page['shownotifications'] = is_capable($can_viewnotifications, $operator);
$page['showadmin'] = is_capable($can_administrate, $operator);
$page['currentopid'] = $operator['operatorid'];
}

View File

@ -415,6 +415,7 @@ permission.admin=System administration: settings, operators management, button g
permission.modifyprofile=Ability to modify profile
permission.takeover=Take over chat thread
permission.viewthreads=View another operator's chat thread
permission.viewnotifications=View clients notifications
permissions.intro=Change restrictions and available features for this operator.
permissions.title=Permissions
presurvey.department=Choose Department:

View File

@ -25,7 +25,7 @@ $operator = check_login();
$page = array();
$errors = array();
if (!is_capable($can_administrate, $operator)) {
if (!is_capable($can_administrate, $operator) && !is_capable($can_viewnotifications, $operator)) {
die("Permission denied.");
}

View File

@ -58,6 +58,8 @@ function tpl_menu() { global $page, $mibewroot, $errors;
<li<?php menuli("settings")?>><a href="<?php echo $mibewroot ?>/operator/settings.php"><?php echo getlocal('leftMenu.client_settings') ?></a></li>
<li<?php menuli("translate")?>><a href="<?php echo $mibewroot ?>/operator/translate.php"><?php echo getlocal('menu.translate') ?></a></li>
<li<?php menuli("updates")?>><a href="<?php echo $mibewroot ?>/operator/updates.php"><?php echo getlocal('menu.updates') ?></a></li>
<?php } ?>
<?php if(isset($page['shownotifications']) && $page['shownotifications']) { ?>
<li<?php menuli("notifications")?>><a href="<?php echo $mibewroot ?>/operator/notifications.php"><?php echo getlocal('menu.notifications') ?></a></li>
<?php } ?>
<?php if(isset($page['currentopid']) && $page['currentopid']) {?>