From be2712827e4bec519a5704551832acb419f9ec3b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 16 Feb 2018 14:45:16 +0100 Subject: [webinterface] Use permission helpers; disable inputs individually --- modules-available/webinterface/page.inc.php | 18 ++-- modules-available/webinterface/style.css | 7 -- .../webinterface/templates/customization.html | 11 ++- .../webinterface/templates/heading.html | 20 +++- .../webinterface/templates/https.html | 102 +++++++++++---------- .../webinterface/templates/passwords.html | 23 +++-- 6 files changed, 103 insertions(+), 78 deletions(-) delete mode 100644 modules-available/webinterface/style.css diff --git a/modules-available/webinterface/page.inc.php b/modules-available/webinterface/page.inc.php index 41636c19..806ffd59 100644 --- a/modules-available/webinterface/page.inc.php +++ b/modules-available/webinterface/page.inc.php @@ -16,13 +16,16 @@ class Page_WebInterface extends Page } switch (Request::post('action')) { case 'https': - if (User::hasPermission("edit.https")) $this->actionConfigureHttps(); + User::assertPermission("edit.https"); + $this->actionConfigureHttps(); break; case 'password': - if (User::hasPermission("edit.password")) $this->actionShowHidePassword(); + User::assertPermission("edit.password"); + $this->actionShowHidePassword(); break; case 'customization': - if (User::hasPermission("edit.design")) $this->actionCustomization(); + User::assertPermission("edit.design"); + $this->actionCustomization(); break; } } @@ -123,7 +126,7 @@ class Page_WebInterface extends Page } } $data[$type . 'Selected'] = true; - $data["editAllowed"] = User::hasPermission("edit.https"); + Permission::addGlobalTags($data['perms'], null, ['edit.https']); Render::addTemplate('https', $data); // // Password fields @@ -133,8 +136,11 @@ class Page_WebInterface extends Page $data['selected_show'] = 'checked'; else $data['selected_hide'] = 'checked'; - $data["editAllowed"] = User::hasPermission("edit.password"); + Permission::addGlobalTags($data['perms'], null, ['edit.password']); Render::addTemplate('passwords', $data); + // + // Colors/Prefix + // $data = array('prefix' => Property::get('page-title-prefix')); $data['colors'] = array_map(function ($i) { return array('color' => $i ? '#' . $i : '', 'text' => Render::readableColor($i)); }, array('', 'f00', '0f0', '00f', 'ff0', 'f0f', '0ff', 'fff', '000', 'f90', '09f', '90f', 'f09', '9f0')); @@ -150,7 +156,7 @@ class Page_WebInterface extends Page if ($color) { $data['colors'][] = array('color' => $color, 'selected' => 'selected'); } - $data["editAllowed"] = User::hasPermission("edit.design"); + Permission::addGlobalTags($data['perms'], null, ['edit.design']); Render::addTemplate('customization', $data); } diff --git a/modules-available/webinterface/style.css b/modules-available/webinterface/style.css deleted file mode 100644 index 7b86af56..00000000 --- a/modules-available/webinterface/style.css +++ /dev/null @@ -1,7 +0,0 @@ -.disabledPanel { - cursor: not-allowed; -} -.disabledPanel > .panel-body { - pointer-events: none; - opacity: 0.8; -} diff --git a/modules-available/webinterface/templates/customization.html b/modules-available/webinterface/templates/customization.html index ad57eea7..ea59d562 100644 --- a/modules-available/webinterface/templates/customization.html +++ b/modules-available/webinterface/templates/customization.html @@ -1,21 +1,21 @@
-
+
{{lang_customization}}

{{lang_customizationDesc}}

- +
diff --git a/modules-available/webinterface/templates/heading.html b/modules-available/webinterface/templates/heading.html index d68360f1..59a8cf6b 100644 --- a/modules-available/webinterface/templates/heading.html +++ b/modules-available/webinterface/templates/heading.html @@ -1 +1,19 @@ -

{{lang_moduleHeading}}

\ No newline at end of file + + \ No newline at end of file diff --git a/modules-available/webinterface/templates/https.html b/modules-available/webinterface/templates/https.html index a212cce3..ad36e9e5 100644 --- a/modules-available/webinterface/templates/https.html +++ b/modules-available/webinterface/templates/https.html @@ -1,7 +1,7 @@ -
+
{{lang_httpsSettings}}

{{lang_httpsDescription}}

@@ -25,46 +25,45 @@

{{lang_suppliedSelected}}

{{/suppliedSelected}}
- {{#httpsEnabled}} -
- -
- - -
-
- - {{lang_noHttps}} - -
- {{/httpsEnabled}} -
- -
- - -
-
- - {{lang_randomCert}} - -
-
- -
- - -
-
- - {{lang_customCert}} - +
+ {{#httpsEnabled}} +
+ + + + + + + + {{lang_noHttps}} + +
+ {{/httpsEnabled}} +
+ + + + + + + + {{lang_randomCert}} + +
+
+ + + + + + + + {{lang_customCert}} + +
-