summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/dozmod')
-rw-r--r--modules-available/dozmod/api.inc.php12
-rw-r--r--modules-available/dozmod/config.json4
-rw-r--r--modules-available/dozmod/hooks/main-warning.inc.php12
-rw-r--r--modules-available/dozmod/lang/de/messages.json20
-rw-r--r--modules-available/dozmod/lang/de/module.json6
-rw-r--r--modules-available/dozmod/lang/de/permissions.json31
-rw-r--r--modules-available/dozmod/lang/de/template-tags.json58
-rw-r--r--modules-available/dozmod/lang/en/messages.json20
-rw-r--r--modules-available/dozmod/lang/en/module.json6
-rw-r--r--modules-available/dozmod/lang/en/permissions.json31
-rw-r--r--modules-available/dozmod/lang/en/template-tags.json56
-rw-r--r--modules-available/dozmod/page.inc.php349
-rw-r--r--modules-available/dozmod/pages/actionlog.inc.php (renamed from modules-available/dozmod/inc/pagedozmodlog.inc.php)72
-rw-r--r--modules-available/dozmod/pages/expiredimages.inc.php97
-rw-r--r--modules-available/dozmod/pages/ldapfilters.inc.php119
-rw-r--r--modules-available/dozmod/pages/mailconfig.inc.php96
-rw-r--r--modules-available/dozmod/pages/networkrules.inc.php98
-rw-r--r--modules-available/dozmod/pages/networkshares.inc.php108
-rw-r--r--modules-available/dozmod/pages/runscripts.inc.php133
-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)51
-rw-r--r--modules-available/dozmod/permissions/permissions.json73
-rw-r--r--modules-available/dozmod/style.css20
-rw-r--r--modules-available/dozmod/templates/actionlog-log.html6
-rw-r--r--modules-available/dozmod/templates/images-delete.html1
-rw-r--r--modules-available/dozmod/templates/ldapfilter-add.html39
-rw-r--r--modules-available/dozmod/templates/ldapfilters.html77
-rw-r--r--modules-available/dozmod/templates/mailconfig.html7
-rw-r--r--modules-available/dozmod/templates/networkrules-edit.html43
-rw-r--r--modules-available/dozmod/templates/networkrules.html82
-rw-r--r--modules-available/dozmod/templates/networkshares-edit.html84
-rw-r--r--modules-available/dozmod/templates/networkshares.html113
-rw-r--r--modules-available/dozmod/templates/runscripts-edit.html89
-rw-r--r--modules-available/dozmod/templates/runscripts-list.html89
-rw-r--r--modules-available/dozmod/templates/runtimeconfig.html5
-rw-r--r--modules-available/dozmod/templates/templates.html7
-rw-r--r--modules-available/dozmod/templates/userlist.html8
38 files changed, 1835 insertions, 450 deletions
diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php
index 74aaa003..74934dc9 100644
--- a/modules-available/dozmod/api.inc.php
+++ b/modules-available/dozmod/api.inc.php
@@ -17,7 +17,7 @@ if (!Module::isAvailable('locations')) {
define('LIST_URL', CONFIG_DOZMOD_URL . '/vmchooser/list');
define('VMX_URL', CONFIG_DOZMOD_URL . '/vmchooser/lecture');
-$availableRessources = ['list', 'vmx', 'test', 'netrules', 'runscript', 'netshares'];
+$availableRessources = ['list', 'vmx', 'netrules', 'runscript', 'metadata', 'netshares'];
/* BEGIN: A simple caching mechanism ---------------------------- */
@@ -216,6 +216,13 @@ function _getVmData($lecture_uuid, $subResource = false)
/** Caching wrapper around _getVmData() **/
function outputResource($lecture_uuid, $resource)
{
+ if ($resource === 'metadata') {
+ // HACK: config.tgz is compressed, don't use gzip output handler
+ @ob_end_clean();
+ Header('Content-Type: application/gzip');
+ } else {
+ Header('Content-Type: text/plain; charset=utf-8');
+ }
$key = $resource . '_' . $lecture_uuid;
if (cache_has($key)) {
cache_get_passthru($key);
@@ -268,7 +275,8 @@ if ($resource === false) {
}
if (!in_array($resource, $availableRessources)) {
- Util::traceError("unknown resource: $resource");
+ Header('HTTP/1.1 400 Bad Request');
+ die("unknown resource: $resource");
}
$ip = $_SERVER['REMOTE_ADDR'];
diff --git a/modules-available/dozmod/config.json b/modules-available/dozmod/config.json
index 706412d0..110f8b67 100644
--- a/modules-available/dozmod/config.json
+++ b/modules-available/dozmod/config.json
@@ -1,3 +1,3 @@
{
- "category":"main.content"
-}
+ "category": "main.content"
+} \ No newline at end of file
diff --git a/modules-available/dozmod/hooks/main-warning.inc.php b/modules-available/dozmod/hooks/main-warning.inc.php
index ffa87692..1778bb9d 100644
--- a/modules-available/dozmod/hooks/main-warning.inc.php
+++ b/modules-available/dozmod/hooks/main-warning.inc.php
@@ -4,8 +4,10 @@
* Show notification in main window if there are images that should be deleted and are waiting for confirmation
*/
-$res = Database::queryFirst("SELECT Count(*) AS cnt FROM sat.imageversion WHERE deletestate = 'SHOULD_DELETE'", array(), true);
-if (isset($res['cnt']) && $res['cnt'] > 0) {
- Message::addInfo('dozmod.images-pending-delete-exist', true, $res['cnt']);
-}
-unset($res);
+if (User::hasPermission('.dozmod.expiredimages.delete')) {
+ $res = Database::queryFirst("SELECT Count(*) AS cnt FROM sat.imageversion WHERE deletestate = 'SHOULD_DELETE'", array(), true);
+ if (isset($res['cnt']) && $res['cnt'] > 0) {
+ Message::addInfo('dozmod.images-pending-delete-exist', true, $res['cnt']);
+ }
+ unset($res);
+} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/de/messages.json b/modules-available/dozmod/lang/de/messages.json
index 60c37927..805472d0 100644
--- a/modules-available/dozmod/lang/de/messages.json
+++ b/modules-available/dozmod/lang/de/messages.json
@@ -3,9 +3,29 @@
"delete-images": "L\u00f6schung: {{0}}",
"dozmod-error": "Fehler bei der Kommunikation mit dem bwLehrpool-Suite server: {{0}}",
"images-pending-delete-exist": "Zur L\u00f6schung markierte VM-Versionen: {{0}}",
+ "ldap-filter-created": "LDAP Filter wurde erfolgreich erstellt",
+ "ldap-filter-deleted": "LDAP Filter wurde erfolgreich gel\u00f6scht",
+ "ldap-filter-id-missing": "Fehlende LDAP Filter ID",
+ "ldap-filter-insert-failed": "LDAP filter konnte der Datenbank nicht hinzugef\u00fcgt werden",
+ "ldap-filter-save-missing-information": "Es fehlen LDAP Filter Informationen",
+ "ldap-filter-saved": "LDAP Filter wurde erfolgreich gespeichert",
+ "ldap-invalid-filter-id": "Ung\u00fcltige LDAP Filter ID",
"mail-config-saved": "Mail-Konfiguration gespeichert",
+ "networkrule-deleted": "Netzwerk-Regel gel\u00f6scht",
+ "networkrule-invalid-direction": "Ung\u00fcltige Richtung: {{0}}",
+ "networkrule-invalid-ruleid": "Nicht-existierende Regel: {{0}}",
+ "networkrule-missing-host": "Fehlende Hostangabe",
+ "networkrule-missing-port": "Fehlende Portangabe",
+ "networkrule-saved": "Netzwerk-Regel gespeichert",
+ "networkshare-deleted": "Netzlaufwerk gel\u00f6scht",
+ "networkshare-invalid-auth-type": "Ung\u00fcltiger Authentifizierungs-Typ: {{0}}",
+ "networkshare-invalid-shareid": "Nicht-existierender Share: {{0}}",
+ "networkshare-missing-path": "Fehlende Pfadangabe",
+ "networkshare-saved": "Netzlaufwerk gespeichert",
"no-expired-images": "Keine Abgelaufenen VM-Versionen",
"nothing-submitted": "Es wurde nichts \u00fcbermittelt",
+ "runscript-invalid-id": "Ung\u00fcltige Script-ID: {{0}}",
+ "runscript-saved": "Script gespeichert",
"runtimelimits-config-saved": "Einstellungen gespeichert",
"templates-saved": "Templates wurden gespeichert",
"timeout": "Zeit\u00fcberschreitung",
diff --git a/modules-available/dozmod/lang/de/module.json b/modules-available/dozmod/lang/de/module.json
index 02e8c84d..ff4519a7 100644
--- a/modules-available/dozmod/lang/de/module.json
+++ b/modules-available/dozmod/lang/de/module.json
@@ -3,8 +3,12 @@
"page_title": "Verwalten der bwLehrpool-Suite",
"submenu_actionlog": "Aktions-Log",
"submenu_expiredimages": "Abgelaufene VM-Versionen",
+ "submenu_ldapfilters": "LDAP-Filter",
"submenu_mailconfig": "Email-Konfiguration",
- "submenu_runtime": "Limits und Standardwerte",
+ "submenu_networkrules": "Netzwerk-Regeln",
+ "submenu_networkshares": "Netzlaufwerke",
+ "submenu_runscripts": "Startskripte",
+ "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..8e743e5c 100644
--- a/modules-available/dozmod/lang/de/permissions.json
+++ b/modules-available/dozmod/lang/de/permissions.json
@@ -1,14 +1,21 @@
{
- "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.view": "Aktions-Log einsehen.",
+ "expiredimages.delete": "Zur L\u00f6schung vorgemerkete Abbilder l\u00f6schen.",
+ "ldapfilters.save": "LDAP Filter speichern.",
+ "ldapfilters.view": "LDAP Filter einsehen.",
+ "mailconfig.save": "\u00c4nderungen an der SMTP-Konfiguration zum Versenden von Mails speichern.",
+ "networkrules.save": "\u00c4nderungen an den Netzwerk-Regeln speichern.",
+ "networkrules.view": "Netzwerk-Regeln einsehen.",
+ "networkshares.save": "\u00c4nderungen an den Netzlaufwerken speichern.",
+ "networkshares.view": "Netzlaufwerke einsehen.",
+ "runscripts.save": "Startkripte erstellen\/bearbeiten.",
+ "runscripts.view": "Startscripte auflisten.",
+ "runtimeconfig.save": "\u00c4nderungen an der Laufzeit-Konfiguration speichern.",
+ "templates.reset": "E-Mail Templates zur\u00fccksetzen.",
+ "templates.save": "E-Mail Templates speichern.",
+ "users.setlogin": "Anmeldungen f\u00fcr einzelne Benutzer aktivieren\/deaktivieren.",
+ "users.setmail": "E-Mail Benachrichtigungen f\u00fcr einzelne Benutzer aktivieren\/deaktivieren.",
+ "users.setorglogin": "Anmeldungen f\u00fcr Benutzer von bestimmten Einrichtungen aktivieren\/deaktivieren.",
+ "users.setsu": "Benutzer zu SuperUser ernennen.",
+ "users.view": "Benutzerliste sehen."
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/de/template-tags.json b/modules-available/dozmod/lang/de/template-tags.json
index a1c23d2e..3e000676 100644
--- a/modules-available/dozmod/lang/de/template-tags.json
+++ b/modules-available/dozmod/lang/de/template-tags.json
@@ -1,8 +1,12 @@
{
"lang_actionTarget": "Aktionsziel",
+ "lang_active": "Aktiv",
+ "lang_addRule": "Netzwerk-Regel hinzuf\u00fcgen",
+ "lang_addShare": "Netzlaufwerk hinzuf\u00fcgen",
"lang_allowLoginByDefault": "Login standardm\u00e4\u00dfig erlauben",
"lang_allowLoginDescription": "Wenn diese Option aktiviert ist, k\u00f6nnen sich alle Mitarbeiter der Einrichtung \u00fcber die bwLehrpool-Suite anmelden und VMs\/Veranstaltungen verwalten. Wenn Sie diese Option deaktivieren, m\u00fcssen Sie in der Untersektion \"Benutzer und Berechtigungen\" jeden Benutzer nach dem ersten Loginversuch manuell freischalten.",
"lang_asteriskRequired": "Felder mit (*) sind erforderlich",
+ "lang_authMethod": "Authentifizierung",
"lang_blockCount": "Anzahl Bl\u00f6cke",
"lang_bwlehrpoolsuite": "bwLehrpool-Suite",
"lang_canLoginOrganization": "Nutzer dieser Einrichtung k\u00f6nnen sich am Satelliten anmelden",
@@ -20,7 +24,11 @@
"lang_descriptionPermissionConfig": "Dies sind die Berechtigungen, die ein Benutzer standardm\u00e4\u00dfig f\u00fcr fremde VMs\/Veranstaltungen hat. Sie werden angewandt, wenn der Besitzer keine anderweitigen Berechtigungen w\u00e4hlt.",
"lang_descriptionRuntimeLimits": "Hier k\u00f6nnen Sie verschiedene Limits festlegen, z.B. wie lange eine VM nach dem Hochladen g\u00fcltig ist. Nach Ablauf dieses Zeitraums ist der Verantwortliche gezwungen, eine neue Version der VM hochzuladen. Damit k\u00f6nnen Sie das Ansammeln nicht mehr ben\u00f6tigter VMs eind\u00e4mmen. Weiterhin k\u00f6nnen Sie die maximale Anzahl gleichzeitiger Transfers pro Benutzer einschr\u00e4nken.\r\n\r\nVer\u00e4nderte Einstellungen wirken sich nicht auf bereits bestehende VMs aus.",
"lang_description_delete_images": "Diese Liste zeigt VMs, die entweder abgelaufen sind, oder deren Datei besch\u00e4digt, verschoben oder gel\u00f6scht wurde. Diese Images sind zur Zeit im Lehrpool nicht verf\u00fcgbar, ihre endg\u00fcltige L\u00f6schung muss aber manuell best\u00e4tigt werden, um gr\u00f6\u00dfere Katastrophen durch Softwarefehler, verstellte Systemuhren etc. zu vermeiden.",
+ "lang_direction": "Richtung",
"lang_dozmodLogHeading": "bwLehrpool-Suite Aktionslog",
+ "lang_editNetworkrule": "Netzwerk-Regel bearbeiten",
+ "lang_editNetworkshare": "Netzlaufwerk bearbeiten",
+ "lang_editScript": "Startscript bearbeiten",
"lang_email": "EMail",
"lang_emailNotifications": "EMail-Benachrichtigungen aktiviert",
"lang_error": "Fehler",
@@ -30,50 +38,85 @@
"lang_hasNewer": "Neuere Version existiert",
"lang_hash": "Hash",
"lang_heading": "Zu l\u00f6schende VM-Versionen",
+ "lang_hidden": "Versteckt",
"lang_host": "Host",
"lang_image": "VM",
"lang_lastEditor": "Zuletzt bearbeitet von",
"lang_lastLogin": "Letzte Anmeldung",
"lang_latestVersion": "Neuste Version",
+ "lang_ldapFilterAdd": "LDAP-Filter hinzuf\u00fcgen",
+ "lang_ldapFilterAttribute": "Attribut",
+ "lang_ldapFilterDeleteConfirmation": "Wollen Sie diesen LDAP-Filter wirklich l\u00f6schen?",
+ "lang_ldapFilterDescription": "Dies sind die Filter, die ein Benutzer in der bwLehrpool-Suite Veranstaltungen hinzuf\u00fcgen kann.",
+ "lang_ldapFilterEdit": "LDAP-Filter bearbeiten",
+ "lang_ldapFilterName": "Filtername",
+ "lang_ldapFilterValue": "Wert",
+ "lang_ldapfilters": "LDAP-Filter",
+ "lang_ldapfiltersIntro": "Hier k\u00f6nnen Sie Vorgaben f\u00fcr veranstaltungsspezifische LDAP-Filter machen. LDAP-Filter sind einfache Attributsfilter, die clientseitig Anwendung finden. Die hier definierten Filter werden in der bwLehrpool-Suite als Vorschl\u00e4ge aufgelistet und k\u00f6nnen mittels Checkbox aktiviert werden. Alternativ k\u00f6nnen in der bwLehrpool-Suite auch eigene Filter angelegt werden.",
"lang_lecture": "Veranstaltung",
"lang_lecturePermissionAdmin": "Administration",
"lang_lecturePermissionEdit": "Bearbeiten",
"lang_loadDefaults": "Alle Texte auf Auslieferungszustand zur\u00fccksetzen",
+ "lang_loggedInUser": "Angemeldeter Nutzer",
"lang_mailConfig": "SMTP-Konfiguration zum Versenden von Mails",
- "lang_mailConfigHeadline": "EMail-Konfiguration",
"lang_mailDescription": "F\u00fcllen Sie die folgenden Felder aus, wenn sie m\u00f6chten, dass Dozierende per Mail benachrichtigt werden, falls eine von ihnen genutzte oder erstellte VM oder Veranstaltung abl\u00e4uft. Um diese Funktion zu deaktivieren, lassen Sie eines der mit (*) gekennzeichneten Felder leer. Wenn das hier angegebene E-Mail-Konto nur zum Versenden von Mails genutzt wird, sollten Sie einen Auto-Responder einrichten f\u00fcr den Fall, dass ein Dozierender auf eine der automatisch generierten Mails antwortet (bzw. eine explizit angegebene Reply-To Adresse ignoriert).",
"lang_mailTemplates": "E-Mail Templates",
"lang_maxImageValidity": "G\u00fcltigkeitsdauer neuer VM-Versionen (Tage)",
"lang_maxLectureVisibility": "Sp\u00e4testes Enddatum einer Veranstaltung (Tage in der Zukunft)",
"lang_maxLocationsPerLecture": "Max. explizite Orte pro Veranstaltung",
"lang_maxTransfers": "Maximale Zahl gleichzeitiger Up-\/Downloads pro Benutzer",
+ "lang_minimized": "Minimiert",
"lang_miscOptions": "Verschiedene Einstellungen",
"lang_modified": "Modifiziert",
+ "lang_name": "Name",
+ "lang_networkrules": "Netzwerk-Regeln",
+ "lang_networkrulesIntro": "Hier k\u00f6nnen Sie vordefinierte Regelsets f\u00fcr das Firewalling verwalten. Nutzer der bwLehrpool-Suite k\u00f6nnen auf diese Regelsets zur\u00fcckgreifen, um den Netzwerkzugriff ihrer Veranstaltungen einzuschr\u00e4nken.",
+ "lang_networkshares": "Netzlaufwerke",
+ "lang_networksharesIntro": "Hier k\u00f6nnen Sie vordefinierte Netzlaufwerke anlegen, die den Nutzern der bwLehrpool-Suite zur Auswahl gestellt werden. Es ist den Nutzern der bwLehrpool-Suite weiterhin m\u00f6glich, komplett eigene Netzwerkfreigaben zu definieren. Die Angaben hier sollen lediglich das Hinzuf\u00fcgen h\u00e4ufig genutzter Laufwerke vereinfachen, bzw. das \u00c4ndern eines Netzwerkpfades vereinfachen, da in diesem Fall nur der Zentrale Eintrag hier angepasst werden muss, und nicht mehr wie zuvor jede Veranstaltung einzeln.",
+ "lang_none": "(Keiner)",
+ "lang_normal": "Normal",
"lang_organization": "Einrichtung",
- "lang_organizationList": "Liste der Einrichtungen",
"lang_organizationListHeader": "Nutzungsrechte f\u00fcr den Satelliten festlegen",
"lang_os": "Betriebssystem",
"lang_owner": "Besitzer",
- "lang_passwordplaceholder": "SMTP Passwort",
+ "lang_passwordplaceholder": "SMTP-Passwort",
+ "lang_path": "Pfad",
"lang_placeholders": "Platzhalter",
"lang_port": "Port",
+ "lang_printer": "Drucker",
"lang_reallyResetTemplates": "Sind Sie sicher, dass Sie alle Texte l\u00f6schen und auf die Standardwerte zur\u00fccksetzen wollen?",
"lang_replaceWithOriginal": "Originaltext in Textbox laden",
"lang_replyTo": "Reply-To Adresse",
+ "lang_ruleDeleteConfirm": "Soll dieses Regelset wirklich gel\u00f6scht werden?",
+ "lang_runScriptAdd": "Skript hinzuf\u00fcgen",
+ "lang_runScriptDeleteConfirmation": "Skript wirklich l\u00f6schen?",
"lang_runtimeConfig": "Laufzeit-Konfiguration",
- "lang_runtimeConfigHeadline": "Laufzeit-Konfiguration",
"lang_runtimeConfigLimits": "Beschr\u00e4nkungen",
+ "lang_scriptContent": "Skriptinhalt",
+ "lang_scriptExtension": "Dateinamenerweiterung",
+ "lang_scriptExtensionHead": "Erweiterung",
+ "lang_scriptIsGlobal": "Skript ist global, wird in jeder Veranstaltung ausgef\u00fchrt",
+ "lang_scriptIsGlobalHead": "Global",
+ "lang_scriptIsPredefined": "Skript ist ein vordefiniertes Skript, das in der bwLehrpool-Suite zur Auswahl steht",
+ "lang_scriptPassCredentials": "Benutzername\/Passwort an dieses Skript \u00fcbergeben",
+ "lang_scriptPassCredentialsHead": "User\/Pass",
+ "lang_scriptVisibility": "Anzeigemodus",
+ "lang_scriptVisibilityHead": "Anzeige",
+ "lang_scriptsHead": "Startskripte f\u00fcr Virtuelle Umgebungen",
+ "lang_scriptsIntro": "Hier k\u00f6nnen Sie Startskripte definieren, die entweder global bei jedem Start einer Veranstaltung ausgef\u00fchrt werden, oder den Nutzerinnen der bwLehrpool-Suite zur Vorauswahl zur Verf\u00fcgung gestellt werden.",
"lang_senderAddress": "Absenderadresse",
"lang_senderName": "Absender Anzeigename",
+ "lang_shareDeleteConfirm": "Wollen Sie dieses Netzlaufwerk wirklich l\u00f6schen?",
"lang_size": "Gr\u00f6\u00dfe",
"lang_spaceWastedDuplication": "Potentiell durch mehrfach vorkommende Bl\u00f6cke belegter Speicherplatz",
+ "lang_specificUser": "Spezifischer Nutzer",
"lang_ssl": "SSL-Modus",
"lang_sslExplicit": "Explizites SSL (\"STARTTLS\")",
"lang_sslImplicit": "Implizites SSL",
"lang_sslNone": "Kein SSL",
- "lang_subHeading": "Images, die abgelaufen oder besch\u00e4digt sind",
"lang_superUser": "Ist SuperUser (darf alle Veranstaltungen und VMs bearbeiten\/l\u00f6schen)",
"lang_system": "System",
+ "lang_target": "Ziel",
"lang_template": "Template",
"lang_templatePageDescription": "Hier k\u00f6nnen Sie die Textbausteine bearbeiten, aus denen die Mails generiert werden, die der bwLehrpool-Server bez\u00fcglich Virtueller Maschinen und Veranstaltungen versendet. Diese Funktionalit\u00e4t unterst\u00fctzt zur Zeit keine Internationalisierung.",
"lang_test": "Test-Mail senden",
@@ -83,10 +126,9 @@
"lang_updateTime": "Letzte Bearbeitung",
"lang_user": "Benutzername",
"lang_userId": "Benutzer-ID",
- "lang_userList": "Benutzerliste",
"lang_userListDescription": "Hier k\u00f6nnen Sie individuelle Nutzer zu \"Super-Usern\" machen. Diese haben in der bwLehrpool-Suite auf alle Veranstaltungen und VMs Vollzugriff, unabh\u00e4ngig von den gesetzten Berechtigungen. Au\u00dferdem k\u00f6nnen Sie hier Benutzer vom Zugriff mittels der bwLehrpool-Suite ausschlie\u00dfen.",
"lang_userListHeader": "Dem Satelliten bekannte Benutzer",
- "lang_usernameplaceholder": "SMTP Benutzername",
+ "lang_usernameplaceholder": "SMTP-Benutzername",
"lang_version": "Version vom",
"lang_when": "Wann"
-}
+} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/en/messages.json b/modules-available/dozmod/lang/en/messages.json
index 6d7ea0ac..2d813efc 100644
--- a/modules-available/dozmod/lang/en/messages.json
+++ b/modules-available/dozmod/lang/en/messages.json
@@ -3,9 +3,29 @@
"delete-images": "Delete: {{0}}",
"dozmod-error": "Error communicating with the bwLehrpool-Suite server: {{0}}",
"images-pending-delete-exist": "VMs marked for deletion: {{0}}",
+ "ldap-filter-created": "LDAP filter was successfully created",
+ "ldap-filter-deleted": "LDAP filter successfully deleted",
+ "ldap-filter-id-missing": "LDAP filter id was missing",
+ "ldap-filter-insert-failed": "LDAP filter could not be inserted into the database",
+ "ldap-filter-save-missing-information": "LDAP filter information is missing",
+ "ldap-filter-saved": "Successfully modified LDAP filter",
+ "ldap-invalid-filter-id": "Invalid LDAP filter id",
"mail-config-saved": "Mail config saved",
+ "networkrule-deleted": "Network rule deleted",
+ "networkrule-invalid-direction": "Invalid direction: {{0}}",
+ "networkrule-invalid-ruleid": "Invalid rule id: {{0}}",
+ "networkrule-missing-host": "Missing host",
+ "networkrule-missing-port": "Missing port",
+ "networkrule-saved": "Network rule saved",
+ "networkshare-deleted": "Network share deleted",
+ "networkshare-invalid-auth-type": "Invalid auth type: {{0}}",
+ "networkshare-invalid-shareid": "Invalid share id: {{0}}",
+ "networkshare-missing-path": "Missing network path",
+ "networkshare-saved": "Network share saved",
"no-expired-images": "No expired VMs",
"nothing-submitted": "There was nothing submitted",
+ "runscript-invalid-id": "Invalid script id: {{0}}",
+ "runscript-saved": "Script has been saved",
"runtimelimits-config-saved": "Configuration saved successfully",
"templates-saved": "Templates saved successfully",
"timeout": "Timeout",
diff --git a/modules-available/dozmod/lang/en/module.json b/modules-available/dozmod/lang/en/module.json
index 17a2b838..5bcee464 100644
--- a/modules-available/dozmod/lang/en/module.json
+++ b/modules-available/dozmod/lang/en/module.json
@@ -3,8 +3,12 @@
"page_title": "Manage the bwLehrpool-Suite",
"submenu_actionlog": "action log",
"submenu_expiredimages": "Expired VM versions",
+ "submenu_ldapfilters": "LDAP filters",
"submenu_mailconfig": "email configuration",
- "submenu_runtime": "limits and defaults",
+ "submenu_networkrules": "Network Rules",
+ "submenu_networkshares": "Network Shares",
+ "submenu_runscripts": "Startup scripts",
+ "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..b0fbb071 100644
--- a/modules-available/dozmod/lang/en/permissions.json
+++ b/modules-available/dozmod/lang/en/permissions.json
@@ -1,14 +1,21 @@
{
- "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.view": "View action log.",
+ "expiredimages.delete": "Delete images marked for deletion.",
+ "ldapfilters.save": "Save LDAP filter.",
+ "ldapfilters.view": "View LDAP filters. ",
+ "mailconfig.save": "Save SMTP configuration for sending mails.",
+ "networkrules.save": "Save network rules.",
+ "networkrules.view": "View network rules.",
+ "networkshares.save": "Save network drives.",
+ "networkshares.view": "View network drives.",
+ "runscripts.save": "Save startup scripts.",
+ "runscripts.view": "View startup scripts.",
+ "runtimeconfig.save": "Save limits and defaults of a runtime configuration.",
+ "templates.reset": "Reset email templates.",
+ "templates.save": "Save email templates.",
+ "users.setlogin": "Enable\/Disable Login.",
+ "users.setmail": "Enable\/Disable Email Notification.",
+ "users.setorglogin": "Enalbe\/Disable Login for Users from certain organisations.",
+ "users.setsu": "Set User to superuser.",
+ "users.view": "View user list."
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/en/template-tags.json b/modules-available/dozmod/lang/en/template-tags.json
index f12e4ab8..c33d872b 100644
--- a/modules-available/dozmod/lang/en/template-tags.json
+++ b/modules-available/dozmod/lang/en/template-tags.json
@@ -1,8 +1,12 @@
{
"lang_actionTarget": "Action target",
+ "lang_active": "Active",
+ "lang_addRule": "Add Network Rule",
+ "lang_addShare": "Add Network Share",
"lang_allowLoginByDefault": "Allow all staff members to login and use the bwLehrpool-Suite",
"lang_allowLoginDescription": "If this option is enabled, all members of the organization marked as staff or employee are allowed to login to this server and manage VMs\/courses. Otherwise, new users need to be individually allowed access after their first login attempt by visiting the sub page \"users and permissions\" in this web interface.",
"lang_asteriskRequired": "Fields marked with (*) are required",
+ "lang_authMethod": "Authentication",
"lang_blockCount": "Block count",
"lang_bwlehrpoolsuite": "bwLehrpool-Suite",
"lang_canLoginOrganization": "Users from this organization can login",
@@ -20,60 +24,99 @@
"lang_descriptionPermissionConfig": "These are the default permissions being used for VMs and lectures if the owner does not specify any.",
"lang_descriptionRuntimeLimits": "Here you can define some limits, e.g. how long a newly uploaded VM will be valid. This should make sure that you don't end up with a lot of old, unused VMs over time.\r\n\r\nModified settings won't apply for already existing VMs.",
"lang_description_delete_images": "This is a list of VMs that either expired, or where the disk image is damaged or missing. These VMs are not available in bwLehrpool currently, but you have to manually confirm the deletion of the disk images for safety reasons (clock skew etc.)",
+ "lang_direction": "Direction",
"lang_dozmodLogHeading": "bwLehrpool-Suite action log",
+ "lang_editNetworkrule": "Edit Network Rule",
+ "lang_editNetworkshare": "Edit Network Share",
+ "lang_editScript": "Edit start script",
"lang_email": "E-Mail",
"lang_emailNotifications": "E-Mail notifications enabled",
"lang_error": "Error",
"lang_event": "Event",
"lang_fileSize": "File size",
"lang_followingPlaceholdersUnused": "The following placeholders are not being used",
- "lang_hasNewer": "Newer version exists",
+ "lang_hasNewer": "newer version exists",
"lang_hash": "Hash",
"lang_heading": "Images Marked for Deletion",
+ "lang_hidden": "Hidden",
"lang_host": "Host",
"lang_image": "VM",
"lang_lastEditor": "Edited by",
"lang_lastLogin": "Last login",
"lang_latestVersion": "latest version",
+ "lang_ldapFilterAdd": "Add LDAP filter",
+ "lang_ldapFilterAttribute": "Attribute",
+ "lang_ldapFilterDeleteConfirmation": "Do you really want to delete this LDAP filter.",
+ "lang_ldapFilterDescription": "These are the LDAP filters that can be applied to lectures in the bwLehrpool-Suite.",
+ "lang_ldapFilterEdit": "Edit LDAP filter",
+ "lang_ldapFilterName": "Filter name",
+ "lang_ldapFilterValue": "Value",
+ "lang_ldapfilters": "LDAP filters",
+ "lang_ldapfiltersIntro": "This is the list of predefined lecture filters, based on LDAP attributes. These filters can be applied client side to only show lectures to specific user groups. These predefined filters are shown in the bwLehrpool-Suite when editing a lecture, and can be activated by a simple check box. Users of the bwLehrpool-Suite can either make use of these predefined filters, or add custom ones if desired.",
"lang_lecture": "Lecture",
"lang_lecturePermissionAdmin": "Administrate",
"lang_lecturePermissionEdit": "Edit",
"lang_loadDefaults": "Reset all templates to their defaults",
+ "lang_loggedInUser": "Logged in User",
"lang_mailConfig": "SMTP configuration for sending mails",
- "lang_mailConfigHeadline": "Email Configuration",
"lang_mailDescription": "Fill in the following fields if you want to notify tutors\/professors\/lecturers about expiring VMs and lectures. If you leave one of the required fields blank, the feature will be disabled.",
"lang_mailTemplates": "E-Mail Templates",
"lang_maxImageValidity": "New VM validity (days)",
"lang_maxLectureVisibility": "Max time lecture end date may lie in the future (days)",
"lang_maxLocationsPerLecture": "Max. explicit locations per lecture",
"lang_maxTransfers": "Max concurrent transfers per user",
+ "lang_minimized": "Minimized",
"lang_miscOptions": "Misc options",
"lang_modified": "modified",
+ "lang_name": "Name",
+ "lang_networkrules": "Network Rules",
+ "lang_networkrulesIntro": "This is where you can create predefined rulesets for the lecture-based firewalling. bwLehrpool-Suite users can select those rulesets to limit network access of their lectures.",
+ "lang_networkshares": "Network Shares",
+ "lang_networksharesIntro": "This is the list of predefined network shares. bwLehrpool-Suite users can still add custom network shares to their lectures, however having commonly used network shares as predefined entries should be much more convenient. Another advantage is that changing the path of a network share centrally avoids having to edit a dozen lectures' configuration manually.",
+ "lang_none": "(none)",
+ "lang_normal": "Normal",
"lang_organization": "Organization",
- "lang_organizationList": "List of Organizations",
"lang_organizationListHeader": "Set access permissions for organizations",
"lang_os": "Operating System",
"lang_owner": "Owner",
"lang_passwordplaceholder": "SMTP Password",
+ "lang_path": "Path",
"lang_placeholders": "Placeholders",
"lang_port": "Port",
+ "lang_printer": "Printer",
"lang_reallyResetTemplates": "Are you sure you want to reset all texts to their default values?",
"lang_replaceWithOriginal": "load original text into text box",
"lang_replyTo": "Reply-To address",
+ "lang_ruleDeleteConfirm": "Do you want to delete this ruleset?",
+ "lang_runScriptAdd": "Add run-script",
+ "lang_runScriptDeleteConfirmation": "Do you want to delete this run-script?",
"lang_runtimeConfig": "Limits and Defaults",
- "lang_runtimeConfigHeadline": "Configure Limits and Defaults for bwLehrpool-Suite",
"lang_runtimeConfigLimits": "Limitations",
+ "lang_scriptContent": "Script content",
+ "lang_scriptExtension": "Script extension",
+ "lang_scriptExtensionHead": "Extension",
+ "lang_scriptIsGlobal": "Global script, will execute in every lecture environment",
+ "lang_scriptIsGlobalHead": "Global",
+ "lang_scriptIsPredefined": "Predefined script, selectable by bwLehrpool-Suite users for individual lectures",
+ "lang_scriptPassCredentials": "Pass username and password to this script",
+ "lang_scriptPassCredentialsHead": "User\/Pass",
+ "lang_scriptVisibility": "Display mode",
+ "lang_scriptVisibilityHead": "Display",
+ "lang_scriptsHead": "Run-scripts for lecture environments",
+ "lang_scriptsIntro": "Here you can define scripts that will either forcefully run at startup of a lecture, or are selectable by bwLehrpool-Suite users.",
"lang_senderAddress": "Sender address",
"lang_senderName": "Sender's display name",
+ "lang_shareDeleteConfirm": "Do you really want to delete this network share?",
"lang_size": "Size",
"lang_spaceWastedDuplication": "Potentially wasted space by duplicate blocks",
+ "lang_specificUser": "Specific User",
"lang_ssl": "SSL mode",
"lang_sslExplicit": "Explicit SSL (\"STARTTLS\")",
"lang_sslImplicit": "Implicit SSL",
"lang_sslNone": "No SSL",
- "lang_subHeading": "Expired or damaged images",
"lang_superUser": "Is super user (can edit\/delete all lectures and VMs)",
"lang_system": "System",
+ "lang_target": "Target",
"lang_template": "Template",
"lang_templatePageDescription": "Here you can edit text fragments that are used to compose the information and reminder mails sent by the bwLehrpool server, e.g. when a lecture or VM is about to expire.",
"lang_test": "Send test mail",
@@ -83,10 +126,9 @@
"lang_updateTime": "Last update",
"lang_user": "User name",
"lang_userId": "User id",
- "lang_userList": "User List",
"lang_userListDescription": "Here you can promote \"super users\", which will have all permissions in the bwLehrpool-Suite. You can also ban users from accessing this server via the bwLehrpool-Suite.",
"lang_userListHeader": "Users known to this satellite",
"lang_usernameplaceholder": "SMTP Username",
"lang_version": "Version timestamp",
"lang_when": "When"
-}
+} \ No newline at end of file
diff --git a/modules-available/dozmod/page.inc.php b/modules-available/dozmod/page.inc.php
index b58d57aa..67b791d1 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', 'networkshares', 'ldapfilters', 'runscripts', 'networkrules'];
+
+ 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,45 @@ 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;
- }
-
- /* execute actions */
- $action = Request::post('action', false, 'string');
+ if ($this->haveSubPage !== false) {
+ SubPage::doPreprocess();
+ }
+ // Catch unhandled POST redirect
+ if (Request::isPost()) {
+ Util::redirect('?do=dozmod&section=' . $this->section);
+ }
+
+ /* 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);
+ Dictionary::translate('submenu_networkshares', true);
+ Dictionary::translate('submenu_ldapfilters', true);
+ Dictionary::translate('submenu_runscripts', true);
+ Dictionary::translate('submenu_networkrules', 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 +104,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 +150,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..a014ddf7 100644
--- a/modules-available/dozmod/inc/pagedozmodlog.inc.php
+++ b/modules-available/dozmod/pages/actionlog.inc.php
@@ -1,25 +1,26 @@
<?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 . '"');
+ User::assertPermission("actionlog.view");
+ 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 +29,58 @@ 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') {
+ self::listUser();
} else {
- if (User::hasPermission("log.showtarget")) {
- $this->listTarget();
- }
+ 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 +91,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 +102,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 +114,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 +125,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 +152,12 @@ class Page_dozmod_log extends Page
$data['showTarget'] = true;
}
- $data['allowedShowUser'] = User::hasPermission("log.showuser");
- $data['allowedShowTarget'] = User::hasPermission("log.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/ldapfilters.inc.php b/modules-available/dozmod/pages/ldapfilters.inc.php
new file mode 100644
index 00000000..d0ae41b8
--- /dev/null
+++ b/modules-available/dozmod/pages/ldapfilters.inc.php
@@ -0,0 +1,119 @@
+<?php
+
+class SubPage
+{
+ private static $show;
+
+ public static function doPreprocess()
+ {
+ self::$show = Request::any('show', false, 'string');
+ $action = Request::post('action');
+
+ if ($action === 'deleteFilter') {
+ User::assertPermission("ldapfilters.save");
+ self::deleteLdapFilter();
+ } else if ($action === 'saveFilter') {
+ User::assertPermission("ldapfilters.save");
+ self::saveLdapFilter();
+ }
+ User::assertPermission("ldapfilters.view");
+ }
+
+ public static function doRender()
+ {
+ if (self::$show === false) {
+ // Get all ldapfilters from the sat db.
+ $ldapfilters = Database::queryAll("SELECT filterid, filtername, filterkey, filtervalue FROM sat.presetlecturefilter
+ WHERE filtertype ='LDAP' ORDER BY filtername ASC");
+
+ $data = array(
+ 'ldapfilters' => $ldapfilters,
+ 'hasEditPermission' => User::hasPermission('ldapfilters.save')
+ );
+
+ Render::addTemplate('ldapfilters', $data);
+ } else if (self::$show === 'edit') {
+ $filterid = Request::get('filterid', false, 'int');
+
+ if ($filterid === false) {
+ Render::addTemplate('ldapfilter-add', array(
+ 'filterid' => 0
+ ));
+ } else {
+ $ldapfilter = Database::queryFirst("SELECT filterid, filtername, filterkey, filtervalue FROM sat.presetlecturefilter
+ WHERE filterid = :id AND filtertype = 'LDAP'", array( 'id' => $filterid));
+ // TODO: Show error if not exists
+
+ Render::addTemplate('ldapfilter-add', $ldapfilter);
+ }
+ }
+ }
+
+ private static function deleteLdapFilter() {
+ User::assertPermission('ldapfilters.save');
+ $filterid = Request::post('filterid', false, 'int');
+ if ($filterid === false) {
+ Message::addError('ldap-filter-id-missing');
+ return;
+ }
+ $res = Database::exec("DELETE FROM sat.presetlecturefilter WHERE filterid = :id AND filtertype = 'LDAP'", array('id' => $filterid));
+ if ($res !== 1) {
+ Message::addWarning('ldap-invalid-filter-id', $filterid);
+ } else {
+ Message::addSuccess('ldap-filter-deleted');
+ }
+ }
+
+ private static function saveLdapFilter() {
+ $filterid = Request::post('filterid', '', 'int');
+ $filtername = Request::post('filtername', false, 'string');
+ $filterattribute = Request::post('attribute', false, 'string');
+ $filtervalue = Request::post('value', false, 'string');
+
+ if ($filtername === false || $filterattribute === false || $filtervalue === false) {
+ Message::addError('ldap-filter-save-missing-information');
+ return;
+ }
+
+ if ($filterid === 0) {
+ // Insert filter in the db.
+ $res = Database::exec("INSERT INTO sat.presetlecturefilter (filtertype, filtername, filterkey, filtervalue)
+ VALUES ('LDAP', :filtername, :attribute, :value)", array(
+ 'filtername' => $filtername,
+ 'attribute' => $filterattribute,
+ 'value' => $filtervalue
+ ));
+
+ if ($res !== 1) {
+ Message::addError('ldap-filter-insert-failed');
+ } else {
+ Message::addSuccess('ldap-filter-created');
+ }
+
+ } else {
+ // Update filter in the db.
+ $res = Database::exec("UPDATE sat.presetlecturefilter SET
+ filtername = :filtername, filterkey = :attribute, filtervalue = :value
+ WHERE filterid = :filterid AND filtertype = 'LDAP'", array(
+ 'filterid' => $filterid,
+ 'filtername' => $filtername,
+ 'attribute' => $filterattribute,
+ 'value' => $filtervalue
+ ));
+
+ if ($res !== 1) {
+ Message::addError('ldap-filter-insert-failed');
+ } else {
+ Message::addSuccess('ldap-filter-saved');
+ }
+
+ }
+ Util::redirect("?do=dozmod&section=ldapfilters");
+ }
+
+ public static function doAjax()
+ {
+
+ }
+
+} \ No newline at end of file
diff --git a/modules-available/dozmod/pages/mailconfig.inc.php b/modules-available/dozmod/pages/mailconfig.inc.php
new file mode 100644
index 00000000..08205f2e
--- /dev/null
+++ b/modules-available/dozmod/pages/mailconfig.inc.php
@@ -0,0 +1,96 @@
+<?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']);
+ Render::addTemplate('mailconfig', $mailConf);
+ }
+
+ public static function doAjax()
+ {
+ User::assertPermission("mailconfig.save");
+ $action = Request::post('action');
+ if ($action === 'mail') {
+ 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/networkrules.inc.php b/modules-available/dozmod/pages/networkrules.inc.php
new file mode 100644
index 00000000..6011e3ff
--- /dev/null
+++ b/modules-available/dozmod/pages/networkrules.inc.php
@@ -0,0 +1,98 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ $action = Request::post('action', '', 'string');
+
+ if ($action === 'delete') {
+ User::assertPermission('networkrules.save');
+ $ruleid = Request::post('ruleid', false, 'int');
+ if ($ruleid !== false) {
+ $res = Database::exec('DELETE FROM sat.presetnetworkrules WHERE ruleid = :ruleid', ['ruleid' => $ruleid]);
+ if ($res !== false) {
+ Message::addSuccess('networkrule-deleted');
+ }
+ }
+ } else if ($action === 'save') {
+ User::assertPermission('networkrules.save');
+ $ruleid = Request::post('ruleid', 0, 'int');
+ $rulename = Request::post('rulename', '', 'string');
+ $host = Request::post('host', '', 'string');
+ $port = Request::post('port', '', 'string');
+ $direction = Request::post('direction', '', 'string');
+
+ if (!in_array($direction, ['IN', 'OUT'], true)) {
+ Message::addError('networkrule-invalid-direction', $direction);
+ } elseif (empty($host)) {
+ Message::addError('networkrule-missing-host');
+ } elseif (empty($port)) {
+ Message::addError('networkrule-missing-port');
+ } else {
+ $data = json_encode([
+ 'host' => $host,
+ 'port' => $port,
+ 'direction' => $direction
+ ]);
+ if ($ruleid !== 0) {
+ Database::exec('UPDATE sat.presetnetworkrules SET rulename = :rulename, ruledata = :data'
+ .' WHERE ruleid = :ruleid', compact('ruleid', 'rulename', 'data'));
+ } else {
+ Database::exec('INSERT INTO sat.presetnetworkrules (rulename, ruledata)'
+ .' VALUES (:rulename, :data)', compact('rulename', 'data'));
+ }
+ Message::addSuccess('networkrule-saved');
+ }
+ }
+ if (Request::isPost()) {
+ Util::redirect('?do=dozmod&section=networkrules');
+ }
+ User::assertPermission('networkrules.view');
+ }
+
+ public static function doRender()
+ {
+ $show = Request::get('show', 'list', 'string');
+ if ($show === 'list') {
+ $res = Database::simpleQuery('SELECT ruleid, rulename, ruledata
+ FROM sat.presetnetworkrules ORDER BY rulename ASC');
+ $rows = array();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $dec = json_decode($row['ruledata'], true);
+ if (!is_array($dec)) {
+ $dec = [];
+ }
+ $rows[] = $row + $dec;
+ }
+ Render::addTemplate('networkrules', [
+ 'networkrules' => $rows,
+ 'hasEditPermissions' => User::hasPermission('networkrules.save')
+ ]);
+ } else if ($show === 'edit') {
+ $ruleid = Request::get('ruleid', 0, 'int');
+ if ($ruleid === 0) {
+ $data = [];
+ } else {
+ $data = Database::queryFirst('SELECT ruleid, rulename, ruledata
+ FROM sat.presetnetworkrules WHERE ruleid = :ruleid', ['ruleid' => $ruleid]);
+ if ($data === false) {
+ Message::addError('networkrule-invalid-ruleid', $ruleid);
+ Util::redirect('?do=dozmod&section=networkrules');
+ }
+ $dec = json_decode($data['ruledata'], true);
+ if (is_array($dec)) {
+ $data += $dec;
+ }
+ if ($data['direction'] === 'IN') {
+ $data['inSelected'] = 'selected';
+ } else {
+ $data['outSelected'] = 'selected';
+ }
+ }
+ Render::addTemplate('networkrules-edit', $data);
+ }
+ }
+
+}
diff --git a/modules-available/dozmod/pages/networkshares.inc.php b/modules-available/dozmod/pages/networkshares.inc.php
new file mode 100644
index 00000000..659321b4
--- /dev/null
+++ b/modules-available/dozmod/pages/networkshares.inc.php
@@ -0,0 +1,108 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ $action = Request::post('action', '', 'string');
+
+ if ($action === 'delete') {
+ User::assertPermission('networkshares.save');
+ $shareid = Request::post('shareid', false, 'int');
+ if ($shareid !== false) {
+ $res = Database::exec('DELETE FROM sat.presetnetworkshare WHERE shareid = :shareid', ['shareid' => $shareid]);
+ if ($res !== false) {
+ Message::addSuccess('networkshare-deleted');
+ }
+ }
+ } else if ($action === 'save') {
+ User::assertPermission('networkshares.save');
+ $shareid = Request::post('shareid', 0, 'int');
+ $sharename = Request::post('sharename', '', 'string');
+ $path = Request::post('path', false, 'string');
+ $target = Request::post('target', '', 'string');
+ $authType = Request::post('auth', '', 'string');
+ $username = Request::post('username', '', 'string');
+ $password = Request::post('password', '', 'string');
+ if (!in_array($authType, ['LOGIN_USER', 'OTHER_USER'], true)) {
+ Message::addError('networkshare-invalid-auth-type', $authType);
+ } elseif (empty($path)) {
+ Message::addError('networkshare-missing-path');
+ } else {
+ $data = json_encode([
+ 'auth' => $authType,
+ 'path' => $path,
+ 'displayname' => $sharename,
+ 'mountpoint' => $target,
+ 'username' => $username,
+ 'password' => $password,
+ ]);
+ if ($shareid !== 0) {
+ Database::exec('UPDATE sat.presetnetworkshare SET sharename = :sharename, sharedata = :data'
+ .' WHERE shareid = :shareid', compact('shareid', 'sharename', 'data'));
+ } else {
+ Database::exec('INSERT INTO sat.presetnetworkshare (sharename, sharedata, active)'
+ .' VALUES (:sharename, :data, 1)', compact('sharename', 'data'));
+ }
+ Message::addSuccess('networkshare-saved');
+ }
+ } else if ($action === 'activate' || $action === 'deactivate') {
+ User::assertPermission('networkshares.save');
+ $shareid = Request::post('shareid', false, 'int');
+ $active = ($action === 'activate' ? 1 : 0);
+ Database::exec('UPDATE sat.presetnetworkshare SET active = :active WHERE shareid = :shareid', compact('active', 'shareid'));
+ }
+ if (Request::isPost()) {
+ Util::redirect('?do=dozmod&section=networkshares');
+ }
+ User::assertPermission('networkshares.view');
+ }
+
+ public static function doRender()
+ {
+ $show = Request::get('show', 'list', 'string');
+ if ($show === 'list') {
+ $res = Database::simpleQuery('SELECT shareid, sharename, sharedata, active
+ FROM sat.presetnetworkshare ORDER BY sharename ASC');
+ $rows = array();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $dec = json_decode($row['sharedata'], true);
+ if (!is_array($dec)) {
+ $dec = [];
+ }
+ if ($dec['auth'] === 'LOGIN_USER') {
+ $row['loginAsUser'] = true;
+ }
+ $rows[] = $row + $dec;
+ }
+ Render::addTemplate('networkshares', [
+ 'networkshares' => $rows,
+ 'hasEditPermissions' => User::hasPermission('networkshares.save')
+ ]);
+ } else if ($show === 'edit') {
+ $shareid = Request::get('shareid', 0, 'int');
+ if ($shareid === 0) {
+ $data = [];
+ } else {
+ $data = Database::queryFirst('SELECT shareid, sharename, sharedata
+ FROM sat.presetnetworkshare WHERE shareid = :shareid', ['shareid' => $shareid]);
+ if ($data === false) {
+ Message::addError('networkshare-invalid-shareid', $shareid);
+ Util::redirect('?do=dozmod&section=networkshares');
+ }
+ $dec = json_decode($data['sharedata'], true);
+ if (is_array($dec)) {
+ $data += $dec;
+ }
+ if ($data['auth'] === 'LOGIN_USER') {
+ $data['loggedInUser_selected'] = 'selected';
+ } else {
+ $data['specificUser_selected'] = 'selected';
+ }
+ }
+ Render::addTemplate('networkshares-edit', $data);
+ }
+ }
+
+}
diff --git a/modules-available/dozmod/pages/runscripts.inc.php b/modules-available/dozmod/pages/runscripts.inc.php
new file mode 100644
index 00000000..c6566c13
--- /dev/null
+++ b/modules-available/dozmod/pages/runscripts.inc.php
@@ -0,0 +1,133 @@
+<?php
+
+class SubPage
+{
+
+ public static function doPreprocess()
+ {
+ /* execute actions */
+ $action = Request::post('action', false, 'string');
+
+ if ($action === 'save') {
+ User::assertPermission("runscripts.save");
+ self::saveScript();
+ }
+
+ if (Request::isPost()) {
+ Util::redirect('?do=dozmod&section=runscripts');
+ }
+ User::assertPermission('runscripts.view');
+ }
+
+ private static function saveScript()
+ {
+ $id = Request::post('runscriptid', false, 'int');
+ $scriptname = Request::post('scriptname', '', 'string');
+ if ($id === false) {
+ Message::addError('main.parameter-missing', 'runscriptid');
+ return;
+ }
+ $data = [
+ 'scriptname' => $scriptname,
+ 'content' => Request::post('content', '', 'string'),
+ 'visibility' => Request::post('visibility', 1, 'int'),
+ 'extension' => preg_replace('/[^a-z0-9_\-~\!\$\=]/i', '', Request::post('extension', '', 'string')),
+ 'passcreds' => Request::post('passcreds', 0, 'int') !== 0,
+ 'isglobal' => Request::post('isglobal', 0, 'int') !== 0,
+ ];
+ if ($id === 0) {
+ // New entry
+ $ret = Database::exec('INSERT INTO sat.presetrunscript
+ (scriptname, content, extension, visibility, passcreds, isglobal) VALUES
+ (:scriptname, :content, :extension, :visibility, :passcreds, :isglobal)', $data);
+ $id = Database::lastInsertId();
+ } else {
+ // Edit entry
+ $data['id'] = $id;
+ Database::exec('UPDATE sat.presetrunscript SET
+ scriptname = :scriptname, content = :content, extension = :extension, visibility = :visibility,
+ passcreds = :passcreds, isglobal = :isglobal
+ WHERE runscriptid = :id', $data);
+ }
+ $oslist = Request::post('osid', false, 'array');
+ if (is_array($oslist)) {
+ $oslist = array_filter($oslist, 'is_numeric');
+ $query = Database::prepare('INSERT INTO sat.presetrunscript_x_operatingsystem
+ (runscriptid, osid) VALUES (:id, :osid)');
+ foreach ($oslist as $osid) {
+ $query->execute(['id' => $id, 'osid' => $osid]);
+ }
+ $query->closeCursor();
+ Database::exec('DELETE FROM sat.presetrunscript_x_operatingsystem
+ WHERE runscriptid = :id AND osid NOT IN (:oslist)', ['id' => $id, 'oslist' => $oslist]);
+ }
+ Message::addSuccess('runscript-saved');
+ }
+
+ public static function doRender()
+ {
+ $show = Request::get('show', 'list', 'string');
+ if ($show === 'list') {
+ $res = Database::simpleQuery('SELECT runscriptid, scriptname, extension, visibility, passcreds, isglobal
+ FROM sat.presetrunscript
+ ORDER BY scriptname ASC');
+ $rows = [];
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if ($row['visibility'] == 0) {
+ $row['visibility'] = 'eye-close';
+ } elseif ($row['visibility'] == 1) {
+ $row['visibility'] = 'eye-open';
+ } else {
+ $row['visibility'] = 'arrow-down';
+ }
+ $rows[] = $row;
+ }
+ Render::addTemplate('runscripts-list', ['list' => $rows, 'hasEditPermission' => User::hasPermission('runscripts.save')]);
+ } elseif ($show === 'edit') {
+ // Edit
+ $id = Request::get('runscriptid', false, 'int');
+ if ($id === false) {
+ Message::addError('main.parameter-missing', 'runscriptid');
+ Util::redirect('?do=dozmod&section=runscripts');
+ }
+ if ($id === 0) {
+ $row = [
+ 'runscriptid' => 0,
+ 'visibility_1_checked' => 'checked',
+ 'isglobal_1_checked' => 'checked',
+ ];
+ } else {
+ $row = Database::queryFirst('SELECT runscriptid, scriptname, content, extension, visibility, passcreds, isglobal
+ FROM sat.presetrunscript
+ WHERE runscriptid = :runscriptid', ['runscriptid' => $id]);
+ $row['visibility_' . $row['visibility'] . '_selected'] = 'selected';
+ $row['passcreds_checked'] = $row['passcreds'] ? 'checked' : '';
+ $row['isglobal_' . $row['isglobal'] . '_checked'] = 'checked';
+ if ($row === false) {
+ Message::addError('runscript-invalid-id', $id);
+ Util::redirect('?do=dozmod&section=runscripts');
+ }
+ }
+ // Get OS
+ $row['oslist'] = [];
+ $res = Database::simpleQuery('SELECT o.osid, o.displayname, pxo.osid AS isvalid FROM sat.operatingsystem o
+ LEFT JOIN sat.presetrunscript_x_operatingsystem pxo ON (o.osid = pxo.osid AND pxo.runscriptid = :runscriptid)
+ ORDER BY o.displayname ASC', ['runscriptid' => $id]);
+ while ($osrow = $res->fetch(PDO::FETCH_ASSOC)) {
+ $row['oslist'][] = [
+ 'osid' => $osrow['osid'],
+ 'displayname' => $osrow['displayname'],
+ 'checked' => $osrow['isvalid'] ? 'checked' : '',
+ ];
+ }
+ // Output
+ Render::addTemplate('runscripts-edit', $row);
+ }
+ }
+
+ public static function doAjax()
+ {
+
+ }
+
+}
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..50f0f763 100644
--- a/modules-available/dozmod/inc/pagedozmodusers.inc.php
+++ b/modules-available/dozmod/pages/users.inc.php
@@ -1,31 +1,32 @@
<?php
-class Page_dozmod_users extends Page
+class SubPage
{
- protected function doPreprocess()
+ public static function doPreprocess()
{
-
+ // Currently there's only one view, actions are ajax
+ User::assertPermission('users.view');
}
- protected function doRender()
+ public static function doRender()
{
- $this->listUsers();
- $this->listOrganizations();
+ self::listUsers();
+ self::listOrganizations();
}
- protected function doAjax()
+ public 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 +35,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 +43,41 @@ 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['lastlogin'] = date('d.m.Y', $row['lastlogin']);
+ settype($row['lastlogin'], 'int');
+ $row['canlogin'] = self::checked($row['canlogin']);
+ $row['issuperuser'] = self::checked($row['issuperuser']);
+ $row['emailnotifications'] = self::checked($row['emailnotifications']);
+ if ($row['lastlogin'] !== 0) {
+ $row['lastlogin_s'] = date('d.m.Y', $row['lastlogin']);
+ }
$rows[] = $row;
}
- Render::addTemplate('userlist', array('users' => $rows));
+ Render::addTemplate('userlist', array(
+ 'users' => $rows,
+ 'nameTag' => User::hasPermission('actionlog.view') ? 'a' : 'span',
+ ));
}
- 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 +104,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')
@@ -118,4 +125,4 @@ class Page_dozmod_users extends Page
die($val);
}
-} \ No newline at end of file
+}
diff --git a/modules-available/dozmod/permissions/permissions.json b/modules-available/dozmod/permissions/permissions.json
index e8dfb558..c8958089 100644
--- a/modules-available/dozmod/permissions/permissions.json
+++ b/modules-available/dozmod/permissions/permissions.json
@@ -1,14 +1,59 @@
-[
- "images.delete",
- "mail.save",
- "mail.testmail",
- "runtimeconfig.save",
- "templates.save",
- "templates.reset",
- "users.setmail",
- "users.setlogin",
- "users.setsu",
- "users.orglogin",
- "log.showuser",
- "log.showtarget"
-] \ No newline at end of file
+{
+ "expiredimages.delete": {
+ "location-aware": false
+ },
+ "actionlog.view": {
+ "location-aware": false
+ },
+ "ldapfilters.view": {
+ "location-aware": false
+ },
+ "ldapfilters.save": {
+ "location-aware": false
+ },
+ "mailconfig.save": {
+ "location-aware": false
+ },
+ "networkrules.view": {
+ "location-aware": false
+ },
+ "networkrules.save": {
+ "location-aware": false
+ },
+ "networkshares.view": {
+ "location-aware": false
+ },
+ "networkshares.save": {
+ "location-aware": false
+ },
+ "runtimeconfig.save": {
+ "location-aware": false
+ },
+ "runscripts.view": {
+ "location-aware": false
+ },
+ "runscripts.save": {
+ "location-aware": false
+ },
+ "templates.reset": {
+ "location-aware": false
+ },
+ "templates.save": {
+ "location-aware": false
+ },
+ "users.setorglogin": {
+ "location-aware": false
+ },
+ "users.setlogin": {
+ "location-aware": false
+ },
+ "users.setmail": {
+ "location-aware": false
+ },
+ "users.setsu": {
+ "location-aware": false
+ },
+ "users.view": {
+ "location-aware": false
+ }
+} \ No newline at end of file
diff --git a/modules-available/dozmod/style.css b/modules-available/dozmod/style.css
index 23dd121e..4cec715a 100644
--- a/modules-available/dozmod/style.css
+++ b/modules-available/dozmod/style.css
@@ -48,4 +48,24 @@
.table > tbody > tr > td > div {
display: inline-block;
+}
+
+/* number of columns in tree view depending on screen size */
+.column-list {
+ column-gap: 20px;
+ column-count: 2;
+ padding-left: 20px;
+ padding-right: 20px;
+}
+
+@media (min-width: 768px) {
+ .column-list {
+ column-count: 3;
+ }
+}
+
+@media (min-width: 992px) {
+ .column-list {
+ column-count: 4;
+ }
} \ No newline at end of file
diff --git a/modules-available/dozmod/templates/actionlog-log.html b/modules-available/dozmod/templates/actionlog-log.html
index 8aa57207..7caa3d34 100644
--- a/modules-available/dozmod/templates/actionlog-log.html
+++ b/modules-available/dozmod/templates/actionlog-log.html
@@ -18,7 +18,9 @@
{{#showActor}}
<td style="min-width:140px">
{{#uuserid}}
- {{#allowedShowUser}}<a href="?do=dozmod&amp;section=actionlog&amp;action=showuser&amp;uuid={{uuserid}}">{{/allowedShowUser}} {{ulastname}}, {{ufirstname}}{{#allowedShowUser}}</a>{{/allowedShowUser}}
+ <a href="?do=dozmod&amp;section=actionlog&amp;action=showuser&amp;uuid={{uuserid}}">
+ {{ulastname}}, {{ufirstname}}
+ </a>
{{/uuserid}}
{{^uuserid}}
{{lang_system}}
@@ -28,7 +30,7 @@
{{#showTarget}}
<td style="word-wrap: break-word">
{{#targeturl}}
- {{#allowedShowTarget}}<a href="{{targeturl}}">{{/allowedShowTarget}}{{targetname}}{{#allowedShowTarget}}</a>{{/allowedShowTarget}}
+ <a href="{{targeturl}}">{{targetname}}</a>
{{/targeturl}}
{{^targeturl}}
{{targetname}}
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/ldapfilter-add.html b/modules-available/dozmod/templates/ldapfilter-add.html
new file mode 100644
index 00000000..f66972d1
--- /dev/null
+++ b/modules-available/dozmod/templates/ldapfilter-add.html
@@ -0,0 +1,39 @@
+<h1>{{lang_ldapfilters}}</h1>
+
+<div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_ldapFilterEdit}}
+ </div>
+ <div class="panel-body">
+
+ <p>{{lang_ldapFilterDescription}}</p>
+ <form method="post" action="?do=dozmod&section=ldapfilters">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" id="filterid" name="filterid" value="{{filterid}}">
+
+ <div class="input-group">
+ <label class="input-group-addon" for="filtername">{{lang_ldapFilterName}}</label>
+ <input type="text" name="filtername" id ="filtername" class="form-control" placeholder="" value="{{filtername}}" required>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="attribute">{{lang_ldapFilterAttribute}}</label>
+ <input type="text" name="attribute" id ="attribute" class="form-control" placeholder="" value="{{filterkey}}" required>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="value">{{lang_ldapFilterValue}}</label>
+ <input type="text" name="value" id ="value" class="form-control" placeholder="" value="{{filtervalue}}" required>
+ </div>
+
+ <div class="text-right" style="margin-top: 20px;">
+ <a type="button" class="btn btn-default" href="?do=dozmod&section=ldapfilters">{{lang_cancel}}</a>
+ <button class="btn btn-primary" type="submit" name="action" value="saveFilter">
+ <span class="glyphicon glyphicon-floppy-disk"></span>
+ {{lang_save}}
+ </button>
+ </div>
+ </form>
+ </div>
+</div>
+
+<script type="text/javascript">
+</script>
diff --git a/modules-available/dozmod/templates/ldapfilters.html b/modules-available/dozmod/templates/ldapfilters.html
new file mode 100644
index 00000000..824ec70b
--- /dev/null
+++ b/modules-available/dozmod/templates/ldapfilters.html
@@ -0,0 +1,77 @@
+<h1>{{lang_ldapfilters}}</h1>
+
+<p>
+ {{lang_ldapfiltersIntro}}
+</p>
+
+<table class="table">
+ <thead>
+ <tr>
+ <th class="">{{lang_ldapFilterName}}</th>
+ <th class="">{{lang_ldapFilterAttribute}}</th>
+ <th class="">{{lang_ldapFilterValue}}</th>
+ {{#hasEditPermission}}
+ <th class="slx-smallcol">{{lang_edit}}</th>
+ <th class="slx-smallcol">{{lang_delete}}</th>
+ {{/hasEditPermission}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#ldapfilters}}
+ <tr>
+ <td>{{filtername}}</td>
+ <td>{{filterkey}}</td>
+ <td>{{filtervalue}}</td>
+ {{#hasEditPermission}}
+ <td class="text-center">
+ <a class="btn btn-xs btn-primary" href="?do=dozmod&section=ldapfilters&show=edit&filterid={{filterid}}">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td class="text-center">
+ <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="setDeleteId('{{filterid}}')">
+ <span class="glyphicon glyphicon-trash"></span>
+ </button>
+ </td>
+ {{/hasEditPermission}}
+ </tr>
+ {{/ldapfilters}}
+ </tbody>
+</table>
+
+{{#hasEditPermission}}
+<div class="text-right">
+ <a class="btn btn-sm btn-success" href="?do=dozmod&section=ldapfilters&show=edit">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_ldapFilterAdd}}
+ </a>
+</div>
+{{/hasEditPermission}}
+
+<form method="post" action="?do=dozmod&section=ldapfilters">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" id="deleteAction" name="filterid" value="">
+ <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4>
+ </div>
+ <div class="modal-body">
+ <p>{{lang_ldapFilterDeleteConfirmation}}</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
+ <button type="submit" name="action" value="deleteFilter" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</form>
+
+<script type="text/javascript">
+function setDeleteId(id) {
+ $('#deleteAction').val(id)
+}
+</script>
diff --git a/modules-available/dozmod/templates/mailconfig.html b/modules-available/dozmod/templates/mailconfig.html
index d5d4db29..dbcdddcb 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.save.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/networkrules-edit.html b/modules-available/dozmod/templates/networkrules-edit.html
new file mode 100644
index 00000000..c04e2825
--- /dev/null
+++ b/modules-available/dozmod/templates/networkrules-edit.html
@@ -0,0 +1,43 @@
+<h1>{{lang_networkrules}}</h1>
+
+<div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_editNetworkrule}}
+ </div>
+ <div class="panel-body">
+ <form method="post" action="?do=dozmod">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="networkrules">
+ <input type="hidden" name="ruleid" value="{{ruleid}}">
+
+ <div class="input-group">
+ <label class="input-group-addon" for="rulename">{{lang_name}}</label>
+ <input required type="text" name="rulename" id="rulename" class="form-control" value="{{rulename}}">
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="host">{{lang_host}}</label>
+ <input required type="text" name="host" id="host" class="form-control" value="{{host}}">
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="port">{{lang_port}}</label>
+ <input required type="number" name="port" id="port" class="form-control" value="{{port}}">
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="direction">{{lang_direction}}</label>
+ <select class="form-control" name="direction" id="direction">
+ <option {{inSelected}} value="IN">IN</option>
+ <option {{outSelected}} value="OUT">OUT</option>
+ </select>
+ </div>
+ <div class="text-right" style="margin-top: 20px">
+ <a href="?do=dozmod&amp;section=networkrules" class="btn btn-default">
+ {{lang_cancel}}
+ </a>
+ <button type="submit" class="btn btn-primary" name="action" value="save">
+ <span class="glyphicon glyphicon-floppy-disk"></span>
+ {{lang_save}}
+ </button>
+ </div>
+ </form>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/dozmod/templates/networkrules.html b/modules-available/dozmod/templates/networkrules.html
new file mode 100644
index 00000000..4344ff4f
--- /dev/null
+++ b/modules-available/dozmod/templates/networkrules.html
@@ -0,0 +1,82 @@
+<h1>{{lang_networkrules}}</h1>
+
+<p>
+ {{lang_networkrulesIntro}}
+</p>
+
+<table class="table">
+ <thead>
+ <tr>
+ <th>{{lang_name}}</th>
+ <th>{{lang_host}}</th>
+ <th>{{lang_port}}</th>
+ <th>{{lang_direction}}</th>
+ {{#hasEditPermissions}}
+ <th class="slx-smallcol">{{lang_edit}}</th>
+ <th class="slx-smallcol">{{lang_delete}}</th>
+ {{/hasEditPermissions}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#networkrules}}
+ <tr>
+ <td>{{rulename}}</td>
+ <td>{{host}}</td>
+ <td>{{port}}</td>
+ <td>{{direction}}</td>
+ {{#hasEditPermissions}}
+ <td align="center">
+ <a href="?do=dozmod&amp;section=networkrules&amp;show=edit&amp;ruleid={{ruleid}}" class="btn btn-xs btn-primary">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td align="center">
+ <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteRule('{{ruleid}}')">
+ <span class="glyphicon glyphicon-trash"></span>
+ </button>
+ </td>
+ {{/hasEditPermissions}}
+ </tr>
+ {{/networkrules}}
+ </tbody>
+</table>
+{{#hasEditPermissions}}
+<div class="text-right">
+ <a href="?do=dozmod&amp;section=networkrules&amp;show=edit" class="btn btn-success">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_addRule}}
+ </a>
+</div>
+{{/hasEditPermissions}}
+
+<!-- Modals -->
+<form method="post" action="?do=dozmod">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="networkrules">
+ <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4>
+ </div>
+ <div class="modal-body">
+ <p>{{lang_ruleDeleteConfirm}}</p>
+ </div>
+ <div class="modal-footer">
+ <input type="hidden" id="delete-rule-id" name="ruleid" value="">
+ <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
+ <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</form>
+
+<script type="text/javascript">
+
+ function deleteRule(ruleid) {
+ $("#delete-rule-id").val(ruleid);
+ }
+
+</script> \ No newline at end of file
diff --git a/modules-available/dozmod/templates/networkshares-edit.html b/modules-available/dozmod/templates/networkshares-edit.html
new file mode 100644
index 00000000..f0b43837
--- /dev/null
+++ b/modules-available/dozmod/templates/networkshares-edit.html
@@ -0,0 +1,84 @@
+<h1>{{lang_networkshares}}</h1>
+
+<div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_editNetworkshare}}
+ </div>
+ <div class="panel-body">
+ <form method="post" action="?do=dozmod">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="networkshares">
+ <input type="hidden" name="shareid" value="{{shareid}}">
+
+ <div class="input-group">
+ <label class="input-group-addon" for="name">{{lang_name}}</label>
+ <input required type="text" name="sharename" id="name" class="form-control" value="{{sharename}}">
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="path">{{lang_path}}</label>
+ <input required type="text" name="path" id="path" class="form-control" value="{{path}}">
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="target">{{lang_target}}</label>
+ <select class="form-control" name="target" id="target">
+ <option value="-">{{lang_none}}</option>
+ <option value="D">D:</option><option value="E">E:</option><option value="F">F:</option>
+ <option value="G">G:</option><option value="H">H:</option><option value="I">I:</option>
+ <option value="J">J:</option><option value="K">K:</option><option value="L">L:</option>
+ <option value="M">M:</option><option value="N">N:</option><option value="O">O:</option>
+ <option value="P">P:</option><option value="Q">Q:</option><option value="R">R:</option>
+ <option value="S">S:</option><option value="T">T:</option><option value="U">U:</option>
+ <option value="V">V:</option><option value="W">W:</option><option value="X">X:</option>
+ <option value="Y">Y:</option><option value="Z">Z:</option>
+ <option value="PRINTER">{{lang_printer}}</option>
+ </select>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="auth">{{lang_authMethod}}</label>
+ <select class="form-control" name="auth" id="auth">
+ <option value="LOGIN_USER" {{loggedInUser_selected}}>{{lang_loggedInUser}}</option>
+ <option value="OTHER_USER" {{specificUser_selected}}>{{lang_specificUser}}</option>
+ </select>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="username">{{lang_username}}</label>
+ <input required type="text" name="username" id="username" class="form-control" value="{{username}}" {{#loggedInUser_selected}}disabled{{/loggedInUser_selected}}>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="password">{{lang_password}}</label>
+ <input required type="{{password_type}}" name="password" id="password" class="form-control" value="{{password}}" {{#loggedInUser_selected}}disabled{{/loggedInUser_selected}}>
+ </div>
+ <div class="text-right" style="margin-top: 20px">
+ <a href="?do=dozmod&amp;section=networkshares" class="btn btn-default">
+ {{lang_cancel}}
+ </a>
+ <button type="submit" class="btn btn-primary" name="action" value="save">
+ <span class="glyphicon glyphicon-floppy-disk"></span>
+ {{lang_save}}
+ </button>
+ </div>
+ </form>
+ </div>
+</div>
+
+<script type="text/javascript">
+
+ document.addEventListener("DOMContentLoaded", function () {
+
+ $('#target').val('{{mountpoint}}');
+
+ $('#auth').change(function () {
+ var username = $('#username');
+ var password = $('#password');
+ if ($(this).val() === 'OTHER_USER') {
+ username.prop('disabled', false);
+ password.prop('disabled', false);
+ } else {
+ username.prop('disabled', true);
+ password.prop('disabled', true);
+ }
+ }).change();
+
+ })
+
+</script> \ No newline at end of file
diff --git a/modules-available/dozmod/templates/networkshares.html b/modules-available/dozmod/templates/networkshares.html
new file mode 100644
index 00000000..aaafa256
--- /dev/null
+++ b/modules-available/dozmod/templates/networkshares.html
@@ -0,0 +1,113 @@
+<h1>{{lang_networkshares}}</h1>
+
+<p>
+ {{lang_networksharesIntro}}
+</p>
+
+<table class="table">
+ <thead>
+ <tr>
+ <th>{{lang_name}}</th>
+ <th>{{lang_path}}</th>
+ <th>{{lang_target}}</th>
+ <th>{{lang_authMethod}}</th>
+ <th>{{lang_username}}</th>
+ {{#hasEditPermissions}}
+ <th class="slx-smallcol">{{lang_active}}</th>
+ <th class="slx-smallcol">{{lang_edit}}</th>
+ <th class="slx-smallcol">{{lang_delete}}</th>
+ {{/hasEditPermissions}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#networkshares}}
+ <tr>
+ <td>{{sharename}}</td>
+ <td>{{path}}</td>
+ <td>{{mountpoint}}</td>
+ <td>
+ {{#loginAsUser}}{{lang_loggedInUser}}{{/loginAsUser}}
+ {{^loginAsUser}}{{lang_specificUser}}{{/loginAsUser}}
+ </td>
+ <td>
+ {{^loginAsUser}}{{username}}{{/loginAsUser}}
+ </td>
+ {{#hasEditPermissions}}
+ <td class="text-nowrap">
+ <form method="post" action="?do=dozmod">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="networkshares">
+ <input type="hidden" name="shareid" value="{{shareid}}">
+ {{#active}}
+ <span class="glyphicon glyphicon-ok text-success"></span>
+ <button type="submit" name="action" value="deactivate" class="btn btn-xs btn-default">
+ <span class="glyphicon glyphicon-remove"></span>
+ </button>
+ {{/active}}
+ {{^active}}
+ <span class="glyphicon glyphicon-remove text-danger"></span>
+ <button type="submit" name="action" value="activate" class="btn btn-xs btn-default">
+ <span class="glyphicon glyphicon-ok"></span>
+ </button>
+ {{/active}}
+ </form>
+ </td>
+ <td align="center">
+ <a href="?do=dozmod&amp;section=networkshares&amp;show=edit&amp;shareid={{shareid}}" class="btn btn-xs btn-primary">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td align="center">
+ <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteShare('{{shareid}}')">
+ <span class="glyphicon glyphicon-trash"></span>
+ </button>
+ </td>
+ {{/hasEditPermissions}}
+ </tr>
+ {{/networkshares}}
+ </tbody>
+</table>
+{{#hasEditPermissions}}
+<div class="text-right">
+ <a href="?do=dozmod&amp;section=networkshares&amp;show=edit" class="btn btn-success {{allowAddShare}}">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_addShare}}
+ </a>
+</div>
+{{/hasEditPermissions}}
+
+<!-- Modals -->
+<form method="post" action="?do=dozmod">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="section" value="networkshares">
+ <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4>
+ </div>
+ <div class="modal-body">
+ <p>{{lang_shareDeleteConfirm}}</p>
+ </div>
+ <div class="modal-footer">
+ <input type="hidden" id="delete-share-id" name="shareid" value="">
+ <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
+ <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</form>
+
+<script type="text/javascript">
+
+ function deleteShare(shareid) {
+ $("#delete-share-id").val(shareid);
+ }
+
+ document.addEventListener("DOMContentLoaded", function () {
+
+ })
+
+</script> \ No newline at end of file
diff --git a/modules-available/dozmod/templates/runscripts-edit.html b/modules-available/dozmod/templates/runscripts-edit.html
new file mode 100644
index 00000000..8d81b33c
--- /dev/null
+++ b/modules-available/dozmod/templates/runscripts-edit.html
@@ -0,0 +1,89 @@
+<h1>{{lang_scriptsHead}}</h1>
+
+<form method="post" action="?do=dozmod&section=runscripts">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" id="runscriptid" name="runscriptid" value="{{runscriptid}}">
+
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_editScript}}
+ </div>
+ <div class="panel-body">
+ <div class="input-group">
+ <label class="input-group-addon" for="scriptname">{{lang_name}}</label>
+ <input type="text" name="scriptname" id="scriptname" class="form-control"
+ value="{{scriptname}}" required>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="extension">{{lang_scriptExtension}}</label>
+ <input type="text" name="extension" id="extension" class="form-control" value="{{extension}}"
+ list="default-exts">
+ <datalist id="default-exts">
+ <option value="bat">
+ <option value="ps">
+ <option value="py">
+ <option value="sh">
+ </datalist>
+ </div>
+ <div class="input-group">
+ <label class="input-group-addon" for="visibility">{{lang_scriptVisibility}}</label>
+ <select type="text" name="visibility" id="visibility" class="form-control" required>
+ <option value="0" {{visibility_0_selected}}>{{lang_hidden}}</option>
+ <option value="1" {{visibility_1_selected}}>{{lang_normal}}</option>
+ <option value="2" {{visibility_2_selected}}>{{lang_minimized}}</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <div class="checkbox">
+ <input type="checkbox" name="passcreds" value="1" {{passcreds_checked}} id="passcreds"
+ class="form-control">
+ <label for="passcreds">
+ {{lang_scriptPassCredentials}}
+ </label>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="radio">
+ <input type="radio" name="isglobal" value="1" {{isglobal_1_checked}} id="isglobal1" class="form-control">
+ <label for="isglobal1">
+ {{lang_scriptIsGlobal}}
+ </label>
+ </div>
+ <div class="radio">
+ <input type="radio" name="isglobal" value="0" {{isglobal_0_checked}} id="isglobal0" class="form-control">
+ <label for="isglobal0">
+ {{lang_scriptIsPredefined}}
+ </label>
+ </div>
+ </div>
+ <div>
+ <label for="content">{{lang_scriptContent}}</label>
+ <textarea name="content" id="content" rows="20" cols="80" class="form-control">{{content}}</textarea>
+ </div>
+
+ <div class="panel panel-body column-list">
+ {{#oslist}}
+ <div class="checkbox">
+ <input type="checkbox" name="osid[]" value="{{osid}}" {{checked}} id="osid{{osid}}" class="form-control">
+ <label for="osid{{osid}}">
+ {{displayname}}
+ </label>
+ </div>
+ {{/oslist}}
+ </div>
+
+ <div class="text-right" style="margin-top: 20px;">
+ <a type="button" class="btn btn-default" href="?do=dozmod&section=runscripts">{{lang_cancel}}</a>
+ <button class="btn btn-primary" type="submit" name="action" value="save">
+ <span class="glyphicon glyphicon-floppy-disk"></span>
+ {{lang_save}}
+ </button>
+ </div>
+
+ </div>
+ </div>
+
+</form>
+
+<script type="text/javascript">
+</script>
diff --git a/modules-available/dozmod/templates/runscripts-list.html b/modules-available/dozmod/templates/runscripts-list.html
new file mode 100644
index 00000000..4d519afb
--- /dev/null
+++ b/modules-available/dozmod/templates/runscripts-list.html
@@ -0,0 +1,89 @@
+<h1>{{lang_scriptsHead}}</h1>
+
+<p>
+ {{lang_scriptsIntro}}
+</p>
+
+<table class="table">
+ <thead>
+ <tr>
+ <th>{{lang_name}}</th>
+ <th class="slx-smallcol">{{lang_scriptExtensionHead}}</th>
+ <th class="slx-smallcol">{{lang_scriptVisibilityHead}}</th>
+ <th class="slx-smallcol">{{lang_scriptPassCredentialsHead}}</th>
+ <th class="slx-smallcol">{{lang_scriptIsGlobalHead}}</th>
+ {{#hasEditPermission}}
+ <th class="slx-smallcol">{{lang_edit}}</th>
+ <th class="slx-smallcol">{{lang_delete}}</th>
+ {{/hasEditPermission}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#list}}
+ <tr>
+ <td>{{scriptname}}</td>
+ <td>.{{extension}}</td>
+ <td><span class="glyphicon glyphicon-{{visibility}}"></span></td>
+ <td>
+ {{#passcreds}}
+ <span class="glyphicon glyphicon-ok"></span>
+ {{/passcreds}}
+ </td>
+ <td>
+ {{#isglobal}}
+ <span class="glyphicon glyphicon-ok"></span>
+ {{/isglobal}}
+ </td>
+ {{#hasEditPermission}}
+ <td class="text-center">
+ <a class="btn btn-xs btn-primary" href="?do=dozmod&amp;section=runscripts&amp;show=edit&amp;runscriptid={{runscriptid}}">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td class="text-center">
+ <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="setDeleteId('{{runscriptid}}')">
+ <span class="glyphicon glyphicon-trash"></span>
+ </button>
+ </td>
+ {{/hasEditPermission}}
+ </tr>
+ {{/list}}
+ </tbody>
+</table>
+
+{{#hasEditPermission}}
+ <div class="text-right">
+ <a class="btn btn-sm btn-success" href="?do=dozmod&amp;section=runscripts&amp;show=edit&amp;runscriptid=0">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_runScriptAdd}}
+ </a>
+ </div>
+{{/hasEditPermission}}
+
+<form method="post" action="?do=dozmod&amp;section=runscripts">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" id="deleteAction" name="runscriptid" value="">
+ <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4>
+ </div>
+ <div class="modal-body">
+ <p>{{lang_runScriptDeleteConfirmation}}</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
+ <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</form>
+
+<script type="text/javascript">
+ function setDeleteId(id) {
+ $('#deleteAction').val(id)
+ }
+</script>
diff --git a/modules-available/dozmod/templates/runtimeconfig.html b/modules-available/dozmod/templates/runtimeconfig.html
index 1d4cc6cb..6ea65ad4 100644
--- a/modules-available/dozmod/templates/runtimeconfig.html
+++ b/modules-available/dozmod/templates/runtimeconfig.html
@@ -20,13 +20,13 @@
<div class="checkbox">
<input type="checkbox" name="defaultLecturePermissions[admin]" value="1" {{defaultLecturePermissions.admin}} id ="lecture_admin" class="form-control">
- <label>
+ <label for"lecture_admin">
{{lang_lecturePermissionAdmin}}
</label>
</div>
<div class="checkbox">
<input type="checkbox" name="defaultLecturePermissions[edit]" value="1" {{defaultLecturePermissions.edit}} id ="lecture_edit" class="form-control">
- <label>
+ <label for="lecture_edit">
{{lang_lecturePermissionEdit}}
</label>
</div>
@@ -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>
diff --git a/modules-available/dozmod/templates/templates.html b/modules-available/dozmod/templates/templates.html
index 3ee0ccbc..721de375 100644
--- a/modules-available/dozmod/templates/templates.html
+++ b/modules-available/dozmod/templates/templates.html
@@ -8,7 +8,7 @@
<p><i>{{lang_templatePageDescription}}</i></p>
- <form id="templateForm" role="form" method="POST" action="?do=dozmod&amp;section=templates">
+ <form id="templateForm" role="form" method="POST" action="?do=dozmod&amp;section=templates" onsubmit="return validateForm()">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="save">
@@ -80,7 +80,7 @@
{{/templates}}
</div>
- <button {{^allowedSave}}disabled{{/allowedSave}} type="submit" onclick="return validateForm()" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
+ <button {{^allowedSave}}disabled{{/allowedSave}} type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
</form>
<form method="POST" action="?do=dozmod&amp;section=templates">
<input type="hidden" name="token" value="{{token}}">
@@ -138,7 +138,7 @@ function validateForm() {
var missing = [];
mandatory.forEach(function (v,i) {
- if (value.indexOf("%" + v + "%") == -1) {
+ if (value.indexOf("%" + v + "%") === -1) {
missing.push(v);
}
});
@@ -155,6 +155,7 @@ function validateForm() {
if ($toppest === false || $toppest.offset().top > $frame.offset().top) {
$toppest = $frame;
}
+ $('#panel_' + setting).collapse('show');
/* overall result */
ok = false;
} else {
diff --git a/modules-available/dozmod/templates/userlist.html b/modules-available/dozmod/templates/userlist.html
index b8080b44..6b19907d 100644
--- a/modules-available/dozmod/templates/userlist.html
+++ b/modules-available/dozmod/templates/userlist.html
@@ -22,9 +22,13 @@
<tbody>
{{#users}}
<tr>
- <td class="text-left text-nowrap"><a href="?do=dozmod&amp;section=actionlog&amp;action=showuser&amp;uuid={{userid}}">{{lastname}}, {{firstname}}</a></td>
+ <td class="text-left text-nowrap">
+ <{{nameTag}} href="?do=dozmod&amp;section=actionlog&amp;action=showuser&amp;uuid={{userid}}">
+ {{lastname}}, {{firstname}}
+ </{{nameTag}}>
+ </td>
<td class="text-left text-nowrap">{{orgname}}</td>
- <td class="text-left text-nowrap">{{lastlogin}}</td>
+ <td class="text-left text-nowrap" data-sort-value="{{lastlogin}}">{{lastlogin_s}}</td>
<td class="text-left text-nowrap"><a href="mailto:{{email}}">{{email}}</a></td>
<td>
<div class="checkbox">