Skip to content

Commit

Permalink
Merge pull request #22 from garbast/improve_group_check
Browse files Browse the repository at this point in the history
Add membership check
  • Loading branch information
Simon Schmidt authored Mar 19, 2020
2 parents db13d41 + 899a13e commit 8f19e6b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Classes/ResourceServer/GitLab.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,17 @@ public function loadUserDetails(ResourceOwnerInterface $user): void
}
if (isset($project['shared_with_groups']) && is_array($sharedGroups = $project['shared_with_groups'])) {
foreach ($sharedGroups as $sharedGroup) {
$accessLevel = max($accessLevel, $sharedGroup['group_access_level']);
try {
$response = $gitlabClient
->getHttpClient()
->get('groups/' . $sharedGroup['group_id'] . '/members/' . $user->getId());
// only assign access level is current user is member of group
if ($response->getStatusCode() == 200) {
$accessLevel = max($accessLevel, $sharedGroup['group_access_level']);
}
} catch (\Exception $ex) {
// user has no access to see details
}
}
}
if ($this->blockExternalUser && $user->isExternal()) {
Expand Down

0 comments on commit 8f19e6b

Please sign in to comment.