From b7a18255fe77a911bbdd929628c547357180df01 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Fri, 17 Mar 2023 13:14:36 +0100 Subject: [PATCH] [Web] rename role mapping to attribute mapping --- 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 --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 0a1edcff3..f64f150ad 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 436a9b370..ebebd3dc8 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 600b336a3..fd7a8dc81 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 @@
- +
- Role + Attribute Template
- {% for key, role in identity_provider_settings.roles %} + {% for key, role in identity_provider_settings.mappers %}
- + +