Browse Source

#169 Add can_manage_email_template permission

merge-requests/2/head
Mike Koch 7 years ago
parent
commit
570ab0e54f
  1. 2
      admin/manage_email_templates.php
  2. 12
      inc/admin_functions.inc.php
  3. 17
      install/mods-for-hesk/sql/installSql.php
  4. 8
      install/mods-for-hesk/sql/uninstallSql.php
  5. 4
      language/en/text.php

2
admin/manage_email_templates.php

@ -13,7 +13,7 @@ hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();
// TODO Check permissions for this feature
hesk_checkPermission('can_manage_email_templates');
define('WYSIWYG',1);

12
inc/admin_functions.inc.php

@ -735,6 +735,18 @@ function hesk_checkPermission($feature,$showerror=1) {
return true;
}
if ($feature == 'can_manage_email_templates') {
if ($_SESSION['can_manage_email_templates']) {
return true;
} else {
if ($showerror) {
hesk_error($hesklang['no_permission'].'<p>&nbsp;</p><p align="center"><a href="index.php">'.$hesklang['click_login'].'</a>');
} else {
return false;
}
}
}
/* Check other staff for permissions */
if (strpos($_SESSION['heskprivileges'], $feature) === false)
{

17
install/mods-for-hesk/sql/installSql.php

@ -337,8 +337,8 @@ function execute210Scripts() {
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.1.0' WHERE `Key` = 'modsForHeskVersion'");
// Some old tables may not have been dropped during the 2.0.0 upgrade. Check and drop if necessary
executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk['db_pfix'])."denied_ips`");
executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk['db_pfix'])."denied_emails`");
executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_ips`");
executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_emails`");
}
function execute210FileUpdate() {
@ -395,4 +395,15 @@ $modsForHesk_settings[\'new_kb_article_visibility\'] = 0;';
return file_put_contents(HESK_PATH.'modsForHesk_settings.inc.php', $file);
}
// END Version 2.1.1
// END Version 2.1.1
// BEGIN Version 2.2.0
function execute220Scripts() {
global $hesk_settings;
hesk_dbConnect();
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ADD COLUMN `can_manage_email_templates` ENUM('0','1') NOT NULL DEFAULT '0'");
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` SET `can_manage_email_templates` = '1' WHERE `isadmin` = '1'");
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.2.0' WHERE `Key` = 'modsForHeskVersion'");
}

8
install/mods-for-hesk/sql/uninstallSql.php

@ -136,4 +136,12 @@ function executeMiscellaneousSql() {
// These queries are ran in case someone used an unfortunate installation they may have not properly cleaned up tables
executeQuery('DROP TABLE IF EXISTS `'.hesk_dbEscape($hesk_settings['db_pfix']).'denied_ips`');
executeQuery('DROP TABLE IF EXISTS `'.hesk_dbEscape($hesk_settings['db_pfix']).'denied_emails`');
}
function removeEmailTemplatePermission() {
global $hesk_settings;
hesk_dbConnect();
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` DROP COLUMN `can_manage_email_templates`");
}

4
language/en/text.php

@ -26,8 +26,8 @@ $hesklang['email_templates'] = 'Email templates';
$hesklang['email_templates_intro'] = 'You can edit your plaintext and HTML email templates here.';
$hesklang['edit_plain_text_template'] = 'Edit plain text template';
$hesklang['edit_html_template'] = 'Edit HTML template';
$hesklang['editing_plain_text_template'] = 'Editing plain text template <code>%s</code>'; // %s: The name of the template file (XXXX.txt)
$hesklang['editing_html_template'] = 'Editing HTML template <code>%s</code>'; // %s: The name of the template file
$hesklang['editing_plain_text_template'] = 'Editing plain text template <code>%s</code>'; // %s: The name of the template file, then language name
$hesklang['editing_html_template'] = 'Editing HTML template <code>%s</code>'; // %s: The name of the template file, then language name
$hesklang['show_special_tags'] = 'Show Special Tags';
$hesklang['hide_special_tags'] = 'Hide Special Tags';
$hesklang['special_tag'] = 'Special Tag';

Loading…
Cancel
Save