-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from xima-media/user-groups
Remote user group mapping, profile images for backend users
- Loading branch information
Showing
19 changed files
with
624 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
core | ||
public/_assets | ||
public/index.php | ||
public/fileadmin | ||
public/typo3 | ||
public/typo3conf | ||
|
||
vendor | ||
vendor | ||
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Xima\XimaOauth2Extended\ResourceResolver; | ||
|
||
final class ResolverOptions | ||
{ | ||
/** @var class-string */ | ||
public string $resolverClassName; | ||
|
||
public bool $createBackendUser = false; | ||
|
||
public bool $createFrontendUser = false; | ||
|
||
public string $defaultBackendUsergroup = ''; | ||
|
||
public string $defaultFrontendUsergroup = ''; | ||
|
||
public bool $createBackendUsergroups = false; | ||
|
||
public bool $createFrontendUsergroups = false; | ||
|
||
public bool $requireBackendUsergroup = false; | ||
|
||
public bool $requireFrontendUsergroup = false; | ||
|
||
public string $imageStorageBackendIdentifier = ''; | ||
|
||
public string $imageStorageFrontendIdentifier = ''; | ||
|
||
public string $defaultBackendLanguage = ''; | ||
|
||
public string $defaultBackendAdminGroups = ''; | ||
|
||
/** | ||
* @param array<string, mixed> $extConf | ||
*/ | ||
public static function createFromExtensionConfiguration(array $extConf): self | ||
{ | ||
$conf = new self(); | ||
$conf->resolverClassName = $extConf['resolverClassName'] ?? ''; | ||
$conf->createBackendUser = $extConf['createBackendUser'] ?? false; | ||
$conf->createFrontendUser = $extConf['createFrontendUser'] ?? false; | ||
$conf->defaultBackendUsergroup = $extConf['defaultBackendUsergroup'] ?? ''; | ||
$conf->defaultFrontendUsergroup = $extConf['defaultFrontendUsergroup'] ?? ''; | ||
$conf->createBackendUsergroups = $extConf['createBackendUsergroups'] ?? false; | ||
$conf->createFrontendUsergroups = $extConf['createFrontendUsergroups'] ?? false; | ||
$conf->requireBackendUsergroup = $extConf['requireBackendUsergroup'] ?? false; | ||
$conf->requireFrontendUsergroup = $extConf['requireFrontendUsergroup'] ?? false; | ||
$conf->imageStorageBackendIdentifier = $extConf['imageStorageBackendIdentifier'] ?? '1:/user_upload/oauth'; | ||
$conf->imageStorageFrontendIdentifier = $extConf['imageStorageFrontendIdentifier'] ?? '1:/user_upload/oauth'; | ||
$conf->defaultBackendLanguage = $extConf['defaultBackendLanguage'] ?? 'default'; | ||
$conf->defaultBackendAdminGroups = $extConf['defaultBackendAdminGroups'] ?? ''; | ||
|
||
return $conf; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Xima\XimaOauth2Extended\ResourceResolver; | ||
|
||
interface UserGroupResolverInterface extends ResourceResolverInterface | ||
{ | ||
/** | ||
* Returns list of `oauth2_id`s | ||
* | ||
* @return string[] | ||
*/ | ||
public function resolveUserGroups(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Xima\XimaOauth2Extended\UserFactory; | ||
|
||
use Xima\XimaOauth2Extended\ResourceResolver\ResourceResolverInterface; | ||
use Xima\XimaOauth2Extended\ResourceResolver\UserGroupResolverInterface; | ||
|
||
abstract class AbstractUserFactory | ||
{ | ||
/** @var string[]|null */ | ||
protected ?array $remoteGroupIds = null; | ||
|
||
public function __construct( | ||
protected ResourceResolverInterface $resolver, | ||
protected string $providerId | ||
) { | ||
} | ||
|
||
/** @return string[] */ | ||
public function getRemoteGroupIdsCached(): array | ||
{ | ||
if (!$this->resolver instanceof UserGroupResolverInterface) { | ||
return []; | ||
} | ||
if ($this->remoteGroupIds === null) { | ||
$this->remoteGroupIds = $this->resolver->resolveUserGroups(); | ||
} | ||
return $this->remoteGroupIds; | ||
} | ||
} |
Oops, something went wrong.