@@ -33,51 +33,51 @@ |
||
33 | 33 | */ |
34 | 34 | class VerifyMountPointEvent extends Event { |
35 | 35 | |
36 | - /** @var IShare */ |
|
37 | - private $share; |
|
38 | - /** @var View */ |
|
39 | - private $view; |
|
40 | - /** @var string */ |
|
41 | - private $parent; |
|
36 | + /** @var IShare */ |
|
37 | + private $share; |
|
38 | + /** @var View */ |
|
39 | + private $view; |
|
40 | + /** @var string */ |
|
41 | + private $parent; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @since 19.0.0 |
|
45 | - */ |
|
46 | - public function __construct(IShare $share, |
|
47 | - View $view, |
|
48 | - string $parent) { |
|
49 | - parent::__construct(); |
|
43 | + /** |
|
44 | + * @since 19.0.0 |
|
45 | + */ |
|
46 | + public function __construct(IShare $share, |
|
47 | + View $view, |
|
48 | + string $parent) { |
|
49 | + parent::__construct(); |
|
50 | 50 | |
51 | - $this->share = $share; |
|
52 | - $this->view = $view; |
|
53 | - $this->parent = $parent; |
|
54 | - } |
|
51 | + $this->share = $share; |
|
52 | + $this->view = $view; |
|
53 | + $this->parent = $parent; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @since 19.0.0 |
|
58 | - */ |
|
59 | - public function getShare(): IShare { |
|
60 | - return $this->share; |
|
61 | - } |
|
56 | + /** |
|
57 | + * @since 19.0.0 |
|
58 | + */ |
|
59 | + public function getShare(): IShare { |
|
60 | + return $this->share; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @since 19.0.0 |
|
65 | - */ |
|
66 | - public function getView(): View { |
|
67 | - return $this->view; |
|
68 | - } |
|
63 | + /** |
|
64 | + * @since 19.0.0 |
|
65 | + */ |
|
66 | + public function getView(): View { |
|
67 | + return $this->view; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @since 19.0.0 |
|
72 | - */ |
|
73 | - public function getParent(): string { |
|
74 | - return $this->parent; |
|
75 | - } |
|
70 | + /** |
|
71 | + * @since 19.0.0 |
|
72 | + */ |
|
73 | + public function getParent(): string { |
|
74 | + return $this->parent; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @since 19.0.0 |
|
79 | - */ |
|
80 | - public function setParent(string $parent): void { |
|
81 | - $this->parent = $parent; |
|
82 | - } |
|
77 | + /** |
|
78 | + * @since 19.0.0 |
|
79 | + */ |
|
80 | + public function setParent(string $parent): void { |
|
81 | + $this->parent = $parent; |
|
82 | + } |
|
83 | 83 | } |
@@ -37,64 +37,64 @@ |
||
37 | 37 | * @since 15.0.0 |
38 | 38 | */ |
39 | 39 | interface IVersionBackend { |
40 | - /** |
|
41 | - * Whether or not this version backend should be used for a storage |
|
42 | - * |
|
43 | - * If false is returned then the next applicable backend will be used |
|
44 | - * |
|
45 | - * @param IStorage $storage |
|
46 | - * @return bool |
|
47 | - * @since 17.0.0 |
|
48 | - */ |
|
49 | - public function useBackendForStorage(IStorage $storage): bool; |
|
40 | + /** |
|
41 | + * Whether or not this version backend should be used for a storage |
|
42 | + * |
|
43 | + * If false is returned then the next applicable backend will be used |
|
44 | + * |
|
45 | + * @param IStorage $storage |
|
46 | + * @return bool |
|
47 | + * @since 17.0.0 |
|
48 | + */ |
|
49 | + public function useBackendForStorage(IStorage $storage): bool; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Get all versions for a file |
|
53 | - * |
|
54 | - * @param IUser $user |
|
55 | - * @param FileInfo $file |
|
56 | - * @return IVersion[] |
|
57 | - * @since 15.0.0 |
|
58 | - */ |
|
59 | - public function getVersionsForFile(IUser $user, FileInfo $file): array; |
|
51 | + /** |
|
52 | + * Get all versions for a file |
|
53 | + * |
|
54 | + * @param IUser $user |
|
55 | + * @param FileInfo $file |
|
56 | + * @return IVersion[] |
|
57 | + * @since 15.0.0 |
|
58 | + */ |
|
59 | + public function getVersionsForFile(IUser $user, FileInfo $file): array; |
|
60 | 60 | |
61 | - /** |
|
62 | - * Create a new version for a file |
|
63 | - * |
|
64 | - * @param IUser $user |
|
65 | - * @param FileInfo $file |
|
66 | - * @since 15.0.0 |
|
67 | - */ |
|
68 | - public function createVersion(IUser $user, FileInfo $file); |
|
61 | + /** |
|
62 | + * Create a new version for a file |
|
63 | + * |
|
64 | + * @param IUser $user |
|
65 | + * @param FileInfo $file |
|
66 | + * @since 15.0.0 |
|
67 | + */ |
|
68 | + public function createVersion(IUser $user, FileInfo $file); |
|
69 | 69 | |
70 | - /** |
|
71 | - * Restore this version |
|
72 | - * |
|
73 | - * @param IVersion $version |
|
74 | - * @since 15.0.0 |
|
75 | - */ |
|
76 | - public function rollback(IVersion $version); |
|
70 | + /** |
|
71 | + * Restore this version |
|
72 | + * |
|
73 | + * @param IVersion $version |
|
74 | + * @since 15.0.0 |
|
75 | + */ |
|
76 | + public function rollback(IVersion $version); |
|
77 | 77 | |
78 | - /** |
|
79 | - * Open the file for reading |
|
80 | - * |
|
81 | - * @param IVersion $version |
|
82 | - * @return resource |
|
83 | - * @throws NotFoundException |
|
84 | - * @since 15.0.0 |
|
85 | - */ |
|
86 | - public function read(IVersion $version); |
|
78 | + /** |
|
79 | + * Open the file for reading |
|
80 | + * |
|
81 | + * @param IVersion $version |
|
82 | + * @return resource |
|
83 | + * @throws NotFoundException |
|
84 | + * @since 15.0.0 |
|
85 | + */ |
|
86 | + public function read(IVersion $version); |
|
87 | 87 | |
88 | - /** |
|
89 | - * Get the preview for a specific version of a file |
|
90 | - * |
|
91 | - * @param IUser $user |
|
92 | - * @param FileInfo $sourceFile |
|
93 | - * @param int|string $revision |
|
94 | - * |
|
95 | - * @return File |
|
96 | - * |
|
97 | - * @since 15.0.0 |
|
98 | - */ |
|
99 | - public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File; |
|
88 | + /** |
|
89 | + * Get the preview for a specific version of a file |
|
90 | + * |
|
91 | + * @param IUser $user |
|
92 | + * @param FileInfo $sourceFile |
|
93 | + * @param int|string $revision |
|
94 | + * |
|
95 | + * @return File |
|
96 | + * |
|
97 | + * @since 15.0.0 |
|
98 | + */ |
|
99 | + public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File; |
|
100 | 100 | } |
@@ -30,57 +30,57 @@ |
||
30 | 30 | |
31 | 31 | class EnforcementState implements JsonSerializable { |
32 | 32 | |
33 | - /** @var bool */ |
|
34 | - private $enforced; |
|
33 | + /** @var bool */ |
|
34 | + private $enforced; |
|
35 | 35 | |
36 | - /** @var array */ |
|
37 | - private $enforcedGroups; |
|
36 | + /** @var array */ |
|
37 | + private $enforcedGroups; |
|
38 | 38 | |
39 | - /** @var array */ |
|
40 | - private $excludedGroups; |
|
39 | + /** @var array */ |
|
40 | + private $excludedGroups; |
|
41 | 41 | |
42 | - /** |
|
43 | - * EnforcementState constructor. |
|
44 | - * |
|
45 | - * @param bool $enforced |
|
46 | - * @param string[] $enforcedGroups |
|
47 | - * @param string[] $excludedGroups |
|
48 | - */ |
|
49 | - public function __construct(bool $enforced, |
|
50 | - array $enforcedGroups = [], |
|
51 | - array $excludedGroups = []) { |
|
52 | - $this->enforced = $enforced; |
|
53 | - $this->enforcedGroups = $enforcedGroups; |
|
54 | - $this->excludedGroups = $excludedGroups; |
|
55 | - } |
|
42 | + /** |
|
43 | + * EnforcementState constructor. |
|
44 | + * |
|
45 | + * @param bool $enforced |
|
46 | + * @param string[] $enforcedGroups |
|
47 | + * @param string[] $excludedGroups |
|
48 | + */ |
|
49 | + public function __construct(bool $enforced, |
|
50 | + array $enforcedGroups = [], |
|
51 | + array $excludedGroups = []) { |
|
52 | + $this->enforced = $enforced; |
|
53 | + $this->enforcedGroups = $enforcedGroups; |
|
54 | + $this->excludedGroups = $excludedGroups; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return bool |
|
59 | - */ |
|
60 | - public function isEnforced(): bool { |
|
61 | - return $this->enforced; |
|
62 | - } |
|
57 | + /** |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | + public function isEnforced(): bool { |
|
61 | + return $this->enforced; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return string[] |
|
66 | - */ |
|
67 | - public function getEnforcedGroups(): array { |
|
68 | - return $this->enforcedGroups; |
|
69 | - } |
|
64 | + /** |
|
65 | + * @return string[] |
|
66 | + */ |
|
67 | + public function getEnforcedGroups(): array { |
|
68 | + return $this->enforcedGroups; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return string[] |
|
73 | - */ |
|
74 | - public function getExcludedGroups(): array { |
|
75 | - return $this->excludedGroups; |
|
76 | - } |
|
71 | + /** |
|
72 | + * @return string[] |
|
73 | + */ |
|
74 | + public function getExcludedGroups(): array { |
|
75 | + return $this->excludedGroups; |
|
76 | + } |
|
77 | 77 | |
78 | - public function jsonSerialize(): array { |
|
79 | - return [ |
|
80 | - 'enforced' => $this->enforced, |
|
81 | - 'enforcedGroups' => $this->enforcedGroups, |
|
82 | - 'excludedGroups' => $this->excludedGroups, |
|
83 | - ]; |
|
84 | - } |
|
78 | + public function jsonSerialize(): array { |
|
79 | + return [ |
|
80 | + 'enforced' => $this->enforced, |
|
81 | + 'enforcedGroups' => $this->enforcedGroups, |
|
82 | + 'excludedGroups' => $this->excludedGroups, |
|
83 | + ]; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | } |
@@ -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 | } |
@@ -33,61 +33,61 @@ |
||
33 | 33 | |
34 | 34 | class Version010000Date20200304152605 extends SimpleMigrationStep { |
35 | 35 | |
36 | - /** |
|
37 | - * @param IOutput $output |
|
38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | - * @param array $options |
|
40 | - * |
|
41 | - * @return ISchemaWrapper |
|
42 | - */ |
|
43 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | - /** @var ISchemaWrapper $schema */ |
|
45 | - $schema = $schemaClosure(); |
|
36 | + /** |
|
37 | + * @param IOutput $output |
|
38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | + * @param array $options |
|
40 | + * |
|
41 | + * @return ISchemaWrapper |
|
42 | + */ |
|
43 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | + /** @var ISchemaWrapper $schema */ |
|
45 | + $schema = $schemaClosure(); |
|
46 | 46 | |
47 | - $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | - $table->addColumn('id', 'integer', [ |
|
49 | - 'autoincrement' => true, |
|
50 | - 'notnull' => true, |
|
51 | - 'length' => 4, |
|
52 | - ]); |
|
53 | - $table->addColumn('actor_uid', 'string', [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 64, |
|
56 | - ]); |
|
57 | - $table->addColumn('uid', 'string', [ |
|
58 | - 'notnull' => false, |
|
59 | - 'length' => 64, |
|
60 | - ]); |
|
61 | - $table->addColumn('email', 'string', [ |
|
62 | - 'notnull' => false, |
|
63 | - 'length' => 255, |
|
64 | - ]); |
|
65 | - $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | - 'notnull' => false, |
|
67 | - 'length' => 255, |
|
68 | - ]); |
|
69 | - $table->addColumn('card', 'blob', [ |
|
70 | - 'notnull' => true, |
|
71 | - ]); |
|
72 | - $table->addColumn('last_contact', 'integer', [ |
|
73 | - 'notnull' => true, |
|
74 | - 'length' => 4, |
|
75 | - ]); |
|
76 | - $table->setPrimaryKey(['id']); |
|
77 | - // To find all recent entries |
|
78 | - $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | - // To find a specific entry |
|
80 | - $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | - // To find all recent entries with a given UID |
|
82 | - $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | - // To find all recent entries with a given email address |
|
84 | - $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | - // To find all recent entries with a give federated cloud id |
|
86 | - $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | - // For the cleanup |
|
88 | - $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
47 | + $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | + $table->addColumn('id', 'integer', [ |
|
49 | + 'autoincrement' => true, |
|
50 | + 'notnull' => true, |
|
51 | + 'length' => 4, |
|
52 | + ]); |
|
53 | + $table->addColumn('actor_uid', 'string', [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 64, |
|
56 | + ]); |
|
57 | + $table->addColumn('uid', 'string', [ |
|
58 | + 'notnull' => false, |
|
59 | + 'length' => 64, |
|
60 | + ]); |
|
61 | + $table->addColumn('email', 'string', [ |
|
62 | + 'notnull' => false, |
|
63 | + 'length' => 255, |
|
64 | + ]); |
|
65 | + $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | + 'notnull' => false, |
|
67 | + 'length' => 255, |
|
68 | + ]); |
|
69 | + $table->addColumn('card', 'blob', [ |
|
70 | + 'notnull' => true, |
|
71 | + ]); |
|
72 | + $table->addColumn('last_contact', 'integer', [ |
|
73 | + 'notnull' => true, |
|
74 | + 'length' => 4, |
|
75 | + ]); |
|
76 | + $table->setPrimaryKey(['id']); |
|
77 | + // To find all recent entries |
|
78 | + $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | + // To find a specific entry |
|
80 | + $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | + // To find all recent entries with a given UID |
|
82 | + $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | + // To find all recent entries with a given email address |
|
84 | + $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | + // To find all recent entries with a give federated cloud id |
|
86 | + $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | + // For the cleanup |
|
88 | + $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
89 | 89 | |
90 | - return $schema; |
|
91 | - } |
|
90 | + return $schema; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -33,49 +33,49 @@ |
||
33 | 33 | |
34 | 34 | class AddressBookProvider implements IAddressBookProvider { |
35 | 35 | |
36 | - /** @var RecentContactMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var RecentContactMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var IL10N */ |
|
40 | - private $l10n; |
|
39 | + /** @var IL10N */ |
|
40 | + private $l10n; |
|
41 | 41 | |
42 | - public function __construct(RecentContactMapper $mapper, IL10N $l10n) { |
|
43 | - $this->mapper = $mapper; |
|
44 | - $this->l10n = $l10n; |
|
45 | - } |
|
42 | + public function __construct(RecentContactMapper $mapper, IL10N $l10n) { |
|
43 | + $this->mapper = $mapper; |
|
44 | + $this->l10n = $l10n; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @inheritDoc |
|
49 | - */ |
|
50 | - public function getAppId(): string { |
|
51 | - return Application::APP_ID; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @inheritDoc |
|
49 | + */ |
|
50 | + public function getAppId(): string { |
|
51 | + return Application::APP_ID; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @inheritDoc |
|
56 | - */ |
|
57 | - public function fetchAllForAddressBookHome(string $principalUri): array { |
|
58 | - return [ |
|
59 | - new AddressBook($this->mapper, $this->l10n, $principalUri) |
|
60 | - ]; |
|
61 | - } |
|
54 | + /** |
|
55 | + * @inheritDoc |
|
56 | + */ |
|
57 | + public function fetchAllForAddressBookHome(string $principalUri): array { |
|
58 | + return [ |
|
59 | + new AddressBook($this->mapper, $this->l10n, $principalUri) |
|
60 | + ]; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @inheritDoc |
|
65 | - */ |
|
66 | - public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool { |
|
67 | - return $uri === AddressBook::URI; |
|
68 | - } |
|
63 | + /** |
|
64 | + * @inheritDoc |
|
65 | + */ |
|
66 | + public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool { |
|
67 | + return $uri === AddressBook::URI; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @inheritDoc |
|
72 | - */ |
|
73 | - public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook { |
|
74 | - if ($uri === AddressBook::URI) { |
|
75 | - return new AddressBook($this->mapper, $this->l10n, $principalUri); |
|
76 | - } |
|
70 | + /** |
|
71 | + * @inheritDoc |
|
72 | + */ |
|
73 | + public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook { |
|
74 | + if ($uri === AddressBook::URI) { |
|
75 | + return new AddressBook($this->mapper, $this->l10n, $principalUri); |
|
76 | + } |
|
77 | 77 | |
78 | - return null; |
|
79 | - } |
|
78 | + return null; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
@@ -40,97 +40,97 @@ |
||
40 | 40 | */ |
41 | 41 | class ContactInteractedWithEvent extends Event { |
42 | 42 | |
43 | - /** @var IUser */ |
|
44 | - private $actor; |
|
45 | - |
|
46 | - /** @var string|null */ |
|
47 | - private $uid; |
|
48 | - |
|
49 | - /** @var string|null */ |
|
50 | - private $email; |
|
51 | - |
|
52 | - /** @var string|null */ |
|
53 | - private $federatedCloudId; |
|
54 | - |
|
55 | - /** |
|
56 | - * @param IUser $actor the user who started the interaction |
|
57 | - * |
|
58 | - * @since 19.0.0 |
|
59 | - */ |
|
60 | - public function __construct(IUser $actor) { |
|
61 | - parent::__construct(); |
|
62 | - $this->actor = $actor; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * @return IUser |
|
67 | - * @since 19.0.0 |
|
68 | - */ |
|
69 | - public function getActor(): IUser { |
|
70 | - return $this->actor; |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * @return string|null |
|
75 | - * @since 19.0.0 |
|
76 | - */ |
|
77 | - public function getUid(): ?string { |
|
78 | - return $this->uid; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Set the uid of the person interacted with, if known |
|
83 | - * |
|
84 | - * @param string $uid |
|
85 | - * |
|
86 | - * @return self |
|
87 | - * @since 19.0.0 |
|
88 | - */ |
|
89 | - public function setUid(string $uid): self { |
|
90 | - $this->uid = $uid; |
|
91 | - return $this; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @return string|null |
|
96 | - * @since 19.0.0 |
|
97 | - */ |
|
98 | - public function getEmail(): ?string { |
|
99 | - return $this->email; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Set the email of the person interacted with, if known |
|
104 | - * |
|
105 | - * @param string $email |
|
106 | - * |
|
107 | - * @return self |
|
108 | - * @since 19.0.0 |
|
109 | - */ |
|
110 | - public function setEmail(string $email): self { |
|
111 | - $this->email = $email; |
|
112 | - return $this; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * @return string|null |
|
117 | - * @since 19.0.0 |
|
118 | - */ |
|
119 | - public function getFederatedCloudId(): ?string { |
|
120 | - return $this->federatedCloudId; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Set the federated cloud of the person interacted with, if known |
|
125 | - * |
|
126 | - * @param string $federatedCloudId |
|
127 | - * |
|
128 | - * @return self |
|
129 | - * @since 19.0.0 |
|
130 | - */ |
|
131 | - public function setFederatedCloudId(string $federatedCloudId): self { |
|
132 | - $this->federatedCloudId = $federatedCloudId; |
|
133 | - return $this; |
|
134 | - } |
|
43 | + /** @var IUser */ |
|
44 | + private $actor; |
|
45 | + |
|
46 | + /** @var string|null */ |
|
47 | + private $uid; |
|
48 | + |
|
49 | + /** @var string|null */ |
|
50 | + private $email; |
|
51 | + |
|
52 | + /** @var string|null */ |
|
53 | + private $federatedCloudId; |
|
54 | + |
|
55 | + /** |
|
56 | + * @param IUser $actor the user who started the interaction |
|
57 | + * |
|
58 | + * @since 19.0.0 |
|
59 | + */ |
|
60 | + public function __construct(IUser $actor) { |
|
61 | + parent::__construct(); |
|
62 | + $this->actor = $actor; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * @return IUser |
|
67 | + * @since 19.0.0 |
|
68 | + */ |
|
69 | + public function getActor(): IUser { |
|
70 | + return $this->actor; |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * @return string|null |
|
75 | + * @since 19.0.0 |
|
76 | + */ |
|
77 | + public function getUid(): ?string { |
|
78 | + return $this->uid; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Set the uid of the person interacted with, if known |
|
83 | + * |
|
84 | + * @param string $uid |
|
85 | + * |
|
86 | + * @return self |
|
87 | + * @since 19.0.0 |
|
88 | + */ |
|
89 | + public function setUid(string $uid): self { |
|
90 | + $this->uid = $uid; |
|
91 | + return $this; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @return string|null |
|
96 | + * @since 19.0.0 |
|
97 | + */ |
|
98 | + public function getEmail(): ?string { |
|
99 | + return $this->email; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Set the email of the person interacted with, if known |
|
104 | + * |
|
105 | + * @param string $email |
|
106 | + * |
|
107 | + * @return self |
|
108 | + * @since 19.0.0 |
|
109 | + */ |
|
110 | + public function setEmail(string $email): self { |
|
111 | + $this->email = $email; |
|
112 | + return $this; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * @return string|null |
|
117 | + * @since 19.0.0 |
|
118 | + */ |
|
119 | + public function getFederatedCloudId(): ?string { |
|
120 | + return $this->federatedCloudId; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Set the federated cloud of the person interacted with, if known |
|
125 | + * |
|
126 | + * @param string $federatedCloudId |
|
127 | + * |
|
128 | + * @return self |
|
129 | + * @since 19.0.0 |
|
130 | + */ |
|
131 | + public function setFederatedCloudId(string $federatedCloudId): self { |
|
132 | + $this->federatedCloudId = $federatedCloudId; |
|
133 | + return $this; |
|
134 | + } |
|
135 | 135 | |
136 | 136 | } |
@@ -38,110 +38,110 @@ |
||
38 | 38 | */ |
39 | 39 | class TagService { |
40 | 40 | |
41 | - /** @var IUserSession */ |
|
42 | - private $userSession; |
|
43 | - /** @var IManager */ |
|
44 | - private $activityManager; |
|
45 | - /** @var ITags */ |
|
46 | - private $tagger; |
|
47 | - /** @var Folder */ |
|
48 | - private $homeFolder; |
|
49 | - /** @var EventDispatcherInterface */ |
|
50 | - private $dispatcher; |
|
41 | + /** @var IUserSession */ |
|
42 | + private $userSession; |
|
43 | + /** @var IManager */ |
|
44 | + private $activityManager; |
|
45 | + /** @var ITags */ |
|
46 | + private $tagger; |
|
47 | + /** @var Folder */ |
|
48 | + private $homeFolder; |
|
49 | + /** @var EventDispatcherInterface */ |
|
50 | + private $dispatcher; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param IUserSession $userSession |
|
54 | - * @param IManager $activityManager |
|
55 | - * @param ITags $tagger |
|
56 | - * @param Folder $homeFolder |
|
57 | - * @param EventDispatcherInterface $dispatcher |
|
58 | - */ |
|
59 | - public function __construct( |
|
60 | - IUserSession $userSession, |
|
61 | - IManager $activityManager, |
|
62 | - ITags $tagger, |
|
63 | - Folder $homeFolder, |
|
64 | - EventDispatcherInterface $dispatcher |
|
65 | - ) { |
|
66 | - $this->userSession = $userSession; |
|
67 | - $this->activityManager = $activityManager; |
|
68 | - $this->tagger = $tagger; |
|
69 | - $this->homeFolder = $homeFolder; |
|
70 | - $this->dispatcher = $dispatcher; |
|
71 | - } |
|
52 | + /** |
|
53 | + * @param IUserSession $userSession |
|
54 | + * @param IManager $activityManager |
|
55 | + * @param ITags $tagger |
|
56 | + * @param Folder $homeFolder |
|
57 | + * @param EventDispatcherInterface $dispatcher |
|
58 | + */ |
|
59 | + public function __construct( |
|
60 | + IUserSession $userSession, |
|
61 | + IManager $activityManager, |
|
62 | + ITags $tagger, |
|
63 | + Folder $homeFolder, |
|
64 | + EventDispatcherInterface $dispatcher |
|
65 | + ) { |
|
66 | + $this->userSession = $userSession; |
|
67 | + $this->activityManager = $activityManager; |
|
68 | + $this->tagger = $tagger; |
|
69 | + $this->homeFolder = $homeFolder; |
|
70 | + $this->dispatcher = $dispatcher; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Updates the tags of the specified file path. |
|
75 | - * The passed tags are absolute, which means they will |
|
76 | - * replace the actual tag selection. |
|
77 | - * |
|
78 | - * @param string $path path |
|
79 | - * @param array $tags array of tags |
|
80 | - * @return array list of tags |
|
81 | - * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | - */ |
|
83 | - public function updateFileTags($path, $tags) { |
|
84 | - $fileId = $this->homeFolder->get($path)->getId(); |
|
73 | + /** |
|
74 | + * Updates the tags of the specified file path. |
|
75 | + * The passed tags are absolute, which means they will |
|
76 | + * replace the actual tag selection. |
|
77 | + * |
|
78 | + * @param string $path path |
|
79 | + * @param array $tags array of tags |
|
80 | + * @return array list of tags |
|
81 | + * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | + */ |
|
83 | + public function updateFileTags($path, $tags) { |
|
84 | + $fileId = $this->homeFolder->get($path)->getId(); |
|
85 | 85 | |
86 | - $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
86 | + $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
87 | 87 | |
88 | - if (!empty($currentTags)) { |
|
89 | - $currentTags = current($currentTags); |
|
90 | - } |
|
88 | + if (!empty($currentTags)) { |
|
89 | + $currentTags = current($currentTags); |
|
90 | + } |
|
91 | 91 | |
92 | - $newTags = array_diff($tags, $currentTags); |
|
93 | - foreach ($newTags as $tag) { |
|
94 | - if ($tag === ITags::TAG_FAVORITE) { |
|
95 | - $this->addActivity(true, $fileId, $path); |
|
96 | - } |
|
97 | - $this->tagger->tagAs($fileId, $tag); |
|
98 | - } |
|
99 | - $deletedTags = array_diff($currentTags, $tags); |
|
100 | - foreach ($deletedTags as $tag) { |
|
101 | - if ($tag === ITags::TAG_FAVORITE) { |
|
102 | - $this->addActivity(false, $fileId, $path); |
|
103 | - } |
|
104 | - $this->tagger->unTag($fileId, $tag); |
|
105 | - } |
|
92 | + $newTags = array_diff($tags, $currentTags); |
|
93 | + foreach ($newTags as $tag) { |
|
94 | + if ($tag === ITags::TAG_FAVORITE) { |
|
95 | + $this->addActivity(true, $fileId, $path); |
|
96 | + } |
|
97 | + $this->tagger->tagAs($fileId, $tag); |
|
98 | + } |
|
99 | + $deletedTags = array_diff($currentTags, $tags); |
|
100 | + foreach ($deletedTags as $tag) { |
|
101 | + if ($tag === ITags::TAG_FAVORITE) { |
|
102 | + $this->addActivity(false, $fileId, $path); |
|
103 | + } |
|
104 | + $this->tagger->unTag($fileId, $tag); |
|
105 | + } |
|
106 | 106 | |
107 | - // TODO: re-read from tagger to make sure the |
|
108 | - // list is up to date, in case of concurrent changes ? |
|
109 | - return $tags; |
|
110 | - } |
|
107 | + // TODO: re-read from tagger to make sure the |
|
108 | + // list is up to date, in case of concurrent changes ? |
|
109 | + return $tags; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * @param bool $addToFavorite |
|
114 | - * @param int $fileId |
|
115 | - * @param string $path |
|
116 | - */ |
|
117 | - protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | - $user = $this->userSession->getUser(); |
|
119 | - if (!$user instanceof IUser) { |
|
120 | - return; |
|
121 | - } |
|
112 | + /** |
|
113 | + * @param bool $addToFavorite |
|
114 | + * @param int $fileId |
|
115 | + * @param string $path |
|
116 | + */ |
|
117 | + protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | + $user = $this->userSession->getUser(); |
|
119 | + if (!$user instanceof IUser) { |
|
120 | + return; |
|
121 | + } |
|
122 | 122 | |
123 | - $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | - $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | - 'userId' => $user->getUID(), |
|
126 | - 'fileId' => $fileId, |
|
127 | - 'path' => $path, |
|
128 | - ])); |
|
123 | + $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | + $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | + 'userId' => $user->getUID(), |
|
126 | + 'fileId' => $fileId, |
|
127 | + 'path' => $path, |
|
128 | + ])); |
|
129 | 129 | |
130 | - $event = $this->activityManager->generateEvent(); |
|
131 | - try { |
|
132 | - $event->setApp('files') |
|
133 | - ->setObject('files', $fileId, $path) |
|
134 | - ->setType('favorite') |
|
135 | - ->setAuthor($user->getUID()) |
|
136 | - ->setAffectedUser($user->getUID()) |
|
137 | - ->setTimestamp(time()) |
|
138 | - ->setSubject( |
|
139 | - $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | - ['id' => $fileId, 'path' => $path] |
|
141 | - ); |
|
142 | - $this->activityManager->publish($event); |
|
143 | - } catch (\InvalidArgumentException $e) { |
|
144 | - } catch (\BadMethodCallException $e) { |
|
145 | - } |
|
146 | - } |
|
130 | + $event = $this->activityManager->generateEvent(); |
|
131 | + try { |
|
132 | + $event->setApp('files') |
|
133 | + ->setObject('files', $fileId, $path) |
|
134 | + ->setType('favorite') |
|
135 | + ->setAuthor($user->getUID()) |
|
136 | + ->setAffectedUser($user->getUID()) |
|
137 | + ->setTimestamp(time()) |
|
138 | + ->setSubject( |
|
139 | + $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | + ['id' => $fileId, 'path' => $path] |
|
141 | + ); |
|
142 | + $this->activityManager->publish($event); |
|
143 | + } catch (\InvalidArgumentException $e) { |
|
144 | + } catch (\BadMethodCallException $e) { |
|
145 | + } |
|
146 | + } |
|
147 | 147 | } |
@@ -32,23 +32,23 @@ |
||
32 | 32 | $limit = null; |
33 | 33 | $offset = null; |
34 | 34 | if (isset($_GET['pattern'])) { |
35 | - $pattern = (string)$_GET['pattern']; |
|
35 | + $pattern = (string)$_GET['pattern']; |
|
36 | 36 | } |
37 | 37 | if (isset($_GET['limit'])) { |
38 | - $limit = (int)$_GET['limit']; |
|
38 | + $limit = (int)$_GET['limit']; |
|
39 | 39 | } |
40 | 40 | if (isset($_GET['offset'])) { |
41 | - $offset = (int)$_GET['offset']; |
|
41 | + $offset = (int)$_GET['offset']; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $groups = []; |
45 | 45 | foreach (\OC::$server->getGroupManager()->search($pattern, $limit, $offset) as $group) { |
46 | - $groups[$group->getGID()] = $group->getDisplayName(); |
|
46 | + $groups[$group->getGID()] = $group->getDisplayName(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $users = []; |
50 | 50 | foreach (\OC::$server->getUserManager()->searchDisplayName($pattern, $limit, $offset) as $user) { |
51 | - $users[$user->getUID()] = $user->getDisplayName(); |
|
51 | + $users[$user->getUID()] = $user->getDisplayName(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $results = ['groups' => $groups, 'users' => $users]; |