fix: [behavior:keycloak] Trying to lower fever the best I can
parent
ea6d33112f
commit
e366da6171
|
@ -415,38 +415,38 @@ class AuthKeycloakBehavior extends Behavior
|
|||
private function checkKeycloakUserRequiresUpdate(array $keycloakUser, array $user, array &$differences = []): bool
|
||||
{
|
||||
|
||||
$cEnabled = $keycloakUser['enabled'] == $user['disabled'];
|
||||
$cFn = $keycloakUser['firstName'] !== $user['individual']['first_name'];
|
||||
$Ln = $keycloakUser['lastName'] !== $user['individual']['last_name'];
|
||||
$cEmail = $keycloakUser['email'] !== $user['individual']['email'];
|
||||
$cRolename = (empty($keycloakUser['attributes']['role_name']) || $keycloakUser['attributes']['role_name'] !== $user['role']['name']);
|
||||
$cRoleuuid = (empty($keycloakUser['attributes']['role_uuid']) || $keycloakUser['attributes']['role_uuid'] !== $user['role']['uuid']);
|
||||
$cOrgname = (empty($keycloakUser['attributes']['org_name']) || $keycloakUser['attributes']['org_name'] !== $user['organisation']['name']);
|
||||
$cOrguuid = (empty($keycloakUser['attributes']['org_uuid']) || $keycloakUser['attributes']['org_uuid'] !== $user['organisation']['uuid']);
|
||||
if ($cEnabled || $cFn || $Ln || $cEmail || $cRolename || $cRoleuuid || $cOrgname || $cOrguuid) {
|
||||
if ($cEnabled) {
|
||||
$differences['enabled'] = ['kc' => $keycloakUser['enabled'], 'cerebrate' => $user['disabled']];
|
||||
$condEnabled = $keycloakUser['enabled'] == $user['disabled'];
|
||||
$condFirstname = $keycloakUser['firstName'] !== $user['individual']['first_name'];
|
||||
$condLastname = $keycloakUser['lastName'] !== $user['individual']['last_name'];
|
||||
$condEmail = $keycloakUser['email'] !== $user['individual']['email'];
|
||||
$condRolename = (empty($keycloakUser['attributes']['role_name']) || $keycloakUser['attributes']['role_name'] !== $user['role']['name']);
|
||||
$condRoleuuid = (empty($keycloakUser['attributes']['role_uuid']) || $keycloakUser['attributes']['role_uuid'] !== $user['role']['uuid']);
|
||||
$condOrgname = (empty($keycloakUser['attributes']['org_name']) || $keycloakUser['attributes']['org_name'] !== $user['organisation']['name']);
|
||||
$condOrguuid = (empty($keycloakUser['attributes']['org_uuid']) || $keycloakUser['attributes']['org_uuid'] !== $user['organisation']['uuid']);
|
||||
if ($condEnabled || $condFirstname || $condLastname || $condEmail || $condRolename || $condRoleuuid || $condOrgname || $condOrguuid) {
|
||||
if ($condEnabled) {
|
||||
$differences['enabled'] = ['keycloak' => $keycloakUser['enabled'], 'cerebrate' => $user['disabled']];
|
||||
}
|
||||
if ($cFn) {
|
||||
$differences['first_name'] = ['kc' => $keycloakUser['firstName'], 'cerebrate' => $user['individual']['first_name']];
|
||||
if ($condFirstname) {
|
||||
$differences['first_name'] = ['keycloak' => $keycloakUser['firstName'], 'cerebrate' => $user['individual']['first_name']];
|
||||
}
|
||||
if ($Ln) {
|
||||
$differences['last_name'] = ['kc' => $keycloakUser['lastName'], 'cerebrate' => $user['individual']['last_name']];
|
||||
if ($condLastname) {
|
||||
$differences['last_name'] = ['keycloak' => $keycloakUser['lastName'], 'cerebrate' => $user['individual']['last_name']];
|
||||
}
|
||||
if ($cEmail) {
|
||||
$differences['email'] = ['kc' => $keycloakUser['email'], 'cerebrate' => $user['individual']['email']];
|
||||
if ($condEmail) {
|
||||
$differences['email'] = ['keycloak' => $keycloakUser['email'], 'cerebrate' => $user['individual']['email']];
|
||||
}
|
||||
if ($cRolename) {
|
||||
$differences['role_name'] = ['kc' => $keycloakUser['attributes']['role_name'], 'cerebrate' => $user['role']['name']];
|
||||
if ($condRolename) {
|
||||
$differences['role_name'] = ['keycloak' => $keycloakUser['attributes']['role_name'], 'cerebrate' => $user['role']['name']];
|
||||
}
|
||||
if ($cRoleuuid) {
|
||||
$differences['role_uuid'] = ['kc' => $keycloakUser['attributes']['role_uuid'], 'cerebrate' => $user['role']['uuid']];
|
||||
if ($condRoleuuid) {
|
||||
$differences['role_uuid'] = ['keycloak' => $keycloakUser['attributes']['role_uuid'], 'cerebrate' => $user['role']['uuid']];
|
||||
}
|
||||
if ($cOrgname) {
|
||||
$differences['org_name'] = ['kc' => $keycloakUser['attributes']['org_name'], 'cerebrate' => $user['organisation']['name']];
|
||||
if ($condOrgname) {
|
||||
$differences['org_name'] = ['keycloak' => $keycloakUser['attributes']['org_name'], 'cerebrate' => $user['organisation']['name']];
|
||||
}
|
||||
if ($cOrguuid) {
|
||||
$differences['org_uuid'] = ['kc' => $keycloakUser['attributes']['org_uuid'], 'cerebrate' => $user['organisation']['uuid']];
|
||||
if ($condOrguuid) {
|
||||
$differences['org_uuid'] = ['keycloak' => $keycloakUser['attributes']['org_uuid'], 'cerebrate' => $user['organisation']['uuid']];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
$differencesRearranged = array_map(function($difference) {
|
||||
return [
|
||||
__('Local: {0}', h($difference['cerebrate'])),
|
||||
__('Keycloak: {0}', h($difference['kc'])),
|
||||
__('Keycloak: {0}', h($difference['keycloak'])),
|
||||
];
|
||||
}, $value['differences']);
|
||||
if (!empty($value['require_update'])) {
|
||||
|
|
Loading…
Reference in New Issue