浏览代码

[Web] allow mailbox authsource to be switchable

FreddleSpl0it 2 年之前
父节点
当前提交
17b6ac3313
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 3 1
      data/web/edit.php
  2. 4 0
      data/web/templates/edit/mailbox.twig

+ 3 - 1
data/web/edit.php

@@ -118,6 +118,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
         $quarantine_category = mailbox('get', 'quarantine_category', $mailbox);
         $get_tls_policy = mailbox('get', 'tls_policy', $mailbox);
         $rlyhosts = relayhost('get');
+        $iam_settings = identity_provider('get');
         $template = 'edit/mailbox.twig';
         $template_data = [
           'acl' => $_SESSION['acl'],
@@ -130,7 +131,8 @@ if (isset($_SESSION['mailcow_cc_role'])) {
           'rlyhosts' => $rlyhosts,
           'sender_acl_handles' => mailbox('get', 'sender_acl_handles', $mailbox),
           'user_acls' => acl('get', 'user', $mailbox),
-          'mailbox_details' => $result
+          'mailbox_details' => $result,
+          'iam_settings' => $iam_settings,
         ];
       }
     }

+ 4 - 0
data/web/templates/edit/mailbox.twig

@@ -32,8 +32,12 @@
                         data-style="btn btn-secondary"
                         name="authsource" class="full-width-select form-control" required>
                           <option value="mailcow" {% if result.authsource == "mailcow" %}selected{% endif %}>mailcow</option>
+                          {% if iam_settings.authsource == 'keycloak' %}
                           <option value="keycloak" {% if result.authsource == "keycloak" %}selected{% endif %}>Keycloak</option>
+                          {% endif %}
+                          {% if iam_settings.authsource == 'generic-oidc' %}
                           <option value="generic-oidc" {% if result.authsource == "generic-oidc" %}selected{% endif %}>Generic-OIDC</option>
+                          {% endif %}
                       </select>
                     </div>
                   </div>