From 5c02f1c6a422edd4e0a676513697fc2f0e27c953 Mon Sep 17 00:00:00 2001 From: iglocska Date: Sun, 13 Nov 2022 11:18:54 +0100 Subject: [PATCH] chg: [cleanup] of the default role setting for keycloak - not used in any sensible way anymore --- src/Model/Behavior/AuthKeycloakBehavior.php | 3 --- .../CerebrateSettingsProvider.php | 21 ------------------- src/Model/Table/UsersTable.php | 4 ---- 3 files changed, 28 deletions(-) diff --git a/src/Model/Behavior/AuthKeycloakBehavior.php b/src/Model/Behavior/AuthKeycloakBehavior.php index 2104bda..0a485dd 100644 --- a/src/Model/Behavior/AuthKeycloakBehavior.php +++ b/src/Model/Behavior/AuthKeycloakBehavior.php @@ -145,9 +145,6 @@ class AuthKeycloakBehavior extends Behavior $roleConditions = [ 'id' => $data['role_id'] ]; - if (!empty(Configure::read('keycloak.user_management.actions'))) { - $roleConditions['name'] = Configure::read('keycloak.default_role_name'); - } $user = [ 'username' => $data['username'], 'disabled' => false, diff --git a/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php b/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php index 421f6b5..dfa2be4 100644 --- a/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php +++ b/src/Model/Table/SettingProviders/CerebrateSettingsProvider.php @@ -208,27 +208,6 @@ class CerebrateSettingsProvider extends BaseSettingsProvider return true; } ], - 'keycloak.authoritative' => [ - 'name' => 'Authoritative', - 'type' => 'boolean', - 'severity' => 'info', - 'description' => __('Override local role and organisation settings based on the settings in KeyCloak'), - 'default' => false, - 'dependsOn' => 'keycloak.enabled' - ], - 'keycloak.default_role_name' => [ - 'name' => 'Default role', - 'type' => 'select', - 'severity' => 'info', - 'description' => __('Select the default role name to be used when creating users'), - 'options' => function ($settingsProviders) { - $roleTable = TableRegistry::getTableLocator()->get('Roles'); - $allRoleNames = $roleTable->find()->toArray(); - $allRoleNames = array_column($allRoleNames, 'name'); - return array_combine($allRoleNames, $allRoleNames); - }, - 'dependsOn' => 'keycloak.enabled' - ], 'keycloak.screw' => [ 'name' => 'Screw', 'type' => 'string', diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php index 647d32f..a2ebfeb 100644 --- a/src/Model/Table/UsersTable.php +++ b/src/Model/Table/UsersTable.php @@ -245,10 +245,6 @@ class UsersTable extends AppTable { $role = $this->Roles->find()->where(['name' => $user['role']['name']])->first(); if (empty($role)) { - if (!empty(Configure::read('keycloak.default_role_name'))) { - $default_role_name = Configure::read('keycloak.default_role_name'); - $role = $this->Roles->find()->where(['name' => $default_role_name])->first(); - } if (empty($role)) { throw new NotFoundException(__('Invalid role')); }