Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0998176

Browse files
Handle Planner role in GitLab (#12426)
* Handle GitLab's Planner permission * Update error message * Fix "Planner" typo in error message Co-authored-by: Nils Adermann <[email protected]> --------- Co-authored-by: Nils Adermann <[email protected]>
1 parent e971537 commit 0998176

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Composer/Repository/Vcs/GitLabDriver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ protected function getContents(string $url, bool $fetchingRepoData = false): Res
463463
if ($fetchingRepoData) {
464464
$json = $response->decodeJson();
465465

466-
// Accessing the API with a token with Guest (10) access will return
466+
// Accessing the API with a token with Guest (10) or Planner (15) access will return
467467
// more data than unauthenticated access but no default_branch data
468468
// accessing files via the API will then also fail
469469
if (!isset($json['default_branch']) && isset($json['permissions'])) {
@@ -474,13 +474,13 @@ protected function getContents(string $url, bool $fetchingRepoData = false): Res
474474
// - value will be null if no access is set
475475
// - value will be array with key access_level if set
476476
foreach ($json['permissions'] as $permission) {
477-
if ($permission && $permission['access_level'] > 10) {
477+
if ($permission && $permission['access_level'] >= 20) {
478478
$moreThanGuestAccess = true;
479479
}
480480
}
481481

482482
if (!$moreThanGuestAccess) {
483-
$this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
483+
$this->io->writeError('<warning>GitLab token with Guest or Planner only access detected</warning>');
484484

485485
$this->attemptCloneFallback();
486486

0 commit comments

Comments
 (0)