NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] rename role mapping to attribute mapping

b7a18255
FreddleSpl0it <[email protected]> 3 years, 4 months ago
data/web/inc/functions.inc.php                     | 30 +++++++++++-----------
 data/web/lang/lang.en-gb.json                      |  4 +--
 .../admin/tab-config-identity-provider.twig        | 10 ++++----
 3 files changed, 22 insertions(+), 22 deletions(-)

Diff

diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php
index 0a1edcff..f64f150a 100644
--- a/data/web/inc/functions.inc.php
+++ b/data/web/inc/functions.inc.php
@@ -2078,8 +2078,8 @@ function identity_provider($_action, $_data = null, $hide_secret = false) {
       $stmt->execute();
       $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
       foreach($rows as $row){
-        if ($row["key"] == 'roles'){
-          $settings['roles'] = json_decode($row["value"]);
+        if ($row["key"] == 'mappers'){
+          $settings['mappers'] = json_decode($row["value"]);
         } else if ($row["key"] == 'templates'){
           $settings['templates'] = json_decode($row["value"]);
         } else {
@@ -2117,7 +2117,7 @@ function identity_provider($_action, $_data = null, $hide_secret = false) {
         }
       }
       foreach($_data as $key => $value){
-        if (!in_array($key, $required_settings) || $key == 'roles' || $key == 'templates'){
+        if (!in_array($key, $required_settings) || $key == 'mappers' || $key == 'templates'){
           continue;
         }
 
@@ -2126,19 +2126,19 @@ function identity_provider($_action, $_data = null, $hide_secret = false) {
         $stmt->execute();
       }
 
-      // add role mappings
-      if ($_data['roles'] && $_data['templates']){
-        if (!is_array($_data['roles'])){
-          $_data['roles'] = array($_data['roles']);
+      // add mappers
+      if ($_data['mappers'] && $_data['templates']){
+        if (!is_array($_data['mappers'])){
+          $_data['mappers'] = array($_data['mappers']);
         }
         if (!is_array($_data['templates'])){
           $_data['templates'] = array($_data['templates']);
         }
-        $roles = array();
+        $mappers = array();
         $templates = array();
-        foreach($_data['roles'] as $role){
-          if ($role){
-            array_push($roles, $role);
+        foreach($_data['mappers'] as $mapper){
+          if ($mapper){
+            array_push($mappers, $mapper);
           }
         }
         foreach($_data['templates'] as $template){
@@ -2146,12 +2146,12 @@ function identity_provider($_action, $_data = null, $hide_secret = false) {
             array_push($templates, $template);
           }
         }
-        if (count($roles) == count($templates)){
-          $roles = json_encode($roles);
+        if (count($mappers) == count($templates)){
+          $mappers = json_encode($mappers);
           $templates = json_encode($templates);
 
-          $stmt = $pdo->prepare("INSERT INTO identity_provider (`key`, `value`) VALUES ('roles', :value) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);");
-          $stmt->bindParam(':value', $roles);
+          $stmt = $pdo->prepare("INSERT INTO identity_provider (`key`, `value`) VALUES ('mappers', :value) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);");
+          $stmt->bindParam(':value', $mappers);
           $stmt->execute();
           $stmt = $pdo->prepare("INSERT INTO identity_provider (`key`, `value`) VALUES ('templates', :value) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);");
           $stmt->bindParam(':value', $templates);
diff --git a/data/web/lang/lang.en-gb.json b/data/web/lang/lang.en-gb.json
index 436a9b37..ebebd3dc 100644
--- a/data/web/lang/lang.en-gb.json
+++ b/data/web/lang/lang.en-gb.json
@@ -214,10 +214,10 @@
         "iam": "Identity Provider",
         "iam_client_id": "Client Id",
         "iam_client_secret": "Client Secret",
-        "iam_description": "Here, you can configure the integration with an external Keycloak service. The Keycloak user's mailboxes will be automatically created upon their first login, provided that a role mapping has been set.",
+        "iam_description": "Here, you can configure the integration with an external Keycloak service. The Keycloak user's mailboxes will be automatically created upon their first login, provided that a attribute mapping has been set.",
         "iam_realm": "Realm",
         "iam_redirect_url": "Redirect Url",
-        "iam_rolemapping": "Role Mapping",
+        "iam_mapping": "Attribute Mapping",
         "iam_server_url": "Server Url",
         "iam_sso": "SSO",
         "iam_test_connection": "Test Connection",
diff --git a/data/web/templates/admin/tab-config-identity-provider.twig b/data/web/templates/admin/tab-config-identity-provider.twig
index 600b336a..fd7a8dc8 100644
--- a/data/web/templates/admin/tab-config-identity-provider.twig
+++ b/data/web/templates/admin/tab-config-identity-provider.twig
@@ -50,15 +50,15 @@
           </div>
         </div>
         <div class="row mb-2">
-          <label class="control-label col-sm-3 text-sm-end" for="iam_version">{{ lang.admin.iam_rolemapping }}:</label>
+          <label class="control-label col-sm-3 text-sm-end" for="iam_version">{{ lang.admin.iam_mapping }}:</label>
           <div class="col-4 d-flex mb-2">
-            <span class="w-100 me-2">Role</span>
+            <span class="w-100 me-2">Attribute</span>
             <span class="w-100 ms-2">Template</span>
             <button id="iam_rolemap_add" class="btn btn-sm d-block d-sm-inline btn-secondary ms-2"><i class="bi bi-plus-lg"></i></button>
           </div>
-          {% for key, role in identity_provider_settings.roles %}
+          {% for key, role in identity_provider_settings.mappers %}
           <div class="offset-sm-3 col-4 d-flex mb-2">
-            <input type="text" class="form-control me-2" name="roles" value="{{ identity_provider_settings.roles[key] }}">
+            <input type="text" class="form-control me-2" name="mappers" value="{{ identity_provider_settings.mappers[key] }}">
             <select data-live-search="true" name="templates" class="form-control" title="{{ lang.mailbox.template }}">
             {% for mbox_template in mbox_templates %}
               <option{% if mbox_template.template == identity_provider_settings.templates[key] %} selected{% endif %}>
@@ -70,7 +70,7 @@
           </div>
           {% endfor %}
           <div class="offset-sm-3 col-4 d-flex mb-2">
-            <input type="text" class="form-control me-2" name="roles" value="">
+            <input type="text" class="form-control me-2" name="mappers" value="">
             <select data-live-search="true" name="templates" class="form-control" title="{{ lang.mailbox.template }}">
             {% for mbox_template in mbox_templates %}
               <option>