summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-02-13 17:52:52 +0100
committerSimon Rettberg2018-02-13 17:52:52 +0100
commit59430e90b1b9334761d815aeb6e519effe7e5243 (patch)
tree479c3d1b2470daac02b9a8f24581fb18dc4ca7da
parent[syslog] Permission checks when saving anonymization days (diff)
downloadslx-admin-59430e90b1b9334761d815aeb6e519effe7e5243.tar.gz
slx-admin-59430e90b1b9334761d815aeb6e519effe7e5243.tar.xz
slx-admin-59430e90b1b9334761d815aeb6e519effe7e5243.zip
[dozmod] Move subpages to pages/, hide pages where user has no permission
-rw-r--r--modules-available/dozmod/lang/de/module.json2
-rw-r--r--modules-available/dozmod/lang/de/permissions.json24
-rw-r--r--modules-available/dozmod/lang/en/module.json2
-rw-r--r--modules-available/dozmod/lang/en/permissions.json24
-rw-r--r--modules-available/dozmod/page.inc.php341
-rw-r--r--modules-available/dozmod/pages/actionlog.inc.php (renamed from modules-available/dozmod/inc/pagedozmodlog.inc.php)73
-rw-r--r--modules-available/dozmod/pages/expiredimages.inc.php97
-rw-r--r--modules-available/dozmod/pages/mailconfig.inc.php97
-rw-r--r--modules-available/dozmod/pages/runtimeconfig.inc.php112
-rw-r--r--modules-available/dozmod/pages/templates.inc.php (renamed from modules-available/dozmod/inc/pagemailtemplates.inc.php)51
-rw-r--r--modules-available/dozmod/pages/users.inc.php (renamed from modules-available/dozmod/inc/pagedozmodusers.inc.php)36
-rw-r--r--modules-available/dozmod/permissions/permissions.json12
-rw-r--r--modules-available/dozmod/templates/images-delete.html1
-rw-r--r--modules-available/dozmod/templates/mailconfig.html7
-rw-r--r--modules-available/dozmod/templates/runtimeconfig.html1
15 files changed, 479 insertions, 401 deletions
diff --git a/modules-available/dozmod/lang/de/module.json b/modules-available/dozmod/lang/de/module.json
index 02e8c84d..c9acd4ee 100644
--- a/modules-available/dozmod/lang/de/module.json
+++ b/modules-available/dozmod/lang/de/module.json
@@ -4,7 +4,7 @@
"submenu_actionlog": "Aktions-Log",
"submenu_expiredimages": "Abgelaufene VM-Versionen",
"submenu_mailconfig": "Email-Konfiguration",
- "submenu_runtime": "Limits und Standardwerte",
+ "submenu_runtimeconfig": "Limits und Standardwerte",
"submenu_templates": "Textbausteine f\u00fcr E-Mails",
"submenu_users": "Benutzer und Berechtigungen"
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/de/permissions.json b/modules-available/dozmod/lang/de/permissions.json
index 07158a1d..9c5af91d 100644
--- a/modules-available/dozmod/lang/de/permissions.json
+++ b/modules-available/dozmod/lang/de/permissions.json
@@ -1,14 +1,14 @@
{
- "images.delete": "Zur Löschung vorgemerkete Abbilder löschen.",
- "mail.save": "Änderungen an der SMTP-Konfiguration zum Versenden von Mails speichern.",
- "mail.testmail": "Eine Test E-Mail verschicken.",
- "runtimeconfig.save": "Änderungen an der Laufzeit-Konfiguration speichern.",
- "templates.save": "E-Mail Templates speichern.",
- "templates.reset": "E-Mail Templates zurücksetzen.",
- "users.setmail": "E-Mail Benachrichtigungen für einzelne Benutzer aktivieren/deaktivieren.",
- "users.setlogin": "Anmeldungen für einzelne Benutzer aktivieren/deaktivieren.",
- "users.setsu": "Benutzer zu SuperUser ernennen.",
- "users.orglogin": "Anmeldungen für Benutzer von bestimmten Einrichtungen aktivieren/deaktivieren.",
- "log.showuser": "User Data im Aktions-Log anzeigen.",
- "log.showtarget": "Target Data im Aktions-Log anzeigen."
+ "actionlog.showtarget": "Target Data im Aktions-Log anzeigen.",
+ "actionlog.showuser": "User Data im Aktions-Log anzeigen.",
+ "expiredimages.delete": "Zur L\u00f6schung vorgemerkete Abbilder l\u00f6schen.",
+ "mailconfig.save": "\u00c4nderungen an der SMTP-Konfiguration zum Versenden von Mails speichern.",
+ "mailconfig.testmail": "Eine Test E-Mail verschicken.",
+ "runtimeconfig.save": "\u00c4nderungen an der Laufzeit-Konfiguration speichern.",
+ "templates.reset": "E-Mail Templates zur\u00fccksetzen.",
+ "templates.save": "E-Mail Templates speichern.",
+ "users.setorglogin": "Anmeldungen f\u00fcr Benutzer von bestimmten Einrichtungen aktivieren\/deaktivieren.",
+ "users.setlogin": "Anmeldungen f\u00fcr einzelne Benutzer aktivieren\/deaktivieren.",
+ "users.setmail": "E-Mail Benachrichtigungen f\u00fcr einzelne Benutzer aktivieren\/deaktivieren.",
+ "users.setsu": "Benutzer zu SuperUser ernennen."
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/en/module.json b/modules-available/dozmod/lang/en/module.json
index 17a2b838..b7a04762 100644
--- a/modules-available/dozmod/lang/en/module.json
+++ b/modules-available/dozmod/lang/en/module.json
@@ -4,7 +4,7 @@
"submenu_actionlog": "action log",
"submenu_expiredimages": "Expired VM versions",
"submenu_mailconfig": "email configuration",
- "submenu_runtime": "limits and defaults",
+ "submenu_runtimeconfig": "limits and defaults",
"submenu_templates": "templates",
"submenu_users": "users and permissions"
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/en/permissions.json b/modules-available/dozmod/lang/en/permissions.json
index 923a8461..a86cf155 100644
--- a/modules-available/dozmod/lang/en/permissions.json
+++ b/modules-available/dozmod/lang/en/permissions.json
@@ -1,14 +1,14 @@
{
- "images.delete": "Delete images marked for deletion.",
- "mail.save": "Save SMTP configuration for sending mails.",
- "mail.testmail": "Send a testmail.",
- "runtimeconfig.save": "Save limits and defaults of a runtime configuration.",
- "templates.save": "Save email templates.",
- "templates.reset": "Reset email templates.",
- "users.setmail": "Enable/Disable Email Notification.",
- "users.setlogin": "Enable/Disable Login.",
- "users.setsu": "Set User to superuser.",
- "users.orglogin": "Enalbe/Disable Login for Users from certain organisations.",
- "log.showuser": "Show User Data in Log.",
- "log.showtarget": "Show Target Data in Log."
+ "actionlog.showtarget": "Show Target Data in Log.",
+ "actionlog.showuser": "Show User Data in Log.",
+ "expiredimages.delete": "Delete images marked for deletion.",
+ "mailconfig.save": "Save SMTP configuration for sending mails.",
+ "mailconfig.testmail": "Send a testmail.",
+ "runtimeconfig.save": "Save limits and defaults of a runtime configuration.",
+ "templates.reset": "Reset email templates.",
+ "templates.save": "Save email templates.",
+ "users.setorglogin": "Enalbe\/Disable Login for Users from certain organisations.",
+ "users.setlogin": "Enable\/Disable Login.",
+ "users.setmail": "Enable\/Disable Email Notification.",
+ "users.setsu": "Set User to superuser."
} \ No newline at end of file
diff --git a/modules-available/dozmod/page.inc.php b/modules-available/dozmod/page.inc.php
index b58d57aa..a8e0da0e 100644
--- a/modules-available/dozmod/page.inc.php
+++ b/modules-available/dozmod/page.inc.php
@@ -2,25 +2,37 @@
class Page_DozMod extends Page
{
- /** @var \Page sub page classes */
- private $subPage = false;
+ /** @var bool true if we have a proper subpage */
+ private $haveSubPage = false;
+
+ private $validSections = ['expiredimages', 'mailconfig', 'templates', 'runtimeconfig', 'users', 'actionlog'];
+
+ private $section;
private function setupSubPage()
{
- if ($this->subPage !== false)
+ if ($this->haveSubPage !== false)
return;
/* different pages for different sections */
- $section = Request::any('section', 'mailconfig', 'string');
- /* instantiate sub pages */
- if ($section === 'templates') {
- $this->subPage = new Page_mail_templates();
- }
- if ($section === 'users') {
- $this->subPage = new Page_dozmod_users();
- }
- if ($section === 'actionlog') {
- $this->subPage = new Page_dozmod_log();
- }
+ $this->section = Request::any('section', false, 'string');
+ if ($this->section === 'blockstats') // HACK HACK
+ return;
+ if ($this->section === false) {
+ foreach ($this->validSections as $this->section) {
+ if (User::hasPermission($this->section . '.*'))
+ break;
+ }
+ } elseif (!in_array($this->section, $this->validSections)) {
+ Util::traceError('Invalid section: ' . $this->section);
+ }
+ // Check permissions
+ User::assertPermission($this->section . '.*');
+ $include = 'modules/' . Page::getModule()->getIdentifier() . '/pages/' . $this->section . '.inc.php';
+ if (!file_exists($include))
+ return;
+
+ require_once $include;
+ $this->haveSubPage = true;
}
protected function doPreprocess()
@@ -32,117 +44,41 @@ class Page_DozMod extends Page
Util::redirect('?do=Main');
}
- /* add sub-menus */
- Dashboard::addSubmenu('?do=dozmod&section=expiredimages', Dictionary::translate('submenu_expiredimages', true));
- Dashboard::addSubmenu('?do=dozmod&section=mailconfig', Dictionary::translate('submenu_mailconfig', true));
- Dashboard::addSubmenu('?do=dozmod&section=templates', Dictionary::translate('submenu_templates', true));
- Dashboard::addSubmenu('?do=dozmod&section=runtimeconfig', Dictionary::translate('submenu_runtime', true));
- Dashboard::addSubmenu('?do=dozmod&section=users', Dictionary::translate('submenu_users', true));
- Dashboard::addSubmenu('?do=dozmod&section=actionlog', Dictionary::translate('submenu_actionlog', true));
-
$this->setupSubPage();
- if ($this->subPage !== false) {
- $this->subPage->doPreprocess();
- return;
+ if ($this->haveSubPage !== false) {
+ SubPage::doPreprocess();
+ }
+ // Catch unhandled POST redirect
+ if (Request::isPost()) {
+ Util::redirect('?do=dozmod&section=' . $this->section);
}
- /* execute actions */
- $action = Request::post('action', false, 'string');
+ /* Leave this here for translation module
+ Dictionary::translate('submenu_expiredimages', true);
+ Dictionary::translate('submenu_mailconfig', true);
+ Dictionary::translate('submenu_templates', true);
+ Dictionary::translate('submenu_runtimeconfig', true);
+ Dictionary::translate('submenu_users', true);
+ Dictionary::translate('submenu_actionlog', true);
+ */
- if ($action === 'mail') {
- if (User::hasPermission("mail.save")) {
- $this->mailHandler();
- }
- } elseif ($action === 'runtime') {
- if (User::hasPermission("runtimeconfig.save")) {
- $this->runtimeHandler();
- }
- } elseif ($action === 'delimages') {
- if (User::hasPermission("images.delete")) {
- $result = $this->handleDeleteImages();
- if (!empty($result)) {
- Message::addInfo('delete-images', $result);
- }
- Util::redirect('?do=DozMod');
+ /* add sub-menus */
+ foreach ($this->validSections as $section) {
+ if (User::hasPermission($section . '.*')) {
+ Dashboard::addSubmenu('?do=dozmod&section=' . $section, Dictionary::translate('submenu_' . $section, true));
}
- } elseif ($action !== false) {
- Util::traceError('Invalid action: ' . $action);
}
}
protected function doRender()
{
/* different pages for different sections */
- if ($this->subPage !== false) {
- $this->subPage->doRender();
+ if ($this->haveSubPage !== false) {
+ SubPage::doRender();
return;
}
- $section = Request::get('section', false, 'string');
-
- if ($section === false || $section === 'expiredimages') {
- $expiredImages = $this->loadExpiredImages();
- if ($section === false && empty($expiredImages)) {
- $section = 'mailconfig';
- } else {
- $section = 'expiredimages';
- }
- }
-
- if ($section === 'expiredimages') {
- if (empty($expiredImages)) {
- Message::addSuccess('no-expired-images');
- } else {
- Render::addTemplate('images-delete', array('images' => $expiredImages, 'allowedDelete' => User::hasPermission("images.delete")));
- }
- }
- if ($section === 'mailconfig') {
- // Mail config
- $mailConf = Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'mailconfig'));
- if ($mailConf != null) {
- $mailConf = @json_decode($mailConf['value'], true);
- if (is_array($mailConf)) {
- $mailConf['set_' . $mailConf['ssl']] = 'selected="selected"';
- }
- }
- $mailConf['allowedSave'] = User::hasPermission('mail.save');
- $mailConf['allowedTest'] = User::hasPermission('mail.testmail');
- Render::addTemplate('mailconfig', $mailConf);
- }
- if ($section === 'runtimeconfig') {
- // Runtime config
- $runtimeConf = Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'runtimelimits'));
- if ($runtimeConf !== false) {
- $runtimeConf = json_decode($runtimeConf['value'], true);
-
- /* convert some value to corresponding "selected" texts */
- if ($runtimeConf['defaultLecturePermissions']['edit']) {
- $runtimeConf['defaultLecturePermissions']['edit'] = 'checked';
- }
- if ($runtimeConf['defaultLecturePermissions']['admin']) {
- $runtimeConf['defaultLecturePermissions']['admin'] = 'checked';
- }
- if ($runtimeConf['defaultImagePermissions']['edit']) {
- $runtimeConf['defaultImagePermissions']['edit'] = 'checked';
- }
- if ($runtimeConf['defaultImagePermissions']['admin']) {
- $runtimeConf['defaultImagePermissions']['admin'] = 'checked';
- }
- if ($runtimeConf['defaultImagePermissions']['link']) {
- $runtimeConf['defaultImagePermissions']['link'] = 'checked';
- }
- if ($runtimeConf['defaultImagePermissions']['download']) {
- $runtimeConf['defaultImagePermissions']['download'] = 'checked';
- }
-
- if ($runtimeConf['allowLoginByDefault']) {
- $runtimeConf['allowLoginByDefault'] = 'checked';
- }
- }
- $runtimeConf['allowedSave'] = User::hasPermission("runtimeconfig.save");
- Render::addTemplate('runtimeconfig', $runtimeConf);
- }
- if ($section === 'blockstats') {
+ if ($this->section === 'blockstats') {
$this->showBlockStats();
}
@@ -164,73 +100,19 @@ class Page_DozMod extends Page
Render::addTemplate('blockstats', $data);
}
- private function loadExpiredImages()
- {
- $res = Database::simpleQuery("SELECT b.displayname,"
- . " own.firstname, own.lastname, own.email,"
- . " v.imageversionid, v.createtime, v.filesize, v.deletestate,"
- . " lat.expiretime AS latexptime, lat.deletestate AS latdelstate"
- . " FROM sat.imageversion v"
- . " INNER JOIN sat.imagebase b ON (b.imagebaseid = v.imagebaseid)"
- . " INNER JOIN sat.user own ON (b.ownerid = own.userid)"
- . " LEFT JOIN sat.imageversion lat ON (b.latestversionid = lat.imageversionid)"
- . " WHERE v.deletestate <> 'KEEP'"
- . " ORDER BY b.displayname ASC, v.createtime ASC");
- $NOW = time();
- $rows = array();
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['latexptime'] > $NOW && $row['latdelstate'] === 'KEEP') {
- $row['hasNewerClass'] = 'glyphicon-ok green';
- $row['checked'] = 'checked';
- } else {
- $row['hasNewerClass'] = 'glyphicon-remove red';
- }
- if ($row['deletestate'] === 'WANT_DELETE') {
- $row['name_extra_class'] = 'slx-strike';
- }
- $row['version'] = date('d.m.Y H:i:s', $row['createtime']);
- $row['rawfilesize'] = $row['filesize'];
- $row['filesize'] = Util::readableFileSize($row['filesize']);
- $rows[] = $row;
- }
- return $rows;
- }
-
- private function cleanMailArray()
- {
- $keys = array('host', 'port', 'ssl', 'senderAddress', 'replyTo', 'username', 'password', 'serverName');
- $data = array();
- foreach ($keys as $key) {
- $data[$key] = Request::post($key, '');
- settype($data[$key], 'string');
- if (is_numeric($data[$key])) {
- settype($data[$key], 'int');
- }
- }
- return $data;
- }
-
protected function doAjax()
{
User::load();
-
$this->setupSubPage();
- if ($this->subPage !== false) {
- $this->subPage->doAjax();
+
+ if ($this->haveSubPage !== false) {
+ SubPage::doAjax();
return;
}
$action = Request::post('action');
- if ($action === 'mail') {
- if (User::hasPermission("mail.testmail")) {
- $this->handleTestMail();
- }
- } elseif ($action === 'delimages') {
- if (User::hasPermission("images.delete")) {
- die($this->handleDeleteImages());
- }
- } elseif ($action === 'getblockinfo') {
+ if ($action === 'getblockinfo') {
$this->ajaxGetBlockInfo();
}
}
@@ -264,125 +146,4 @@ class Page_DozMod extends Page
die(Render::parse('blockstats-details', $data));
}
- private function handleDeleteImages()
- {
- $images = Request::post('images', false);
- if (is_array($images)) {
- foreach ($images as $image => $val) {
- if (strtolower($val) !== 'on')
- continue;
- Database::exec("UPDATE sat.imageversion SET deletestate = 'WANT_DELETE'"
- . " WHERE deletestate = 'SHOULD_DELETE' AND imageversionid = :imageversionid", array(
- 'imageversionid' => $image
- ));
- }
- if (!empty($images)) {
- $ret = Download::asStringPost('http://127.0.0.1:9080/do/delete-images', false, 10, $code);
- if ($code == 999) {
- $ret .= "\nConnection to DMSD failed.";
- }
- return $ret;
- }
- }
- return false;
- }
-
- private function handleTestMail()
- {
- $do = Request::post('button');
- if ($do === 'test') {
- // Prepare array
- $data = $this->cleanMailArray();
- Header('Content-Type: text/plain; charset=utf-8');
- $data['recipient'] = Request::post('recipient', '');
- if (!preg_match('/.+@.+\..+/', $data['recipient'])) {
- $result = 'No recipient given!';
- } else {
- $result = Download::asStringPost('http://127.0.0.1:9080/do/mailtest', $data, 10, $code);
- if ($code == 999) {
- $result .= "\nTimeout.";
- } elseif ($code != 200) {
- $result .= "\nReturn code $code";
- }
- }
- die($result);
- }
- }
-
- private function mailHandler()
- {
- // Check action
- $do = Request::post('button');
- if ($do === 'save') {
- // Prepare array
- $data = $this->cleanMailArray();
- $data = json_encode($data);
- Database::exec('INSERT INTO sat.configuration (parameter, value)'
- . ' VALUES (:param, :value)'
- . ' ON DUPLICATE KEY UPDATE value = VALUES(value)', array(
- 'param' => 'mailconfig',
- 'value' => $data
- ));
- Message::addSuccess('mail-config-saved');
- } else {
- Message::addError('main.invalid-action', $do);
- }
- Util::redirect('?do=DozMod&section=mailconfig');
- }
-
- private function runtimeHandler()
- {
- // Check action
- $do = Request::post('button');
- if ($do === 'save') {
- $data = [];
- $data['defaultLecturePermissions'] = Request::post('defaultLecturePermissions', NULL, "array");
- $data['defaultImagePermissions'] = Request::post('defaultImagePermissions', NULL, "array");
-
- $params = [
- 'int' => [
- 'maxImageValidityDays' => array('min' => 7, 'max' => 9999),
- 'maxLectureValidityDays' => array('min' => 7, 'max' => 9999),
- 'maxLocationsPerLecture' => array('min' => 0, 'max' => 999),
- 'maxTransfers' => array('min' => 1, 'max' => 10),
- ],
- 'bool' => [
- 'allowLoginByDefault' => array('default' => true)
- ],
- ];
- foreach ($params as $type => $list) {
- foreach ($list as $field => $limits) {
- $default = isset($limits['default']) ? $limits['default'] : false;
- $value = Request::post($field, $default);
- settype($value, $type);
- if (isset($limits['min']) && $value < $limits['min']) {
- $value = $limits['min'];
- }
- if (isset($limits['max']) && $value > $limits['max']) {
- $value = $limits['max'];
- }
- $data[$field] = $value;
- }
- }
-
- /* ensure types */
- settype($data['defaultLecturePermissions']['edit'], 'boolean');
- settype($data['defaultLecturePermissions']['admin'], 'boolean');
- settype($data['defaultImagePermissions']['edit'], 'boolean');
- settype($data['defaultImagePermissions']['admin'], 'boolean');
- settype($data['defaultImagePermissions']['link'], 'boolean');
- settype($data['defaultImagePermissions']['download'], 'boolean');
-
- $data = json_encode($data);
- Database::exec('INSERT INTO sat.configuration (parameter, value)'
- . ' VALUES (:param, :value)'
- . ' ON DUPLICATE KEY UPDATE value = VALUES(value)', array(
- 'param' => 'runtimelimits',
- 'value' => $data
- ));
- Message::addSuccess('runtimelimits-config-saved');
- }
- Util::redirect('?do=DozMod&section=runtimeconfig');
- }
-
}
diff --git a/modules-available/dozmod/inc/pagedozmodlog.inc.php b/modules-available/dozmod/pages/actionlog.inc.php
index 80441cd1..6cbd2868 100644
--- a/modules-available/dozmod/inc/pagedozmodlog.inc.php
+++ b/modules-available/dozmod/pages/actionlog.inc.php
@@ -1,25 +1,25 @@
<?php
-class Page_dozmod_log extends Page
+class SubPage
{
- private $action;
- private $uuid;
+ private static $action;
+ private static $uuid;
- protected function doPreprocess()
+ public static function doPreprocess()
{
- $this->action = Request::get('action', '', 'string');
- if ($this->action !== '' && $this->action !== 'showtarget' && $this->action !== 'showuser') {
- Util::traceError('Invalid action for actionlog: "' . $this->action . '"');
+ self::$action = Request::get('action', '', 'string');
+ if (self::$action !== '' && self::$action !== 'showtarget' && self::$action !== 'showuser') {
+ Util::traceError('Invalid action for actionlog: "' . self::$action . '"');
}
- $this->uuid = Request::get('uuid', '', 'string');
+ self::$uuid = Request::get('uuid', '', 'string');
}
- protected function doRender()
+ public static function doRender()
{
Render::addTemplate('actionlog-header');
- if ($this->action === '') {
- $this->generateLog("SELECT al.dateline, al.targetid, al.description,"
+ if (self::$action === '') {
+ self::generateLog("SELECT al.dateline, al.targetid, al.description,"
. " img.displayname AS imgname, tu.firstname AS tfirstname, tu.lastname AS tlastname, l.displayname AS lecturename,"
. " al.userid AS uuserid, usr.firstname AS ufirstname, usr.lastname AS ulastname"
. " FROM sat.actionlog al"
@@ -28,62 +28,62 @@ class Page_dozmod_log extends Page
. " LEFT JOIN sat.user tu ON (tu.userid = al.targetid)"
. " LEFT JOIN sat.lecture l ON (l.lectureid = targetid)"
. " ORDER BY al.dateline DESC LIMIT 500", array(), true, true);
- } elseif ($this->action === 'showuser') {
- if (User::hasPermission("log.showuser")) {
- $this->listUser();
+ } elseif (self::$action === 'showuser') {
+ if (User::hasPermission("actionlog.showuser")) {
+ self::listUser();
}
} else {
- if (User::hasPermission("log.showtarget")) {
- $this->listTarget();
+ if (User::hasPermission("actionlog.showtarget")) {
+ self::listTarget();
}
}
}
- private function listUser()
+ private static function listUser()
{
// Query user
$user = Database::queryFirst('SELECT userid, firstname, lastname, email, lastlogin,'
. ' organization.displayname AS orgname FROM sat.user'
. ' LEFT JOIN sat.organization USING (organizationid)'
. ' WHERE userid = :uuid'
- . ' LIMIT 1', array('uuid' => $this->uuid));
+ . ' LIMIT 1', array('uuid' => self::$uuid));
if ($user === false) {
- Message::addError('unknown-userid', $this->uuid);
+ Message::addError('unknown-userid', self::$uuid);
Util::redirect('?do=dozmod&section=actionlog');
}
// Mangle date and render
$user['lastlogin_s'] = date('d.m.Y H:i', $user['lastlogin']);
Render::addTemplate('actionlog-user', $user);
// Finally add the actionlog
- $this->generateLog("SELECT al.dateline, al.targetid, al.description,"
+ self::generateLog("SELECT al.dateline, al.targetid, al.description,"
. " img.displayname AS imgname, usr.firstname AS tfirstname, usr.lastname AS tlastname, l.displayname AS lecturename"
. " FROM sat.actionlog al"
. " LEFT JOIN sat.imagebase img ON (img.imagebaseid = targetid)"
. " LEFT JOIN sat.user usr ON (usr.userid = targetid)"
. " LEFT JOIN sat.lecture l ON (l.lectureid = targetid)"
. " WHERE al.userid = :uuid"
- . " ORDER BY al.dateline DESC LIMIT 500", array('uuid' => $this->uuid), false, true);
+ . " ORDER BY al.dateline DESC LIMIT 500", array('uuid' => self::$uuid), false, true);
}
- private function listTarget()
+ private static function listTarget()
{
// We have to guess what kind of target it is
- if (!$this->addImageHeader()
- && !$this->addLectureHeader()) {
- Message::addError('unknown-targetid', $this->uuid);
+ if (!self::addImageHeader()
+ && !self::addLectureHeader()) {
+ Message::addError('unknown-targetid', self::$uuid);
// Keep going, there might still be log entries for a deleted uuid
}
// Finally add the actionlog
- $this->generateLog("SELECT al.dateline, al.userid AS uuserid, al.description,"
+ self::generateLog("SELECT al.dateline, al.userid AS uuserid, al.description,"
. " usr.firstname AS ufirstname, usr.lastname AS ulastname"
. " FROM sat.actionlog al"
. " LEFT JOIN sat.user usr ON (usr.userid = al.userid)"
. " WHERE al.targetid = :uuid"
- . " ORDER BY al.dateline DESC LIMIT 500", array('uuid' => $this->uuid), true, false);
+ . " ORDER BY al.dateline DESC LIMIT 500", array('uuid' => self::$uuid), true, false);
}
- private function addImageHeader()
+ private static function addImageHeader()
{
$image = Database::queryFirst('SELECT o.userid AS ouserid, o.firstname AS ofirstname, o.lastname AS olastname,'
. ' u.userid AS uuserid, u.firstname AS ufirstname, u.lastname AS ulastname,'
@@ -94,7 +94,7 @@ class Page_dozmod_log extends Page
. ' LEFT JOIN sat.user u ON (img.updaterid = u.userid)'
. ' LEFT JOIN sat.operatingsystem os ON (img.osid = os.osid)'
. ' WHERE img.imagebaseid = :uuid'
- . ' LIMIT 1', array('uuid' => $this->uuid));
+ . ' LIMIT 1', array('uuid' => self::$uuid));
if ($image !== false) {
// Mangle date and render
$image['createtime_s'] = date('d.m.Y H:i', $image['createtime']);
@@ -105,7 +105,7 @@ class Page_dozmod_log extends Page
return $image !== false;
}
- private function addLectureHeader()
+ private static function addLectureHeader()
{
$lecture = Database::queryFirst('SELECT o.userid AS ouserid, o.firstname AS ofirstname, o.lastname AS olastname,'
. ' u.userid AS uuserid, u.firstname AS ufirstname, u.lastname AS ulastname,'
@@ -117,7 +117,7 @@ class Page_dozmod_log extends Page
. ' LEFT JOIN sat.imageversion ver ON (ver.imageversionid = l.imageversionid)'
. ' LEFT JOIN sat.imagebase img ON (img.imagebaseid = ver.imagebaseid)'
. ' WHERE l.lectureid = :uuid'
- . ' LIMIT 1', array('uuid' => $this->uuid));
+ . ' LIMIT 1', array('uuid' => self::$uuid));
if ($lecture !== false) {
// Mangle date and render
$lecture['createtime_s'] = date('d.m.Y H:i', $lecture['createtime']);
@@ -128,7 +128,7 @@ class Page_dozmod_log extends Page
return $lecture !== false;
}
- private function generateLog($query, $params, $showActor, $showTarget)
+ private static function generateLog($query, $params, $showActor, $showTarget)
{
// query action log
$res = Database::simpleQuery($query, $params);
@@ -155,9 +155,14 @@ class Page_dozmod_log extends Page
$data['showTarget'] = true;
}
- $data['allowedShowUser'] = User::hasPermission("log.showuser");
- $data['allowedShowTarget'] = User::hasPermission("log.showtarget");
+ $data['allowedShowUser'] = User::hasPermission("actionlog.showuser");
+ $data['allowedShowTarget'] = User::hasPermission("actionlog.showtarget");
Render::addTemplate('actionlog-log', $data);
}
+ public static function doAjax()
+ {
+
+ }
+
} \ No newline at end of file
diff --git a/modules-available/dozmod/pages/expiredimages.inc.php b/modules-available/dozmod/pages/expiredimages.inc.php
new file mode 100644
index 00000000..2b5a2274
--- /dev/null
+++ b/modules-available/dozmod/pages/expiredimages.inc.php
@@ -0,0 +1,97 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ $action = Request::post('action', false, 'string');
+
+ if ($action === 'delimages') {
+ if (User::hasPermission("expiredimages.delete")) {
+ $result = self::handleDeleteImages();
+ if (!empty($result)) {
+ Message::addInfo('delete-images', $result);
+ }
+ Util::redirect('?do=DozMod');
+ }
+ }
+ }
+
+ private static function handleDeleteImages()
+ {
+ $images = Request::post('images', false);
+ if (is_array($images)) {
+ foreach ($images as $image => $val) {
+ if (strtolower($val) !== 'on')
+ continue;
+ Database::exec("UPDATE sat.imageversion SET deletestate = 'WANT_DELETE'"
+ . " WHERE deletestate = 'SHOULD_DELETE' AND imageversionid = :imageversionid", array(
+ 'imageversionid' => $image
+ ));
+ }
+ if (!empty($images)) {
+ $ret = Download::asStringPost('http://127.0.0.1:9080/do/delete-images', false, 10, $code);
+ if ($code == 999) {
+ $ret .= "\nConnection to DMSD failed.";
+ }
+ return $ret;
+ }
+ }
+ return false;
+ }
+
+ private static function loadExpiredImages()
+ {
+ $res = Database::simpleQuery("SELECT b.displayname,"
+ . " own.firstname, own.lastname, own.email,"
+ . " v.imageversionid, v.createtime, v.filesize, v.deletestate,"
+ . " lat.expiretime AS latexptime, lat.deletestate AS latdelstate"
+ . " FROM sat.imageversion v"
+ . " INNER JOIN sat.imagebase b ON (b.imagebaseid = v.imagebaseid)"
+ . " INNER JOIN sat.user own ON (b.ownerid = own.userid)"
+ . " LEFT JOIN sat.imageversion lat ON (b.latestversionid = lat.imageversionid)"
+ . " WHERE v.deletestate <> 'KEEP'"
+ . " ORDER BY b.displayname ASC, v.createtime ASC");
+ $NOW = time();
+ $rows = array();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if ($row['latexptime'] > $NOW && $row['latdelstate'] === 'KEEP') {
+ $row['hasNewerClass'] = 'glyphicon-ok green';
+ $row['checked'] = 'checked';
+ } else {
+ $row['hasNewerClass'] = 'glyphicon-remove red';
+ }
+ if ($row['deletestate'] === 'WANT_DELETE') {
+ $row['name_extra_class'] = 'slx-strike';
+ }
+ $row['version'] = date('d.m.Y H:i:s', $row['createtime']);
+ $row['rawfilesize'] = $row['filesize'];
+ $row['filesize'] = Util::readableFileSize($row['filesize']);
+ $rows[] = $row;
+ }
+ return $rows;
+ }
+
+ public static function doRender()
+ {
+ $expiredImages = self::loadExpiredImages();
+
+ if (empty($expiredImages)) {
+ Message::addSuccess('no-expired-images');
+ } else {
+ Render::addTemplate('images-delete', array('images' => $expiredImages, 'allowedDelete' => User::hasPermission("expiredimages.delete")));
+ }
+ }
+
+ public static function doAjax()
+ {
+ $action = Request::post('action');
+ if ($action === 'delimages') {
+ User::assertPermission("expiredimages.delete");
+ die(self::handleDeleteImages());
+ }
+ die('Huh?');
+ }
+
+}
diff --git a/modules-available/dozmod/pages/mailconfig.inc.php b/modules-available/dozmod/pages/mailconfig.inc.php
new file mode 100644
index 00000000..1f0a750c
--- /dev/null
+++ b/modules-available/dozmod/pages/mailconfig.inc.php
@@ -0,0 +1,97 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ $action = Request::post('action', false, 'string');
+
+ if ($action === 'mail') {
+ User::assertPermission("mailconfig.save");
+ self::mailHandler();
+ }
+ }
+
+ private static function mailHandler()
+ {
+ // Check action
+ $do = Request::post('button');
+ if ($do === 'save') {
+ // Prepare array
+ $data = self::cleanMailArray();
+ $data = json_encode($data);
+ Database::exec('INSERT INTO sat.configuration (parameter, value)'
+ . ' VALUES (:param, :value)'
+ . ' ON DUPLICATE KEY UPDATE value = VALUES(value)', array(
+ 'param' => 'mailconfig',
+ 'value' => $data
+ ));
+ Message::addSuccess('mail-config-saved');
+ } else {
+ Message::addError('main.invalid-action', $do);
+ }
+ Util::redirect('?do=DozMod&section=mailconfig');
+ }
+
+ private static function cleanMailArray()
+ {
+ $keys = array('host', 'port', 'ssl', 'senderAddress', 'replyTo', 'username', 'password', 'serverName');
+ $data = array();
+ foreach ($keys as $key) {
+ $data[$key] = Request::post($key, '');
+ settype($data[$key], 'string');
+ if (is_numeric($data[$key])) {
+ settype($data[$key], 'int');
+ }
+ }
+ return $data;
+ }
+
+ public static function doRender()
+ {
+ // Mail config
+ $mailConf = Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'mailconfig'));
+ if ($mailConf != null) {
+ $mailConf = @json_decode($mailConf['value'], true);
+ if (is_array($mailConf)) {
+ $mailConf['set_' . $mailConf['ssl']] = 'selected="selected"';
+ }
+ }
+ Permission::addGlobalTags($mailConf['perms'], NULL, ['mailconfig.save', 'mailconfig.testmail']);
+ Render::addTemplate('mailconfig', $mailConf);
+ }
+
+ public static function doAjax()
+ {
+ $action = Request::post('action');
+ if ($action === 'mail') {
+ if (User::hasPermission("mailconfig.testmail")) {
+ self::handleTestMail();
+ }
+ }
+ }
+
+ private static function handleTestMail()
+ {
+ $do = Request::post('button');
+ if ($do === 'test') {
+ // Prepare array
+ $data = self::cleanMailArray();
+ Header('Content-Type: text/plain; charset=utf-8');
+ $data['recipient'] = Request::post('recipient', '');
+ if (!preg_match('/.+@.+\..+/', $data['recipient'])) {
+ $result = 'No recipient given!';
+ } else {
+ $result = Download::asStringPost('http://127.0.0.1:9080/do/mailtest', $data, 10, $code);
+ if ($code == 999) {
+ $result .= "\nTimeout.";
+ } elseif ($code != 200) {
+ $result .= "\nReturn code $code";
+ }
+ }
+ die($result);
+ }
+ }
+
+}
diff --git a/modules-available/dozmod/pages/runtimeconfig.inc.php b/modules-available/dozmod/pages/runtimeconfig.inc.php
new file mode 100644
index 00000000..63ba4650
--- /dev/null
+++ b/modules-available/dozmod/pages/runtimeconfig.inc.php
@@ -0,0 +1,112 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ /* execute actions */
+ $action = Request::post('action', false, 'string');
+
+ if ($action === 'runtime') {
+ User::assertPermission("runtimeconfig.save");
+ self::runtimeHandler();
+ }
+ }
+
+ private static function runtimeHandler()
+ {
+ // Check action
+ $do = Request::post('button');
+ if ($do === 'save') {
+ $data = [];
+ $data['defaultLecturePermissions'] = Request::post('defaultLecturePermissions', NULL, "array");
+ $data['defaultImagePermissions'] = Request::post('defaultImagePermissions', NULL, "array");
+
+ $params = [
+ 'int' => [
+ 'maxImageValidityDays' => array('min' => 7, 'max' => 9999),
+ 'maxLectureValidityDays' => array('min' => 7, 'max' => 9999),
+ 'maxLocationsPerLecture' => array('min' => 0, 'max' => 999),
+ 'maxTransfers' => array('min' => 1, 'max' => 10),
+ ],
+ 'bool' => [
+ 'allowLoginByDefault' => array('default' => true)
+ ],
+ ];
+ foreach ($params as $type => $list) {
+ foreach ($list as $field => $limits) {
+ $default = isset($limits['default']) ? $limits['default'] : false;
+ $value = Request::post($field, $default);
+ settype($value, $type);
+ if (isset($limits['min']) && $value < $limits['min']) {
+ $value = $limits['min'];
+ }
+ if (isset($limits['max']) && $value > $limits['max']) {
+ $value = $limits['max'];
+ }
+ $data[$field] = $value;
+ }
+ }
+
+ /* ensure types */
+ settype($data['defaultLecturePermissions']['edit'], 'boolean');
+ settype($data['defaultLecturePermissions']['admin'], 'boolean');
+ settype($data['defaultImagePermissions']['edit'], 'boolean');
+ settype($data['defaultImagePermissions']['admin'], 'boolean');
+ settype($data['defaultImagePermissions']['link'], 'boolean');
+ settype($data['defaultImagePermissions']['download'], 'boolean');
+
+ $data = json_encode($data);
+ Database::exec('INSERT INTO sat.configuration (parameter, value)'
+ . ' VALUES (:param, :value)'
+ . ' ON DUPLICATE KEY UPDATE value = VALUES(value)', array(
+ 'param' => 'runtimelimits',
+ 'value' => $data
+ ));
+ Message::addSuccess('runtimelimits-config-saved');
+ }
+ Util::redirect('?do=DozMod&section=runtimeconfig');
+ }
+
+ public static function doRender()
+ {
+ // Runtime config
+ $runtimeConf = Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'runtimelimits'));
+ if ($runtimeConf !== false) {
+ $runtimeConf = json_decode($runtimeConf['value'], true);
+
+ /* convert some value to corresponding "selected" texts */
+ if ($runtimeConf['defaultLecturePermissions']['edit']) {
+ $runtimeConf['defaultLecturePermissions']['edit'] = 'checked';
+ }
+ if ($runtimeConf['defaultLecturePermissions']['admin']) {
+ $runtimeConf['defaultLecturePermissions']['admin'] = 'checked';
+ }
+ if ($runtimeConf['defaultImagePermissions']['edit']) {
+ $runtimeConf['defaultImagePermissions']['edit'] = 'checked';
+ }
+ if ($runtimeConf['defaultImagePermissions']['admin']) {
+ $runtimeConf['defaultImagePermissions']['admin'] = 'checked';
+ }
+ if ($runtimeConf['defaultImagePermissions']['link']) {
+ $runtimeConf['defaultImagePermissions']['link'] = 'checked';
+ }
+ if ($runtimeConf['defaultImagePermissions']['download']) {
+ $runtimeConf['defaultImagePermissions']['download'] = 'checked';
+ }
+
+ if ($runtimeConf['allowLoginByDefault']) {
+ $runtimeConf['allowLoginByDefault'] = 'checked';
+ }
+ }
+ $runtimeConf['allowedSave'] = User::hasPermission("runtimeconfig.save");
+ Render::addTemplate('runtimeconfig', $runtimeConf);
+ }
+
+ public static function doAjax()
+ {
+
+ }
+
+}
diff --git a/modules-available/dozmod/inc/pagemailtemplates.inc.php b/modules-available/dozmod/pages/templates.inc.php
index ff47977f..b857115f 100644
--- a/modules-available/dozmod/inc/pagemailtemplates.inc.php
+++ b/modules-available/dozmod/pages/templates.inc.php
@@ -1,24 +1,22 @@
<?php
-class Page_mail_templates extends Page
+class SubPage
{
- private $templates = [];
+ private static $templates = [];
- protected function doPreprocess()
+ public static function doPreprocess()
{
- User::load();
-
$action = Request::post('action', 'show', 'string');
if ($action === 'show') {
- $this->fetchTemplates();
+ self::fetchTemplates();
} elseif ($action === 'save') {
if (User::hasPermission("templates.save")) {
- $this->handleSave();
+ self::handleSave();
}
} elseif ($action === 'reset') {
if(User::hasPermission("templates.reset")) {
- $this->handleReset();
+ self::handleReset();
}
} else {
Message::addError('main.invalid-action', $action);
@@ -26,9 +24,9 @@ class Page_mail_templates extends Page
}
}
- private function enrichHtml() {
+ private static function enrichHtml() {
/* for each template */
- foreach ($this->templates as &$t) {
+ foreach (self::$templates as &$t) {
$lis = "";
$optManVars = "";
$optVars = "";
@@ -61,36 +59,36 @@ class Page_mail_templates extends Page
}
}
- protected function doRender()
+ public static function doRender()
{
- $this->enrichHtml();
+ self::enrichHtml();
Render::addTemplate('templates', [
- 'templates' => $this->templates,
+ 'templates' => self::$templates,
'allowedReset' => User::hasPermission("templates.reset"),
'allowedSave' => User::hasPermission("templates.save"),
]);
}
- private function forcmp($string)
+ private static function forcmp($string)
{
return trim(str_replace("\r\n", "\n", $string));
}
- private function handleSave()
+ private static function handleSave()
{
$data = Request::post('templates');
if (is_array($data)) {
- $this->fetchTemplates();
- foreach ($this->templates as &$template) {
+ self::fetchTemplates();
+ foreach (self::$templates as &$template) {
if (isset($data[$template['name']])) {
- if ($this->forcmp($template['template']) !== $this->forcmp($data[$template['name']]['template'])) {
+ if (self::forcmp($template['template']) !== self::forcmp($data[$template['name']]['template'])) {
if (empty($template['original_template'])) {
$template['original_template'] = $template['template'];
}
$template['edit_version'] = $template['version'];
}
$template['original'] = (empty($template['original_template']) && $template['original'])
- || $this->forcmp($template['original_template']) === $this->forcmp($data[$template['name']]['template']);
+ || self::forcmp($template['original_template']) === self::forcmp($data[$template['name']]['template']);
if ($template['original']) {
$template['original_template'] = '';
}
@@ -98,7 +96,7 @@ class Page_mail_templates extends Page
}
}
unset($template);
- $data = json_encode(array('templates' => $this->templates));
+ $data = json_encode(array('templates' => self::$templates));
Database::exec("UPDATE sat.configuration SET value = :value WHERE parameter = 'templates'", array('value' => $data));
Message::addSuccess('templates-saved');
} else {
@@ -107,7 +105,7 @@ class Page_mail_templates extends Page
Util::redirect('?do=dozmod&section=templates');
}
- private function handleReset()
+ private static function handleReset()
{
$result = Download::asStringPost('http://127.0.0.1:9080/do/reset-mail-templates', array(), 10, $code);
if ($code == 999) {
@@ -120,17 +118,22 @@ class Page_mail_templates extends Page
Util::redirect('?do=dozmod&section=templates');
}
- private function fetchTemplates() {
+ private static function fetchTemplates() {
$templates= Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'templates'));
if ($templates != null) {
$templates = @json_decode($templates['value'], true);
if (is_array($templates)) {
- $names = array_map(function ($e) { return $e['name']; }, $templates['templates']);
+ $names = array_map(static function ($e) { return $e['name']; }, $templates['templates']);
array_multisort($names, SORT_ASC, $templates['templates']);
- $this->templates = $templates['templates'];
+ self::$templates = $templates['templates'];
}
}
}
+ public static function doAjax()
+ {
+
+ }
+
}
diff --git a/modules-available/dozmod/inc/pagedozmodusers.inc.php b/modules-available/dozmod/pages/users.inc.php
index f4ac852b..79d13827 100644
--- a/modules-available/dozmod/inc/pagedozmodusers.inc.php
+++ b/modules-available/dozmod/pages/users.inc.php
@@ -1,31 +1,31 @@
<?php
-class Page_dozmod_users extends Page
+class SubPage
{
- protected function doPreprocess()
+ public static function doPreprocess()
{
}
- protected function doRender()
+ public static function doRender()
{
- $this->listUsers();
- $this->listOrganizations();
+ self::listUsers();
+ self::listOrganizations();
}
- protected function doAjax()
+ protected static function doAjax()
{
User::load();
$action = Request::post('action', '', 'string');
if ($action === 'setmail' || $action === 'setsu' || $action == 'setlogin') {
if (User::hasPermission("users.".$action)) {
- $this->setUserOption($action);
+ self::setUserOption($action);
}
} elseif ($action === 'setorglogin') {
- if (User::hasPermission("users.orglogin")) {
- $this->setOrgOption($action);
+ if (User::hasPermission("users.setorglogin")) {
+ self::setOrgOption($action);
}
} else {
die('No such action');
@@ -34,7 +34,7 @@ class Page_dozmod_users extends Page
// Helpers
- private function listUsers()
+ private static function listUsers()
{
$res = Database::simpleQuery('SELECT userid, firstname, lastname, email, lastlogin, user.canlogin, issuperuser, emailnotifications,'
. ' organization.displayname AS orgname FROM sat.user'
@@ -42,35 +42,35 @@ class Page_dozmod_users extends Page
. ' ORDER BY lastname ASC, firstname ASC');
$rows = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $row['canlogin'] = $this->checked($row['canlogin']);
- $row['issuperuser'] = $this->checked($row['issuperuser']);
- $row['emailnotifications'] = $this->checked($row['emailnotifications']);
+ $row['canlogin'] = self::checked($row['canlogin']);
+ $row['issuperuser'] = self::checked($row['issuperuser']);
+ $row['emailnotifications'] = self::checked($row['emailnotifications']);
$row['lastlogin'] = date('d.m.Y', $row['lastlogin']);
$rows[] = $row;
}
Render::addTemplate('userlist', array('users' => $rows));
}
- private function listOrganizations()
+ private static function listOrganizations()
{
$res = Database::simpleQuery('SELECT organizationid, displayname, canlogin FROM sat.organization'
. ' ORDER BY displayname ASC');
$rows = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $row['canlogin'] = $this->checked($row['canlogin']);
+ $row['canlogin'] = self::checked($row['canlogin']);
$rows[] = $row;
}
Render::addTemplate('orglist', array('organizations' => $rows));
}
- private function checked($val)
+ private static function checked($val)
{
if ($val)
return 'checked="checked"';
return '';
}
- private function setUserOption($option)
+ private static function setUserOption($option)
{
$val = (string) Request::post('value', '-');
if ($val !== '1' && $val !== '0')
@@ -97,7 +97,7 @@ class Page_dozmod_users extends Page
die($val);
}
- private function setOrgOption($option)
+ private static function setOrgOption($option)
{
$val = (string) Request::post('value', '-');
if ($val !== '1' && $val !== '0')
diff --git a/modules-available/dozmod/permissions/permissions.json b/modules-available/dozmod/permissions/permissions.json
index b4ff034b..c149cb69 100644
--- a/modules-available/dozmod/permissions/permissions.json
+++ b/modules-available/dozmod/permissions/permissions.json
@@ -1,17 +1,17 @@
{
- "images.delete": {
+ "expiredimages.delete": {
"location-aware": false
},
- "log.showtarget": {
+ "actionlog.showtarget": {
"location-aware": false
},
- "log.showuser": {
+ "actionlog.showuser": {
"location-aware": false
},
- "mail.save": {
+ "mailconfig.save": {
"location-aware": false
},
- "mail.testmail": {
+ "mailconfig.testmail": {
"location-aware": false
},
"runtimeconfig.save": {
@@ -23,7 +23,7 @@
"templates.save": {
"location-aware": false
},
- "users.orglogin": {
+ "users.setorglogin": {
"location-aware": false
},
"users.setlogin": {
diff --git a/modules-available/dozmod/templates/images-delete.html b/modules-available/dozmod/templates/images-delete.html
index ed75a0d2..78690426 100644
--- a/modules-available/dozmod/templates/images-delete.html
+++ b/modules-available/dozmod/templates/images-delete.html
@@ -9,6 +9,7 @@
<div class="table-responsive">
<form id="delform" method="post" action="?do=DozMod" onsubmit="return slxPostdel()">
<input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="expiredimages">
<input type="hidden" name="action" value="delimages">
<table class="table table-stripped table-condensed stupidtable">
<thead>
diff --git a/modules-available/dozmod/templates/mailconfig.html b/modules-available/dozmod/templates/mailconfig.html
index d5d4db29..3aa1eda5 100644
--- a/modules-available/dozmod/templates/mailconfig.html
+++ b/modules-available/dozmod/templates/mailconfig.html
@@ -55,13 +55,14 @@
</div>
<br>
<div class="text-right">
- <button {{^allowedTest}}disabled{{/allowedTest}} class="btn btn-warning" type="button" id="test-button" name="button" value="test" onclick="slxTestConfig()"><span class="glyphicon glyphicon-envelope"></span> {{lang_test}}</button>
+ <button {{perms.mailconfig.testmail.disabled}} class="btn btn-warning" type="button" id="test-button" name="button" value="test" onclick="slxTestConfig()"><span class="glyphicon glyphicon-envelope"></span> {{lang_test}}</button>
<span id="test-spin" style="display:none"><span class="glyphicon glyphicon-refresh slx-rotation"></span></span>
- <pre id="test-output" style="display:none"></pre>
- <button {{^allowedSave}}disabled{{/allowedSave}} class="btn btn-primary" type="submit" name="button" value="save"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
+ <pre id="test-output" style="display:none;text-align:left"></pre>
+ <button {{perms.mailconfig.save.disabled}} class="btn btn-primary" type="submit" name="button" value="save"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
<br>
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="mail">
+ <input type="hidden" name="section" value="mailconfig">
</div>
</form>
</div>
diff --git a/modules-available/dozmod/templates/runtimeconfig.html b/modules-available/dozmod/templates/runtimeconfig.html
index 1d4cc6cb..e7295d48 100644
--- a/modules-available/dozmod/templates/runtimeconfig.html
+++ b/modules-available/dozmod/templates/runtimeconfig.html
@@ -116,6 +116,7 @@
<br>
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="runtime">
+ <input type="hidden" name="section" value="runtimeconfig">
<div class="text-right">
<button {{^allowedSave}}disabled{{/allowedSave}} class="btn btn-primary" type="submit" name="button" value="save"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
</div>