Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Hellmund committed Aug 2, 2019
2 parents a29ccb0 + 4c1ddc9 commit 19430af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ composer.phar

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
composer.lock

### PhpStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
Expand Down
8 changes: 8 additions & 0 deletions Classes/ResourceServer/GitLab.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class GitLab extends AbstractResourceServer
* @var bool
*/
private $userDetailsLoaded = false;
/**
* @var bool
*/
private $blockExternalUser = false;
/**
* @var array
*/
Expand All @@ -71,6 +75,7 @@ public function __construct(array $arguments) {
$this->adminUserLevel = (int)$arguments['gitlabAdminUserLevel'];
$this->gitlabDefaultGroups = GeneralUtility::trimExplode(',', $arguments['gitlabDefaultGroups'], true);
$this->userOption = (int)$arguments['gitlabUserOption'];
$this->blockExternalUser = (bool)$arguments['blockExternalUser'];

$this->oauthProvider = new GitLabOAuthProvider([
'clientId' => $arguments['appId'],
Expand Down Expand Up @@ -155,6 +160,9 @@ public function loadUserDetails(ResourceOwnerInterface $user): void
$accessLevel = max($accessLevel, $sharedGroup['group_access_level']);
}
}
if ($this->blockExternalUser && $user->isExternal()) {
$accessLevel = 0;
}

$this->gitlabProjectPermissions = [
'access_level' => $accessLevel
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Mfc\OAuth2\ResourceServer\Registry::addServer(
'gitlabAdminUserLevel' => \Mfc\OAuth2\ResourceServer\GitLab::USER_LEVEL_DEVELOPER, // User level at which the user will be given admin permissions
'gitlabDefaultGroups' => 0, // Groups to assign to the User
'gitlabUserOption' => 0, // UserConfig
'blockExternalUser' => false // Blocks users with flag external from access the backend
'projectName' => 'your/repo', // the repository from which user information is fetched
],
]
Expand Down

0 comments on commit 19430af

Please sign in to comment.