@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | public function addEntityCollection(string $name, \Closure $entityExistsFunction) { |
64 | 64 | if (isset($this->collections[$name])) { |
65 | - throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
65 | + throw new \OutOfBoundsException('Duplicate entity name "'.$name.'"'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $this->collections[$name] = $entityExistsFunction; |
@@ -35,49 +35,49 @@ |
||
35 | 35 | * @since 9.1.0 |
36 | 36 | */ |
37 | 37 | class SystemTagsEntityEvent extends Event { |
38 | - /** |
|
39 | - * @deprecated 22.0.0 |
|
40 | - */ |
|
41 | - public const EVENT_ENTITY = 'OCP\SystemTag\ISystemTagManager::registerEntity'; |
|
38 | + /** |
|
39 | + * @deprecated 22.0.0 |
|
40 | + */ |
|
41 | + public const EVENT_ENTITY = 'OCP\SystemTag\ISystemTagManager::registerEntity'; |
|
42 | 42 | |
43 | - /** @var string */ |
|
44 | - protected $event; |
|
45 | - /** @var \Closure[] */ |
|
46 | - protected $collections; |
|
43 | + /** @var string */ |
|
44 | + protected $event; |
|
45 | + /** @var \Closure[] */ |
|
46 | + protected $collections; |
|
47 | 47 | |
48 | - /** |
|
49 | - * SystemTagsEntityEvent constructor. |
|
50 | - * |
|
51 | - * @param string $event |
|
52 | - * @since 9.1.0 |
|
53 | - */ |
|
54 | - public function __construct(string $event) { |
|
55 | - $this->event = $event; |
|
56 | - $this->collections = []; |
|
57 | - } |
|
48 | + /** |
|
49 | + * SystemTagsEntityEvent constructor. |
|
50 | + * |
|
51 | + * @param string $event |
|
52 | + * @since 9.1.0 |
|
53 | + */ |
|
54 | + public function __construct(string $event) { |
|
55 | + $this->event = $event; |
|
56 | + $this->collections = []; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param string $name |
|
61 | - * @param \Closure $entityExistsFunction The closure should take one |
|
62 | - * argument, which is the id of the entity, that tags |
|
63 | - * should be handled for. The return should then be bool, |
|
64 | - * depending on whether tags are allowed (true) or not. |
|
65 | - * @throws \OutOfBoundsException when the entity name is already taken |
|
66 | - * @since 9.1.0 |
|
67 | - */ |
|
68 | - public function addEntityCollection(string $name, \Closure $entityExistsFunction) { |
|
69 | - if (isset($this->collections[$name])) { |
|
70 | - throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
71 | - } |
|
59 | + /** |
|
60 | + * @param string $name |
|
61 | + * @param \Closure $entityExistsFunction The closure should take one |
|
62 | + * argument, which is the id of the entity, that tags |
|
63 | + * should be handled for. The return should then be bool, |
|
64 | + * depending on whether tags are allowed (true) or not. |
|
65 | + * @throws \OutOfBoundsException when the entity name is already taken |
|
66 | + * @since 9.1.0 |
|
67 | + */ |
|
68 | + public function addEntityCollection(string $name, \Closure $entityExistsFunction) { |
|
69 | + if (isset($this->collections[$name])) { |
|
70 | + throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
71 | + } |
|
72 | 72 | |
73 | - $this->collections[$name] = $entityExistsFunction; |
|
74 | - } |
|
73 | + $this->collections[$name] = $entityExistsFunction; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return \Closure[] |
|
78 | - * @since 9.1.0 |
|
79 | - */ |
|
80 | - public function getEntityCollections(): array { |
|
81 | - return $this->collections; |
|
82 | - } |
|
76 | + /** |
|
77 | + * @return \Closure[] |
|
78 | + * @since 9.1.0 |
|
79 | + */ |
|
80 | + public function getEntityCollections(): array { |
|
81 | + return $this->collections; |
|
82 | + } |
|
83 | 83 | } |
@@ -67,6 +67,6 @@ |
||
67 | 67 | $implements |= Backend::COUNT_USERS; |
68 | 68 | } |
69 | 69 | |
70 | - return (bool)($actions & $implements); |
|
70 | + return (bool) ($actions & $implements); |
|
71 | 71 | } |
72 | 72 | } |
@@ -34,41 +34,41 @@ |
||
34 | 34 | * @since 14.0.0 |
35 | 35 | */ |
36 | 36 | abstract class ABackend implements IUserBackend, UserInterface { |
37 | - /** |
|
38 | - * @deprecated 14.0.0 |
|
39 | - * @since 14.0.0 |
|
40 | - * |
|
41 | - * @param int $actions The action to check for |
|
42 | - * @return bool |
|
43 | - */ |
|
44 | - public function implementsActions($actions): bool { |
|
45 | - $implements = 0; |
|
37 | + /** |
|
38 | + * @deprecated 14.0.0 |
|
39 | + * @since 14.0.0 |
|
40 | + * |
|
41 | + * @param int $actions The action to check for |
|
42 | + * @return bool |
|
43 | + */ |
|
44 | + public function implementsActions($actions): bool { |
|
45 | + $implements = 0; |
|
46 | 46 | |
47 | - if ($this instanceof ICreateUserBackend) { |
|
48 | - $implements |= Backend::CREATE_USER; |
|
49 | - } |
|
50 | - if ($this instanceof ISetPasswordBackend) { |
|
51 | - $implements |= Backend::SET_PASSWORD; |
|
52 | - } |
|
53 | - if ($this instanceof ICheckPasswordBackend) { |
|
54 | - $implements |= Backend::CHECK_PASSWORD; |
|
55 | - } |
|
56 | - if ($this instanceof IGetHomeBackend) { |
|
57 | - $implements |= Backend::GET_HOME; |
|
58 | - } |
|
59 | - if ($this instanceof IGetDisplayNameBackend) { |
|
60 | - $implements |= Backend::GET_DISPLAYNAME; |
|
61 | - } |
|
62 | - if ($this instanceof ISetDisplayNameBackend) { |
|
63 | - $implements |= Backend::SET_DISPLAYNAME; |
|
64 | - } |
|
65 | - if ($this instanceof IProvideAvatarBackend) { |
|
66 | - $implements |= Backend::PROVIDE_AVATAR; |
|
67 | - } |
|
68 | - if ($this instanceof ICountUsersBackend) { |
|
69 | - $implements |= Backend::COUNT_USERS; |
|
70 | - } |
|
47 | + if ($this instanceof ICreateUserBackend) { |
|
48 | + $implements |= Backend::CREATE_USER; |
|
49 | + } |
|
50 | + if ($this instanceof ISetPasswordBackend) { |
|
51 | + $implements |= Backend::SET_PASSWORD; |
|
52 | + } |
|
53 | + if ($this instanceof ICheckPasswordBackend) { |
|
54 | + $implements |= Backend::CHECK_PASSWORD; |
|
55 | + } |
|
56 | + if ($this instanceof IGetHomeBackend) { |
|
57 | + $implements |= Backend::GET_HOME; |
|
58 | + } |
|
59 | + if ($this instanceof IGetDisplayNameBackend) { |
|
60 | + $implements |= Backend::GET_DISPLAYNAME; |
|
61 | + } |
|
62 | + if ($this instanceof ISetDisplayNameBackend) { |
|
63 | + $implements |= Backend::SET_DISPLAYNAME; |
|
64 | + } |
|
65 | + if ($this instanceof IProvideAvatarBackend) { |
|
66 | + $implements |= Backend::PROVIDE_AVATAR; |
|
67 | + } |
|
68 | + if ($this instanceof ICountUsersBackend) { |
|
69 | + $implements |= Backend::COUNT_USERS; |
|
70 | + } |
|
71 | 71 | |
72 | - return (bool)($actions & $implements); |
|
73 | - } |
|
72 | + return (bool)($actions & $implements); |
|
73 | + } |
|
74 | 74 | } |
@@ -62,6 +62,6 @@ |
||
62 | 62 | $implements |= GroupInterface::REMOVE_FROM_GOUP; |
63 | 63 | } |
64 | 64 | |
65 | - return (bool)($actions & $implements); |
|
65 | + return (bool) ($actions & $implements); |
|
66 | 66 | } |
67 | 67 | } |
@@ -31,38 +31,38 @@ |
||
31 | 31 | * @since 14.0.0 |
32 | 32 | */ |
33 | 33 | abstract class ABackend implements GroupInterface { |
34 | - /** |
|
35 | - * @deprecated 14.0.0 |
|
36 | - * @since 14.0.0 |
|
37 | - * |
|
38 | - * @param int $actions The action to check for |
|
39 | - * @return bool |
|
40 | - */ |
|
41 | - public function implementsActions($actions): bool { |
|
42 | - $implements = 0; |
|
34 | + /** |
|
35 | + * @deprecated 14.0.0 |
|
36 | + * @since 14.0.0 |
|
37 | + * |
|
38 | + * @param int $actions The action to check for |
|
39 | + * @return bool |
|
40 | + */ |
|
41 | + public function implementsActions($actions): bool { |
|
42 | + $implements = 0; |
|
43 | 43 | |
44 | - if ($this instanceof IAddToGroupBackend) { |
|
45 | - $implements |= GroupInterface::ADD_TO_GROUP; |
|
46 | - } |
|
47 | - if ($this instanceof ICountUsersBackend) { |
|
48 | - $implements |= GroupInterface::COUNT_USERS; |
|
49 | - } |
|
50 | - if ($this instanceof ICreateGroupBackend) { |
|
51 | - $implements |= GroupInterface::CREATE_GROUP; |
|
52 | - } |
|
53 | - if ($this instanceof IDeleteGroupBackend) { |
|
54 | - $implements |= GroupInterface::DELETE_GROUP; |
|
55 | - } |
|
56 | - if ($this instanceof IGroupDetailsBackend) { |
|
57 | - $implements |= GroupInterface::GROUP_DETAILS; |
|
58 | - } |
|
59 | - if ($this instanceof IIsAdminBackend) { |
|
60 | - $implements |= GroupInterface::IS_ADMIN; |
|
61 | - } |
|
62 | - if ($this instanceof IRemoveFromGroupBackend) { |
|
63 | - $implements |= GroupInterface::REMOVE_FROM_GOUP; |
|
64 | - } |
|
44 | + if ($this instanceof IAddToGroupBackend) { |
|
45 | + $implements |= GroupInterface::ADD_TO_GROUP; |
|
46 | + } |
|
47 | + if ($this instanceof ICountUsersBackend) { |
|
48 | + $implements |= GroupInterface::COUNT_USERS; |
|
49 | + } |
|
50 | + if ($this instanceof ICreateGroupBackend) { |
|
51 | + $implements |= GroupInterface::CREATE_GROUP; |
|
52 | + } |
|
53 | + if ($this instanceof IDeleteGroupBackend) { |
|
54 | + $implements |= GroupInterface::DELETE_GROUP; |
|
55 | + } |
|
56 | + if ($this instanceof IGroupDetailsBackend) { |
|
57 | + $implements |= GroupInterface::GROUP_DETAILS; |
|
58 | + } |
|
59 | + if ($this instanceof IIsAdminBackend) { |
|
60 | + $implements |= GroupInterface::IS_ADMIN; |
|
61 | + } |
|
62 | + if ($this instanceof IRemoveFromGroupBackend) { |
|
63 | + $implements |= GroupInterface::REMOVE_FROM_GOUP; |
|
64 | + } |
|
65 | 65 | |
66 | - return (bool)($actions & $implements); |
|
67 | - } |
|
66 | + return (bool)($actions & $implements); |
|
67 | + } |
|
68 | 68 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | |
23 | -require_once __DIR__ . '/../lib/base.php'; |
|
23 | +require_once __DIR__.'/../lib/base.php'; |
|
24 | 24 | |
25 | 25 | header('Content-Type: application/json'); |
26 | 26 |
@@ -29,12 +29,12 @@ |
||
29 | 29 | $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api'); |
30 | 30 | |
31 | 31 | if ($isEnabled) { |
32 | - // Make sure the routes are loaded |
|
33 | - \OC_App::loadApp('cloud_federation_api'); |
|
34 | - $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | - header('Content-Type: application/json'); |
|
36 | - echo json_encode($capabilities->getCapabilities()['ocm']); |
|
32 | + // Make sure the routes are loaded |
|
33 | + \OC_App::loadApp('cloud_federation_api'); |
|
34 | + $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | + header('Content-Type: application/json'); |
|
36 | + echo json_encode($capabilities->getCapabilities()['ocm']); |
|
37 | 37 | } else { |
38 | - header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | - exit("501 Not Implemented"); |
|
38 | + header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | + exit("501 Not Implemented"); |
|
40 | 40 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | public function __construct($providerId) { |
34 | 34 | $l = \OC::$server->getL10N('federation'); |
35 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
35 | + $message = 'Cloud Federation Provider with ID: "'.$providerId.'" does not exist.'; |
|
36 | 36 | $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
37 | 37 | parent::__construct($message, $hint); |
38 | 38 | } |
@@ -31,17 +31,17 @@ |
||
31 | 31 | * @since 14.0.0 |
32 | 32 | */ |
33 | 33 | class ProviderDoesNotExistsException extends HintException { |
34 | - /** |
|
35 | - * ProviderDoesNotExistsException constructor. |
|
36 | - * |
|
37 | - * @since 14.0.0 |
|
38 | - * |
|
39 | - * @param string $providerId cloud federation provider ID |
|
40 | - */ |
|
41 | - public function __construct($providerId) { |
|
42 | - $l = \OC::$server->getL10N('federation'); |
|
43 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
44 | - $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
45 | - parent::__construct($message, $hint); |
|
46 | - } |
|
34 | + /** |
|
35 | + * ProviderDoesNotExistsException constructor. |
|
36 | + * |
|
37 | + * @since 14.0.0 |
|
38 | + * |
|
39 | + * @param string $providerId cloud federation provider ID |
|
40 | + */ |
|
41 | + public function __construct($providerId) { |
|
42 | + $l = \OC::$server->getL10N('federation'); |
|
43 | + $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
44 | + $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
45 | + parent::__construct($message, $hint); |
|
46 | + } |
|
47 | 47 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct($action) { |
33 | 33 | $l = \OC::$server->getL10N('federation'); |
34 | - $message = 'Action "' . $action . '" not supported or implemented.'; |
|
34 | + $message = 'Action "'.$action.'" not supported or implemented.'; |
|
35 | 35 | $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
36 | 36 | parent::__construct($message, $hint); |
37 | 37 | } |
@@ -31,16 +31,16 @@ |
||
31 | 31 | * @since 14.0.0 |
32 | 32 | */ |
33 | 33 | class ActionNotSupportedException extends HintException { |
34 | - /** |
|
35 | - * ActionNotSupportedException constructor. |
|
36 | - * |
|
37 | - * @since 14.0.0 |
|
38 | - * |
|
39 | - */ |
|
40 | - public function __construct($action) { |
|
41 | - $l = \OC::$server->getL10N('federation'); |
|
42 | - $message = 'Action "' . $action . '" not supported or implemented.'; |
|
43 | - $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
|
44 | - parent::__construct($message, $hint); |
|
45 | - } |
|
34 | + /** |
|
35 | + * ActionNotSupportedException constructor. |
|
36 | + * |
|
37 | + * @since 14.0.0 |
|
38 | + * |
|
39 | + */ |
|
40 | + public function __construct($action) { |
|
41 | + $l = \OC::$server->getL10N('federation'); |
|
42 | + $message = 'Action "' . $action . '" not supported or implemented.'; |
|
43 | + $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
|
44 | + parent::__construct($message, $hint); |
|
45 | + } |
|
46 | 46 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | try { |
58 | - $folder = $this->appData->getFolder((string)$node->getId()); |
|
58 | + $folder = $this->appData->getFolder((string) $node->getId()); |
|
59 | 59 | $folder->delete(); |
60 | 60 | } catch (NotFoundException $e) { |
61 | 61 | //Nothing to do |
@@ -36,39 +36,39 @@ |
||
36 | 36 | * Class that will watch filesystem activity and remove previews as needed. |
37 | 37 | */ |
38 | 38 | class Watcher { |
39 | - /** @var IAppData */ |
|
40 | - private $appData; |
|
39 | + /** @var IAppData */ |
|
40 | + private $appData; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Watcher constructor. |
|
44 | - * |
|
45 | - * @param IAppData $appData |
|
46 | - */ |
|
47 | - public function __construct(IAppData $appData) { |
|
48 | - $this->appData = $appData; |
|
49 | - } |
|
42 | + /** |
|
43 | + * Watcher constructor. |
|
44 | + * |
|
45 | + * @param IAppData $appData |
|
46 | + */ |
|
47 | + public function __construct(IAppData $appData) { |
|
48 | + $this->appData = $appData; |
|
49 | + } |
|
50 | 50 | |
51 | - public function postWrite(Node $node) { |
|
52 | - $this->deleteNode($node); |
|
53 | - } |
|
51 | + public function postWrite(Node $node) { |
|
52 | + $this->deleteNode($node); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function deleteNode(Node $node) { |
|
56 | - // We only handle files |
|
57 | - if ($node instanceof Folder) { |
|
58 | - return; |
|
59 | - } |
|
55 | + protected function deleteNode(Node $node) { |
|
56 | + // We only handle files |
|
57 | + if ($node instanceof Folder) { |
|
58 | + return; |
|
59 | + } |
|
60 | 60 | |
61 | - try { |
|
62 | - $folder = $this->appData->getFolder((string)$node->getId()); |
|
63 | - $folder->delete(); |
|
64 | - } catch (NotFoundException $e) { |
|
65 | - //Nothing to do |
|
66 | - } |
|
67 | - } |
|
61 | + try { |
|
62 | + $folder = $this->appData->getFolder((string)$node->getId()); |
|
63 | + $folder->delete(); |
|
64 | + } catch (NotFoundException $e) { |
|
65 | + //Nothing to do |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - public function versionRollback(array $data) { |
|
70 | - if (isset($data['node'])) { |
|
71 | - $this->deleteNode($data['node']); |
|
72 | - } |
|
73 | - } |
|
69 | + public function versionRollback(array $data) { |
|
70 | + if (isset($data['node'])) { |
|
71 | + $this->deleteNode($data['node']); |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public function connectWatcher() { |
58 | 58 | // Do not connect if we are not setup yet! |
59 | 59 | if ($this->config->getValue('instanceid', null) !== null) { |
60 | - $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
60 | + $this->root->listen('\OC\Files', 'postWrite', function(Node $node) { |
|
61 | 61 | $this->getWatcher()->postWrite($node); |
62 | 62 | }); |
63 | 63 |
@@ -30,39 +30,39 @@ |
||
30 | 30 | use OCP\Files\Node; |
31 | 31 | |
32 | 32 | class WatcherConnector { |
33 | - /** @var IRootFolder */ |
|
34 | - private $root; |
|
33 | + /** @var IRootFolder */ |
|
34 | + private $root; |
|
35 | 35 | |
36 | - /** @var SystemConfig */ |
|
37 | - private $config; |
|
36 | + /** @var SystemConfig */ |
|
37 | + private $config; |
|
38 | 38 | |
39 | - /** |
|
40 | - * WatcherConnector constructor. |
|
41 | - * |
|
42 | - * @param IRootFolder $root |
|
43 | - * @param SystemConfig $config |
|
44 | - */ |
|
45 | - public function __construct(IRootFolder $root, |
|
46 | - SystemConfig $config) { |
|
47 | - $this->root = $root; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
39 | + /** |
|
40 | + * WatcherConnector constructor. |
|
41 | + * |
|
42 | + * @param IRootFolder $root |
|
43 | + * @param SystemConfig $config |
|
44 | + */ |
|
45 | + public function __construct(IRootFolder $root, |
|
46 | + SystemConfig $config) { |
|
47 | + $this->root = $root; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return Watcher |
|
53 | - */ |
|
54 | - private function getWatcher(): Watcher { |
|
55 | - return \OC::$server->query(Watcher::class); |
|
56 | - } |
|
51 | + /** |
|
52 | + * @return Watcher |
|
53 | + */ |
|
54 | + private function getWatcher(): Watcher { |
|
55 | + return \OC::$server->query(Watcher::class); |
|
56 | + } |
|
57 | 57 | |
58 | - public function connectWatcher() { |
|
59 | - // Do not connect if we are not setup yet! |
|
60 | - if ($this->config->getValue('instanceid', null) !== null) { |
|
61 | - $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
62 | - $this->getWatcher()->postWrite($node); |
|
63 | - }); |
|
58 | + public function connectWatcher() { |
|
59 | + // Do not connect if we are not setup yet! |
|
60 | + if ($this->config->getValue('instanceid', null) !== null) { |
|
61 | + $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
62 | + $this->getWatcher()->postWrite($node); |
|
63 | + }); |
|
64 | 64 | |
65 | - \OC_Hook::connect('\OCP\Versions', 'rollback', $this->getWatcher(), 'versionRollback'); |
|
66 | - } |
|
67 | - } |
|
65 | + \OC_Hook::connect('\OCP\Versions', 'rollback', $this->getWatcher(), 'versionRollback'); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | if ($response_type !== 'code') { |
73 | 73 | //Fail |
74 | - $url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state; |
|
74 | + $url = $client->getRedirectUri().'?error=unsupported_response_type&state='.$state; |
|
75 | 75 | return new RedirectResponse($url); |
76 | 76 | } |
77 | 77 |
@@ -39,72 +39,72 @@ |
||
39 | 39 | use OCP\IURLGenerator; |
40 | 40 | |
41 | 41 | class LoginRedirectorController extends Controller { |
42 | - /** @var IURLGenerator */ |
|
43 | - private $urlGenerator; |
|
44 | - /** @var ClientMapper */ |
|
45 | - private $clientMapper; |
|
46 | - /** @var ISession */ |
|
47 | - private $session; |
|
48 | - /** @var IL10N */ |
|
49 | - private $l; |
|
42 | + /** @var IURLGenerator */ |
|
43 | + private $urlGenerator; |
|
44 | + /** @var ClientMapper */ |
|
45 | + private $clientMapper; |
|
46 | + /** @var ISession */ |
|
47 | + private $session; |
|
48 | + /** @var IL10N */ |
|
49 | + private $l; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @param string $appName |
|
53 | - * @param IRequest $request |
|
54 | - * @param IURLGenerator $urlGenerator |
|
55 | - * @param ClientMapper $clientMapper |
|
56 | - * @param ISession $session |
|
57 | - * @param IL10N $l |
|
58 | - */ |
|
59 | - public function __construct(string $appName, |
|
60 | - IRequest $request, |
|
61 | - IURLGenerator $urlGenerator, |
|
62 | - ClientMapper $clientMapper, |
|
63 | - ISession $session, |
|
64 | - IL10N $l) { |
|
65 | - parent::__construct($appName, $request); |
|
66 | - $this->urlGenerator = $urlGenerator; |
|
67 | - $this->clientMapper = $clientMapper; |
|
68 | - $this->session = $session; |
|
69 | - $this->l = $l; |
|
70 | - } |
|
51 | + /** |
|
52 | + * @param string $appName |
|
53 | + * @param IRequest $request |
|
54 | + * @param IURLGenerator $urlGenerator |
|
55 | + * @param ClientMapper $clientMapper |
|
56 | + * @param ISession $session |
|
57 | + * @param IL10N $l |
|
58 | + */ |
|
59 | + public function __construct(string $appName, |
|
60 | + IRequest $request, |
|
61 | + IURLGenerator $urlGenerator, |
|
62 | + ClientMapper $clientMapper, |
|
63 | + ISession $session, |
|
64 | + IL10N $l) { |
|
65 | + parent::__construct($appName, $request); |
|
66 | + $this->urlGenerator = $urlGenerator; |
|
67 | + $this->clientMapper = $clientMapper; |
|
68 | + $this->session = $session; |
|
69 | + $this->l = $l; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @PublicPage |
|
74 | - * @NoCSRFRequired |
|
75 | - * @UseSession |
|
76 | - * |
|
77 | - * @param string $client_id |
|
78 | - * @param string $state |
|
79 | - * @param string $response_type |
|
80 | - * @return Response |
|
81 | - */ |
|
82 | - public function authorize($client_id, |
|
83 | - $state, |
|
84 | - $response_type): Response { |
|
85 | - try { |
|
86 | - $client = $this->clientMapper->getByIdentifier($client_id); |
|
87 | - } catch (ClientNotFoundException $e) { |
|
88 | - $params = [ |
|
89 | - 'content' => $this->l->t('Your client is not authorized to connect. Please inform the administrator of your client.'), |
|
90 | - ]; |
|
91 | - return new TemplateResponse('core', '404', $params, 'guest'); |
|
92 | - } |
|
72 | + /** |
|
73 | + * @PublicPage |
|
74 | + * @NoCSRFRequired |
|
75 | + * @UseSession |
|
76 | + * |
|
77 | + * @param string $client_id |
|
78 | + * @param string $state |
|
79 | + * @param string $response_type |
|
80 | + * @return Response |
|
81 | + */ |
|
82 | + public function authorize($client_id, |
|
83 | + $state, |
|
84 | + $response_type): Response { |
|
85 | + try { |
|
86 | + $client = $this->clientMapper->getByIdentifier($client_id); |
|
87 | + } catch (ClientNotFoundException $e) { |
|
88 | + $params = [ |
|
89 | + 'content' => $this->l->t('Your client is not authorized to connect. Please inform the administrator of your client.'), |
|
90 | + ]; |
|
91 | + return new TemplateResponse('core', '404', $params, 'guest'); |
|
92 | + } |
|
93 | 93 | |
94 | - if ($response_type !== 'code') { |
|
95 | - //Fail |
|
96 | - $url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state; |
|
97 | - return new RedirectResponse($url); |
|
98 | - } |
|
94 | + if ($response_type !== 'code') { |
|
95 | + //Fail |
|
96 | + $url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state; |
|
97 | + return new RedirectResponse($url); |
|
98 | + } |
|
99 | 99 | |
100 | - $this->session->set('oauth.state', $state); |
|
100 | + $this->session->set('oauth.state', $state); |
|
101 | 101 | |
102 | - $targetUrl = $this->urlGenerator->linkToRouteAbsolute( |
|
103 | - 'core.ClientFlowLogin.showAuthPickerPage', |
|
104 | - [ |
|
105 | - 'clientIdentifier' => $client->getClientIdentifier(), |
|
106 | - ] |
|
107 | - ); |
|
108 | - return new RedirectResponse($targetUrl); |
|
109 | - } |
|
102 | + $targetUrl = $this->urlGenerator->linkToRouteAbsolute( |
|
103 | + 'core.ClientFlowLogin.showAuthPickerPage', |
|
104 | + [ |
|
105 | + 'clientIdentifier' => $client->getClientIdentifier(), |
|
106 | + ] |
|
107 | + ); |
|
108 | + return new RedirectResponse($targetUrl); |
|
109 | + } |
|
110 | 110 | } |