SSO: fixing UrlManager class problem -refs BT#19346

pull/4113/head
NicoDucou 4 years ago
parent b99df6d0bf
commit d9828089da
  1. 8
      plugin/oauth2/src/OAuth2.php

@ -367,7 +367,7 @@ class OAuth2 extends Plugin
$key = $this->get(self::SETTING_RESPONSE_RESOURCE_OWNER_URLS); $key = $this->get(self::SETTING_RESPONSE_RESOURCE_OWNER_URLS);
if (!empty($key)) { if (!empty($key)) {
$availableUrls = []; $availableUrls = [];
foreach (URLManager::get_url_data() as $existingUrl) { foreach (UrlManager::get_url_data() as $existingUrl) {
$urlId = $existingUrl['id']; $urlId = $existingUrl['id'];
$availableUrls[strval($urlId)] = $urlId; $availableUrls[strval($urlId)] = $urlId;
$availableUrls[$existingUrl['url']] = $urlId; $availableUrls[$existingUrl['url']] = $urlId;
@ -384,14 +384,14 @@ class OAuth2 extends Plugin
} }
} }
$grantedUrlIds = []; $grantedUrlIds = [];
foreach (URLManager::get_access_url_from_user($userId) as $grantedUrl) { foreach (UrlManager::get_access_url_from_user($userId) as $grantedUrl) {
$grantedUrlIds[] = $grantedUrl['access_url_id']; $grantedUrlIds[] = $grantedUrl['access_url_id'];
} }
foreach (array_diff($grantedUrlIds, $allowedUrlIds) as $extraUrlId) { foreach (array_diff($grantedUrlIds, $allowedUrlIds) as $extraUrlId) {
URLManager::delete_url_rel_user($userId, $extraUrlId); UrlManager::delete_url_rel_user($userId, $extraUrlId);
} }
foreach (array_diff($allowedUrlIds, $grantedUrlIds) as $missingUrlId) { foreach (array_diff($allowedUrlIds, $grantedUrlIds) as $missingUrlId) {
URLManager::add_user_to_url($userId, $missingUrlId); UrlManager::add_user_to_url($userId, $missingUrlId);
} }
} }
} }

Loading…
Cancel
Save