@@ -32,15 +32,15 @@ |
||
32 | 32 | use Doctrine\DBAL\TransactionIsolationLevel; |
33 | 33 | |
34 | 34 | class SetTransactionIsolationLevel implements EventSubscriber { |
35 | - /** |
|
36 | - * @param ConnectionEventArgs $args |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function postConnect(ConnectionEventArgs $args) { |
|
40 | - $args->getConnection()->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param ConnectionEventArgs $args |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function postConnect(ConnectionEventArgs $args) { |
|
40 | + $args->getConnection()->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED); |
|
41 | + } |
|
42 | 42 | |
43 | - public function getSubscribedEvents() { |
|
44 | - return [Events::postConnect]; |
|
45 | - } |
|
43 | + public function getSubscribedEvents() { |
|
44 | + return [Events::postConnect]; |
|
45 | + } |
|
46 | 46 | } |
@@ -32,42 +32,42 @@ |
||
32 | 32 | */ |
33 | 33 | interface ICalendarProvider { |
34 | 34 | |
35 | - /** |
|
36 | - * Provides the appId of the plugin |
|
37 | - * |
|
38 | - * @since 19.0.0 |
|
39 | - * @return string AppId |
|
40 | - */ |
|
41 | - public function getAppId(): string; |
|
35 | + /** |
|
36 | + * Provides the appId of the plugin |
|
37 | + * |
|
38 | + * @since 19.0.0 |
|
39 | + * @return string AppId |
|
40 | + */ |
|
41 | + public function getAppId(): string; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Fetches all calendars for a given principal uri |
|
45 | - * |
|
46 | - * @since 19.0.0 |
|
47 | - * @param string $principalUri E.g. principals/users/user1 |
|
48 | - * @return ExternalCalendar[] Array of all calendars |
|
49 | - */ |
|
50 | - public function fetchAllForCalendarHome(string $principalUri): array; |
|
43 | + /** |
|
44 | + * Fetches all calendars for a given principal uri |
|
45 | + * |
|
46 | + * @since 19.0.0 |
|
47 | + * @param string $principalUri E.g. principals/users/user1 |
|
48 | + * @return ExternalCalendar[] Array of all calendars |
|
49 | + */ |
|
50 | + public function fetchAllForCalendarHome(string $principalUri): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Checks whether plugin has a calendar for a given principalUri and calendarUri |
|
54 | - * |
|
55 | - * @since 19.0.0 |
|
56 | - * @param string $principalUri E.g. principals/users/user1 |
|
57 | - * @param string $calendarUri E.g. personal |
|
58 | - * @return bool True if calendar for principalUri and calendarUri exists, false otherwise |
|
59 | - */ |
|
60 | - public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool; |
|
52 | + /** |
|
53 | + * Checks whether plugin has a calendar for a given principalUri and calendarUri |
|
54 | + * |
|
55 | + * @since 19.0.0 |
|
56 | + * @param string $principalUri E.g. principals/users/user1 |
|
57 | + * @param string $calendarUri E.g. personal |
|
58 | + * @return bool True if calendar for principalUri and calendarUri exists, false otherwise |
|
59 | + */ |
|
60 | + public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Fetches a calendar for a given principalUri and calendarUri |
|
64 | - * Returns null if calendar does not exist |
|
65 | - * |
|
66 | - * @since 19.0.0 |
|
67 | - * @param string $principalUri E.g. principals/users/user1 |
|
68 | - * @param string $calendarUri E.g. personal |
|
69 | - * @return ExternalCalendar|null Calendar if it exists, null otherwise |
|
70 | - */ |
|
71 | - public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar; |
|
62 | + /** |
|
63 | + * Fetches a calendar for a given principalUri and calendarUri |
|
64 | + * Returns null if calendar does not exist |
|
65 | + * |
|
66 | + * @since 19.0.0 |
|
67 | + * @param string $principalUri E.g. principals/users/user1 |
|
68 | + * @param string $calendarUri E.g. personal |
|
69 | + * @return ExternalCalendar|null Calendar if it exists, null otherwise |
|
70 | + */ |
|
71 | + public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar; |
|
72 | 72 | |
73 | 73 | } |
@@ -27,147 +27,147 @@ |
||
27 | 27 | use OCP\Files\NotFoundException; |
28 | 28 | |
29 | 29 | class NonExistingFolder extends Folder { |
30 | - /** |
|
31 | - * @param string $newPath |
|
32 | - * @throws \OCP\Files\NotFoundException |
|
33 | - */ |
|
34 | - public function rename($newPath) { |
|
35 | - throw new NotFoundException(); |
|
36 | - } |
|
37 | - |
|
38 | - public function delete() { |
|
39 | - throw new NotFoundException(); |
|
40 | - } |
|
41 | - |
|
42 | - public function copy($newPath) { |
|
43 | - throw new NotFoundException(); |
|
44 | - } |
|
45 | - |
|
46 | - public function touch($mtime = null) { |
|
47 | - throw new NotFoundException(); |
|
48 | - } |
|
49 | - |
|
50 | - public function getId() { |
|
51 | - if ($this->fileInfo) { |
|
52 | - return parent::getId(); |
|
53 | - } else { |
|
54 | - throw new NotFoundException(); |
|
55 | - } |
|
56 | - } |
|
57 | - |
|
58 | - public function stat() { |
|
59 | - throw new NotFoundException(); |
|
60 | - } |
|
61 | - |
|
62 | - public function getMTime() { |
|
63 | - if ($this->fileInfo) { |
|
64 | - return parent::getMTime(); |
|
65 | - } else { |
|
66 | - throw new NotFoundException(); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - public function getSize($includeMounts = true) { |
|
71 | - if ($this->fileInfo) { |
|
72 | - return parent::getSize($includeMounts); |
|
73 | - } else { |
|
74 | - throw new NotFoundException(); |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - public function getEtag() { |
|
79 | - if ($this->fileInfo) { |
|
80 | - return parent::getEtag(); |
|
81 | - } else { |
|
82 | - throw new NotFoundException(); |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - public function getPermissions() { |
|
87 | - if ($this->fileInfo) { |
|
88 | - return parent::getPermissions(); |
|
89 | - } else { |
|
90 | - throw new NotFoundException(); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - public function isReadable() { |
|
95 | - if ($this->fileInfo) { |
|
96 | - return parent::isReadable(); |
|
97 | - } else { |
|
98 | - throw new NotFoundException(); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - public function isUpdateable() { |
|
103 | - if ($this->fileInfo) { |
|
104 | - return parent::isUpdateable(); |
|
105 | - } else { |
|
106 | - throw new NotFoundException(); |
|
107 | - } |
|
108 | - } |
|
109 | - |
|
110 | - public function isDeletable() { |
|
111 | - if ($this->fileInfo) { |
|
112 | - return parent::isDeletable(); |
|
113 | - } else { |
|
114 | - throw new NotFoundException(); |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - public function isShareable() { |
|
119 | - if ($this->fileInfo) { |
|
120 | - return parent::isShareable(); |
|
121 | - } else { |
|
122 | - throw new NotFoundException(); |
|
123 | - } |
|
124 | - } |
|
125 | - |
|
126 | - public function get($path) { |
|
127 | - throw new NotFoundException(); |
|
128 | - } |
|
129 | - |
|
130 | - public function getDirectoryListing() { |
|
131 | - throw new NotFoundException(); |
|
132 | - } |
|
133 | - |
|
134 | - public function nodeExists($path) { |
|
135 | - return false; |
|
136 | - } |
|
137 | - |
|
138 | - public function newFolder($path) { |
|
139 | - throw new NotFoundException(); |
|
140 | - } |
|
141 | - |
|
142 | - public function newFile($path, $content = null) { |
|
143 | - throw new NotFoundException(); |
|
144 | - } |
|
145 | - |
|
146 | - public function search($pattern) { |
|
147 | - throw new NotFoundException(); |
|
148 | - } |
|
149 | - |
|
150 | - public function searchByMime($mime) { |
|
151 | - throw new NotFoundException(); |
|
152 | - } |
|
153 | - |
|
154 | - public function searchByTag($tag, $userId) { |
|
155 | - throw new NotFoundException(); |
|
156 | - } |
|
157 | - |
|
158 | - public function getById($id) { |
|
159 | - throw new NotFoundException(); |
|
160 | - } |
|
161 | - |
|
162 | - public function getFreeSpace() { |
|
163 | - throw new NotFoundException(); |
|
164 | - } |
|
165 | - |
|
166 | - public function isCreatable() { |
|
167 | - if ($this->fileInfo) { |
|
168 | - return parent::isCreatable(); |
|
169 | - } else { |
|
170 | - throw new NotFoundException(); |
|
171 | - } |
|
172 | - } |
|
30 | + /** |
|
31 | + * @param string $newPath |
|
32 | + * @throws \OCP\Files\NotFoundException |
|
33 | + */ |
|
34 | + public function rename($newPath) { |
|
35 | + throw new NotFoundException(); |
|
36 | + } |
|
37 | + |
|
38 | + public function delete() { |
|
39 | + throw new NotFoundException(); |
|
40 | + } |
|
41 | + |
|
42 | + public function copy($newPath) { |
|
43 | + throw new NotFoundException(); |
|
44 | + } |
|
45 | + |
|
46 | + public function touch($mtime = null) { |
|
47 | + throw new NotFoundException(); |
|
48 | + } |
|
49 | + |
|
50 | + public function getId() { |
|
51 | + if ($this->fileInfo) { |
|
52 | + return parent::getId(); |
|
53 | + } else { |
|
54 | + throw new NotFoundException(); |
|
55 | + } |
|
56 | + } |
|
57 | + |
|
58 | + public function stat() { |
|
59 | + throw new NotFoundException(); |
|
60 | + } |
|
61 | + |
|
62 | + public function getMTime() { |
|
63 | + if ($this->fileInfo) { |
|
64 | + return parent::getMTime(); |
|
65 | + } else { |
|
66 | + throw new NotFoundException(); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + public function getSize($includeMounts = true) { |
|
71 | + if ($this->fileInfo) { |
|
72 | + return parent::getSize($includeMounts); |
|
73 | + } else { |
|
74 | + throw new NotFoundException(); |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + public function getEtag() { |
|
79 | + if ($this->fileInfo) { |
|
80 | + return parent::getEtag(); |
|
81 | + } else { |
|
82 | + throw new NotFoundException(); |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + public function getPermissions() { |
|
87 | + if ($this->fileInfo) { |
|
88 | + return parent::getPermissions(); |
|
89 | + } else { |
|
90 | + throw new NotFoundException(); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + public function isReadable() { |
|
95 | + if ($this->fileInfo) { |
|
96 | + return parent::isReadable(); |
|
97 | + } else { |
|
98 | + throw new NotFoundException(); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + public function isUpdateable() { |
|
103 | + if ($this->fileInfo) { |
|
104 | + return parent::isUpdateable(); |
|
105 | + } else { |
|
106 | + throw new NotFoundException(); |
|
107 | + } |
|
108 | + } |
|
109 | + |
|
110 | + public function isDeletable() { |
|
111 | + if ($this->fileInfo) { |
|
112 | + return parent::isDeletable(); |
|
113 | + } else { |
|
114 | + throw new NotFoundException(); |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + public function isShareable() { |
|
119 | + if ($this->fileInfo) { |
|
120 | + return parent::isShareable(); |
|
121 | + } else { |
|
122 | + throw new NotFoundException(); |
|
123 | + } |
|
124 | + } |
|
125 | + |
|
126 | + public function get($path) { |
|
127 | + throw new NotFoundException(); |
|
128 | + } |
|
129 | + |
|
130 | + public function getDirectoryListing() { |
|
131 | + throw new NotFoundException(); |
|
132 | + } |
|
133 | + |
|
134 | + public function nodeExists($path) { |
|
135 | + return false; |
|
136 | + } |
|
137 | + |
|
138 | + public function newFolder($path) { |
|
139 | + throw new NotFoundException(); |
|
140 | + } |
|
141 | + |
|
142 | + public function newFile($path, $content = null) { |
|
143 | + throw new NotFoundException(); |
|
144 | + } |
|
145 | + |
|
146 | + public function search($pattern) { |
|
147 | + throw new NotFoundException(); |
|
148 | + } |
|
149 | + |
|
150 | + public function searchByMime($mime) { |
|
151 | + throw new NotFoundException(); |
|
152 | + } |
|
153 | + |
|
154 | + public function searchByTag($tag, $userId) { |
|
155 | + throw new NotFoundException(); |
|
156 | + } |
|
157 | + |
|
158 | + public function getById($id) { |
|
159 | + throw new NotFoundException(); |
|
160 | + } |
|
161 | + |
|
162 | + public function getFreeSpace() { |
|
163 | + throw new NotFoundException(); |
|
164 | + } |
|
165 | + |
|
166 | + public function isCreatable() { |
|
167 | + if ($this->fileInfo) { |
|
168 | + return parent::isCreatable(); |
|
169 | + } else { |
|
170 | + throw new NotFoundException(); |
|
171 | + } |
|
172 | + } |
|
173 | 173 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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]; |