@@ -32,20 +32,20 @@ |
||
32 | 32 | * @since 21.0.0 |
33 | 33 | */ |
34 | 34 | interface ICustomTemplateProvider { |
35 | - /** |
|
36 | - * Return a list of additional templates that the template provider is offering |
|
37 | - * |
|
38 | - * @return File[] |
|
39 | - * @since 21.0.0 |
|
40 | - */ |
|
41 | - public function getCustomTemplates(string $mimetype): array; |
|
35 | + /** |
|
36 | + * Return a list of additional templates that the template provider is offering |
|
37 | + * |
|
38 | + * @return File[] |
|
39 | + * @since 21.0.0 |
|
40 | + */ |
|
41 | + public function getCustomTemplates(string $mimetype): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Return the file for a given template id |
|
45 | - * |
|
46 | - * @param string $template identifier of the template |
|
47 | - * @return File |
|
48 | - * @since 21.0.0 |
|
49 | - */ |
|
50 | - public function getCustomTemplate(string $template): File; |
|
43 | + /** |
|
44 | + * Return the file for a given template id |
|
45 | + * |
|
46 | + * @param string $template identifier of the template |
|
47 | + * @return File |
|
48 | + * @since 21.0.0 |
|
49 | + */ |
|
50 | + public function getCustomTemplate(string $template): File; |
|
51 | 51 | } |
@@ -33,44 +33,44 @@ |
||
33 | 33 | use OCP\IRequest; |
34 | 34 | |
35 | 35 | class TemplateController extends OCSController { |
36 | - protected $templateManager; |
|
36 | + protected $templateManager; |
|
37 | 37 | |
38 | - public function __construct($appName, IRequest $request, ITemplateManager $templateManager) { |
|
39 | - parent::__construct($appName, $request); |
|
40 | - $this->templateManager = $templateManager; |
|
41 | - } |
|
38 | + public function __construct($appName, IRequest $request, ITemplateManager $templateManager) { |
|
39 | + parent::__construct($appName, $request); |
|
40 | + $this->templateManager = $templateManager; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @NoAdminRequired |
|
45 | - */ |
|
46 | - public function list(): DataResponse { |
|
47 | - return new DataResponse($this->templateManager->listTemplates()); |
|
48 | - } |
|
43 | + /** |
|
44 | + * @NoAdminRequired |
|
45 | + */ |
|
46 | + public function list(): DataResponse { |
|
47 | + return new DataResponse($this->templateManager->listTemplates()); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @NoAdminRequired |
|
52 | - * @throws OCSForbiddenException |
|
53 | - */ |
|
54 | - public function create(string $filePath, string $templatePath = '', string $templateType = 'user'): DataResponse { |
|
55 | - try { |
|
56 | - return new DataResponse($this->templateManager->createFromTemplate($filePath, $templatePath, $templateType)); |
|
57 | - } catch (GenericFileException $e) { |
|
58 | - throw new OCSForbiddenException($e->getMessage()); |
|
59 | - } |
|
60 | - } |
|
50 | + /** |
|
51 | + * @NoAdminRequired |
|
52 | + * @throws OCSForbiddenException |
|
53 | + */ |
|
54 | + public function create(string $filePath, string $templatePath = '', string $templateType = 'user'): DataResponse { |
|
55 | + try { |
|
56 | + return new DataResponse($this->templateManager->createFromTemplate($filePath, $templatePath, $templateType)); |
|
57 | + } catch (GenericFileException $e) { |
|
58 | + throw new OCSForbiddenException($e->getMessage()); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @NoAdminRequired |
|
64 | - */ |
|
65 | - public function path(string $templatePath = '', bool $copySystemTemplates = false) { |
|
66 | - try { |
|
67 | - $templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates); |
|
68 | - return new DataResponse([ |
|
69 | - 'template_path' => $templatePath, |
|
70 | - 'templates' => $this->templateManager->listCreators() |
|
71 | - ]); |
|
72 | - } catch (\Exception $e) { |
|
73 | - throw new OCSForbiddenException($e->getMessage()); |
|
74 | - } |
|
75 | - } |
|
62 | + /** |
|
63 | + * @NoAdminRequired |
|
64 | + */ |
|
65 | + public function path(string $templatePath = '', bool $copySystemTemplates = false) { |
|
66 | + try { |
|
67 | + $templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates); |
|
68 | + return new DataResponse([ |
|
69 | + 'template_path' => $templatePath, |
|
70 | + 'templates' => $this->templateManager->listCreators() |
|
71 | + ]); |
|
72 | + } catch (\Exception $e) { |
|
73 | + throw new OCSForbiddenException($e->getMessage()); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | } |
@@ -28,50 +28,50 @@ |
||
28 | 28 | namespace OC\Http; |
29 | 29 | |
30 | 30 | class CookieHelper { |
31 | - public const SAMESITE_NONE = 0; |
|
32 | - public const SAMESITE_LAX = 1; |
|
33 | - public const SAMESITE_STRICT = 2; |
|
31 | + public const SAMESITE_NONE = 0; |
|
32 | + public const SAMESITE_LAX = 1; |
|
33 | + public const SAMESITE_STRICT = 2; |
|
34 | 34 | |
35 | - public static function setCookie(string $name, |
|
36 | - string $value = '', |
|
37 | - int $maxAge = 0, |
|
38 | - string $path = '', |
|
39 | - string $domain = '', |
|
40 | - bool $secure = false, |
|
41 | - bool $httponly = false, |
|
42 | - int $samesite = self::SAMESITE_NONE) { |
|
43 | - $header = sprintf( |
|
44 | - 'Set-Cookie: %s=%s', |
|
45 | - $name, |
|
46 | - rawurlencode($value) |
|
47 | - ); |
|
35 | + public static function setCookie(string $name, |
|
36 | + string $value = '', |
|
37 | + int $maxAge = 0, |
|
38 | + string $path = '', |
|
39 | + string $domain = '', |
|
40 | + bool $secure = false, |
|
41 | + bool $httponly = false, |
|
42 | + int $samesite = self::SAMESITE_NONE) { |
|
43 | + $header = sprintf( |
|
44 | + 'Set-Cookie: %s=%s', |
|
45 | + $name, |
|
46 | + rawurlencode($value) |
|
47 | + ); |
|
48 | 48 | |
49 | - if ($path !== '') { |
|
50 | - $header .= sprintf('; Path=%s', $path); |
|
51 | - } |
|
49 | + if ($path !== '') { |
|
50 | + $header .= sprintf('; Path=%s', $path); |
|
51 | + } |
|
52 | 52 | |
53 | - if ($domain !== '') { |
|
54 | - $header .= sprintf('; Domain=%s', $domain); |
|
55 | - } |
|
53 | + if ($domain !== '') { |
|
54 | + $header .= sprintf('; Domain=%s', $domain); |
|
55 | + } |
|
56 | 56 | |
57 | - if ($maxAge > 0) { |
|
58 | - $header .= sprintf('; Max-Age=%d', $maxAge); |
|
59 | - } |
|
57 | + if ($maxAge > 0) { |
|
58 | + $header .= sprintf('; Max-Age=%d', $maxAge); |
|
59 | + } |
|
60 | 60 | |
61 | - if ($secure) { |
|
62 | - $header .= '; Secure'; |
|
63 | - } |
|
61 | + if ($secure) { |
|
62 | + $header .= '; Secure'; |
|
63 | + } |
|
64 | 64 | |
65 | - if ($httponly) { |
|
66 | - $header .= '; HttpOnly'; |
|
67 | - } |
|
65 | + if ($httponly) { |
|
66 | + $header .= '; HttpOnly'; |
|
67 | + } |
|
68 | 68 | |
69 | - if ($samesite === self::SAMESITE_LAX) { |
|
70 | - $header .= '; SameSite=Lax'; |
|
71 | - } elseif ($samesite === self::SAMESITE_STRICT) { |
|
72 | - $header .= '; SameSite=Strict'; |
|
73 | - } |
|
69 | + if ($samesite === self::SAMESITE_LAX) { |
|
70 | + $header .= '; SameSite=Lax'; |
|
71 | + } elseif ($samesite === self::SAMESITE_STRICT) { |
|
72 | + $header .= '; SameSite=Strict'; |
|
73 | + } |
|
74 | 74 | |
75 | - header($header, false); |
|
76 | - } |
|
75 | + header($header, false); |
|
76 | + } |
|
77 | 77 | } |
@@ -47,131 +47,131 @@ |
||
47 | 47 | use function substr; |
48 | 48 | |
49 | 49 | class CalendarContactInteractionListener implements IEventListener { |
50 | - private const URI_USERS = 'principals/users/'; |
|
51 | - |
|
52 | - /** @var IEventDispatcher */ |
|
53 | - private $dispatcher; |
|
54 | - |
|
55 | - /** @var IUserSession */ |
|
56 | - private $userSession; |
|
57 | - |
|
58 | - /** @var Principal */ |
|
59 | - private $principalConnector; |
|
60 | - |
|
61 | - /** @var IMailer */ |
|
62 | - private $mailer; |
|
63 | - |
|
64 | - /** @var LoggerInterface */ |
|
65 | - private $logger; |
|
66 | - |
|
67 | - public function __construct(IEventDispatcher $dispatcher, |
|
68 | - IUserSession $userSession, |
|
69 | - Principal $principalConnector, |
|
70 | - IMailer $mailer, |
|
71 | - LoggerInterface $logger) { |
|
72 | - $this->dispatcher = $dispatcher; |
|
73 | - $this->userSession = $userSession; |
|
74 | - $this->principalConnector = $principalConnector; |
|
75 | - $this->mailer = $mailer; |
|
76 | - $this->logger = $logger; |
|
77 | - } |
|
78 | - |
|
79 | - public function handle(Event $event): void { |
|
80 | - if (($user = $this->userSession->getUser()) === null) { |
|
81 | - // Without user context we can't do anything |
|
82 | - return; |
|
83 | - } |
|
84 | - |
|
85 | - if ($event instanceof CalendarObjectCreatedEvent || $event instanceof CalendarObjectUpdatedEvent) { |
|
86 | - // users: href => principal:principals/users/admin |
|
87 | - foreach ($event->getShares() as $share) { |
|
88 | - if (!isset($share['href'])) { |
|
89 | - continue; |
|
90 | - } |
|
91 | - $this->emitFromUri($share['href'], $user); |
|
92 | - } |
|
93 | - |
|
94 | - // emit interaction for email attendees as well |
|
95 | - if (isset($event->getObjectData()['calendardata'])) { |
|
96 | - try { |
|
97 | - $calendar = Reader::read($event->getObjectData()['calendardata']); |
|
98 | - if ($calendar->VEVENT) { |
|
99 | - foreach ($calendar->VEVENT as $calendarEvent) { |
|
100 | - $this->emitFromObject($calendarEvent, $user); |
|
101 | - } |
|
102 | - } |
|
103 | - } catch (Throwable $e) { |
|
104 | - $this->logger->warning('Could not read calendar data for interaction events: ' . $e->getMessage(), [ |
|
105 | - 'exception' => $e, |
|
106 | - ]); |
|
107 | - } |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - if ($event instanceof CalendarShareUpdatedEvent && !empty($event->getAdded())) { |
|
112 | - // group: href => principal:principals/groups/admin |
|
113 | - // users: href => principal:principals/users/admin |
|
114 | - foreach ($event->getAdded() as $added) { |
|
115 | - if (!isset($added['href'])) { |
|
116 | - // Nothing to work with |
|
117 | - continue; |
|
118 | - } |
|
119 | - $this->emitFromUri($added['href'], $user); |
|
120 | - } |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - private function emitFromUri(string $uri, IUser $user): void { |
|
125 | - $principal = $this->principalConnector->findByUri( |
|
126 | - $uri, |
|
127 | - $this->principalConnector->getPrincipalPrefix() |
|
128 | - ); |
|
129 | - if ($principal === null) { |
|
130 | - // Invalid principal |
|
131 | - return; |
|
132 | - } |
|
133 | - if (strpos($principal, self::URI_USERS) !== 0) { |
|
134 | - // Not a user principal |
|
135 | - return; |
|
136 | - } |
|
137 | - |
|
138 | - $uid = substr($principal, strlen(self::URI_USERS)); |
|
139 | - $this->dispatcher->dispatchTyped( |
|
140 | - (new ContactInteractedWithEvent($user))->setUid($uid) |
|
141 | - ); |
|
142 | - } |
|
143 | - |
|
144 | - private function emitFromObject(VEvent $vevent, IUser $user): void { |
|
145 | - if (!$vevent->ATTENDEE) { |
|
146 | - // Nothing left to do |
|
147 | - return; |
|
148 | - } |
|
149 | - |
|
150 | - foreach ($vevent->ATTENDEE as $attendee) { |
|
151 | - if (!($attendee instanceof Property)) { |
|
152 | - continue; |
|
153 | - } |
|
154 | - |
|
155 | - $cuType = $attendee->offsetGet('CUTYPE'); |
|
156 | - if ($cuType instanceof Parameter && $cuType->getValue() !== 'INDIVIDUAL') { |
|
157 | - // Don't care about those |
|
158 | - continue; |
|
159 | - } |
|
160 | - |
|
161 | - $mailTo = $attendee->getValue(); |
|
162 | - if (strpos($mailTo, 'mailto:') !== 0) { |
|
163 | - // Doesn't look like an email |
|
164 | - continue; |
|
165 | - } |
|
166 | - $email = substr($mailTo, strlen('mailto:')); |
|
167 | - if (!$this->mailer->validateMailAddress($email)) { |
|
168 | - // This really isn't a valid email |
|
169 | - continue; |
|
170 | - } |
|
171 | - |
|
172 | - $this->dispatcher->dispatchTyped( |
|
173 | - (new ContactInteractedWithEvent($user))->setEmail($email) |
|
174 | - ); |
|
175 | - } |
|
176 | - } |
|
50 | + private const URI_USERS = 'principals/users/'; |
|
51 | + |
|
52 | + /** @var IEventDispatcher */ |
|
53 | + private $dispatcher; |
|
54 | + |
|
55 | + /** @var IUserSession */ |
|
56 | + private $userSession; |
|
57 | + |
|
58 | + /** @var Principal */ |
|
59 | + private $principalConnector; |
|
60 | + |
|
61 | + /** @var IMailer */ |
|
62 | + private $mailer; |
|
63 | + |
|
64 | + /** @var LoggerInterface */ |
|
65 | + private $logger; |
|
66 | + |
|
67 | + public function __construct(IEventDispatcher $dispatcher, |
|
68 | + IUserSession $userSession, |
|
69 | + Principal $principalConnector, |
|
70 | + IMailer $mailer, |
|
71 | + LoggerInterface $logger) { |
|
72 | + $this->dispatcher = $dispatcher; |
|
73 | + $this->userSession = $userSession; |
|
74 | + $this->principalConnector = $principalConnector; |
|
75 | + $this->mailer = $mailer; |
|
76 | + $this->logger = $logger; |
|
77 | + } |
|
78 | + |
|
79 | + public function handle(Event $event): void { |
|
80 | + if (($user = $this->userSession->getUser()) === null) { |
|
81 | + // Without user context we can't do anything |
|
82 | + return; |
|
83 | + } |
|
84 | + |
|
85 | + if ($event instanceof CalendarObjectCreatedEvent || $event instanceof CalendarObjectUpdatedEvent) { |
|
86 | + // users: href => principal:principals/users/admin |
|
87 | + foreach ($event->getShares() as $share) { |
|
88 | + if (!isset($share['href'])) { |
|
89 | + continue; |
|
90 | + } |
|
91 | + $this->emitFromUri($share['href'], $user); |
|
92 | + } |
|
93 | + |
|
94 | + // emit interaction for email attendees as well |
|
95 | + if (isset($event->getObjectData()['calendardata'])) { |
|
96 | + try { |
|
97 | + $calendar = Reader::read($event->getObjectData()['calendardata']); |
|
98 | + if ($calendar->VEVENT) { |
|
99 | + foreach ($calendar->VEVENT as $calendarEvent) { |
|
100 | + $this->emitFromObject($calendarEvent, $user); |
|
101 | + } |
|
102 | + } |
|
103 | + } catch (Throwable $e) { |
|
104 | + $this->logger->warning('Could not read calendar data for interaction events: ' . $e->getMessage(), [ |
|
105 | + 'exception' => $e, |
|
106 | + ]); |
|
107 | + } |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + if ($event instanceof CalendarShareUpdatedEvent && !empty($event->getAdded())) { |
|
112 | + // group: href => principal:principals/groups/admin |
|
113 | + // users: href => principal:principals/users/admin |
|
114 | + foreach ($event->getAdded() as $added) { |
|
115 | + if (!isset($added['href'])) { |
|
116 | + // Nothing to work with |
|
117 | + continue; |
|
118 | + } |
|
119 | + $this->emitFromUri($added['href'], $user); |
|
120 | + } |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + private function emitFromUri(string $uri, IUser $user): void { |
|
125 | + $principal = $this->principalConnector->findByUri( |
|
126 | + $uri, |
|
127 | + $this->principalConnector->getPrincipalPrefix() |
|
128 | + ); |
|
129 | + if ($principal === null) { |
|
130 | + // Invalid principal |
|
131 | + return; |
|
132 | + } |
|
133 | + if (strpos($principal, self::URI_USERS) !== 0) { |
|
134 | + // Not a user principal |
|
135 | + return; |
|
136 | + } |
|
137 | + |
|
138 | + $uid = substr($principal, strlen(self::URI_USERS)); |
|
139 | + $this->dispatcher->dispatchTyped( |
|
140 | + (new ContactInteractedWithEvent($user))->setUid($uid) |
|
141 | + ); |
|
142 | + } |
|
143 | + |
|
144 | + private function emitFromObject(VEvent $vevent, IUser $user): void { |
|
145 | + if (!$vevent->ATTENDEE) { |
|
146 | + // Nothing left to do |
|
147 | + return; |
|
148 | + } |
|
149 | + |
|
150 | + foreach ($vevent->ATTENDEE as $attendee) { |
|
151 | + if (!($attendee instanceof Property)) { |
|
152 | + continue; |
|
153 | + } |
|
154 | + |
|
155 | + $cuType = $attendee->offsetGet('CUTYPE'); |
|
156 | + if ($cuType instanceof Parameter && $cuType->getValue() !== 'INDIVIDUAL') { |
|
157 | + // Don't care about those |
|
158 | + continue; |
|
159 | + } |
|
160 | + |
|
161 | + $mailTo = $attendee->getValue(); |
|
162 | + if (strpos($mailTo, 'mailto:') !== 0) { |
|
163 | + // Doesn't look like an email |
|
164 | + continue; |
|
165 | + } |
|
166 | + $email = substr($mailTo, strlen('mailto:')); |
|
167 | + if (!$this->mailer->validateMailAddress($email)) { |
|
168 | + // This really isn't a valid email |
|
169 | + continue; |
|
170 | + } |
|
171 | + |
|
172 | + $this->dispatcher->dispatchTyped( |
|
173 | + (new ContactInteractedWithEvent($user))->setEmail($email) |
|
174 | + ); |
|
175 | + } |
|
176 | + } |
|
177 | 177 | } |
@@ -32,73 +32,73 @@ |
||
32 | 32 | * @since 9.0.0 |
33 | 33 | */ |
34 | 34 | class ManagerEvent extends Event { |
35 | - /** |
|
36 | - * @deprecated 22.0.0 |
|
37 | - */ |
|
38 | - public const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp'; |
|
35 | + /** |
|
36 | + * @deprecated 22.0.0 |
|
37 | + */ |
|
38 | + public const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @deprecated 22.0.0 |
|
42 | - */ |
|
43 | - public const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups'; |
|
40 | + /** |
|
41 | + * @deprecated 22.0.0 |
|
42 | + */ |
|
43 | + public const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @deprecated 22.0.0 |
|
47 | - */ |
|
48 | - public const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp'; |
|
45 | + /** |
|
46 | + * @deprecated 22.0.0 |
|
47 | + */ |
|
48 | + public const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp'; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @since 9.1.0 |
|
52 | - * @deprecated 22.0.0 |
|
53 | - */ |
|
54 | - public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp'; |
|
50 | + /** |
|
51 | + * @since 9.1.0 |
|
52 | + * @deprecated 22.0.0 |
|
53 | + */ |
|
54 | + public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp'; |
|
55 | 55 | |
56 | - /** @var string */ |
|
57 | - protected $event; |
|
58 | - /** @var string */ |
|
59 | - protected $appID; |
|
60 | - /** @var \OCP\IGroup[]|null */ |
|
61 | - protected $groups; |
|
56 | + /** @var string */ |
|
57 | + protected $event; |
|
58 | + /** @var string */ |
|
59 | + protected $appID; |
|
60 | + /** @var \OCP\IGroup[]|null */ |
|
61 | + protected $groups; |
|
62 | 62 | |
63 | - /** |
|
64 | - * DispatcherEvent constructor. |
|
65 | - * |
|
66 | - * @param string $event |
|
67 | - * @param $appID |
|
68 | - * @param \OCP\IGroup[]|null $groups |
|
69 | - * @since 9.0.0 |
|
70 | - */ |
|
71 | - public function __construct($event, $appID, array $groups = null) { |
|
72 | - $this->event = $event; |
|
73 | - $this->appID = $appID; |
|
74 | - $this->groups = $groups; |
|
75 | - } |
|
63 | + /** |
|
64 | + * DispatcherEvent constructor. |
|
65 | + * |
|
66 | + * @param string $event |
|
67 | + * @param $appID |
|
68 | + * @param \OCP\IGroup[]|null $groups |
|
69 | + * @since 9.0.0 |
|
70 | + */ |
|
71 | + public function __construct($event, $appID, array $groups = null) { |
|
72 | + $this->event = $event; |
|
73 | + $this->appID = $appID; |
|
74 | + $this->groups = $groups; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return string |
|
79 | - * @since 9.0.0 |
|
80 | - */ |
|
81 | - public function getEvent() { |
|
82 | - return $this->event; |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return string |
|
79 | + * @since 9.0.0 |
|
80 | + */ |
|
81 | + public function getEvent() { |
|
82 | + return $this->event; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return string |
|
87 | - * @since 9.0.0 |
|
88 | - */ |
|
89 | - public function getAppID() { |
|
90 | - return $this->appID; |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return string |
|
87 | + * @since 9.0.0 |
|
88 | + */ |
|
89 | + public function getAppID() { |
|
90 | + return $this->appID; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * returns the group Ids |
|
95 | - * @return string[] |
|
96 | - * @since 9.0.0 |
|
97 | - */ |
|
98 | - public function getGroups() { |
|
99 | - return array_map(function ($group) { |
|
100 | - /** @var \OCP\IGroup $group */ |
|
101 | - return $group->getGID(); |
|
102 | - }, $this->groups); |
|
103 | - } |
|
93 | + /** |
|
94 | + * returns the group Ids |
|
95 | + * @return string[] |
|
96 | + * @since 9.0.0 |
|
97 | + */ |
|
98 | + public function getGroups() { |
|
99 | + return array_map(function ($group) { |
|
100 | + /** @var \OCP\IGroup $group */ |
|
101 | + return $group->getGID(); |
|
102 | + }, $this->groups); |
|
103 | + } |
|
104 | 104 | } |
@@ -32,60 +32,60 @@ |
||
32 | 32 | * @since 9.1 |
33 | 33 | */ |
34 | 34 | interface IManager { |
35 | - public const SCOPE_ADMIN = 0; |
|
36 | - public const SCOPE_USER = 1; |
|
35 | + public const SCOPE_ADMIN = 0; |
|
36 | + public const SCOPE_USER = 1; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @since 21.0.0 |
|
40 | - */ |
|
41 | - public const MAX_CHECK_VALUE_BYTES = 2048; |
|
38 | + /** |
|
39 | + * @since 21.0.0 |
|
40 | + */ |
|
41 | + public const MAX_CHECK_VALUE_BYTES = 2048; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @since 21.0.0 |
|
45 | - */ |
|
46 | - public const MAX_OPERATION_VALUE_BYTES = 4096; |
|
43 | + /** |
|
44 | + * @since 21.0.0 |
|
45 | + */ |
|
46 | + public const MAX_OPERATION_VALUE_BYTES = 4096; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @deprecated 17.0.0 Will be removed in NC19. Use the dedicated events in OCP\WorkflowEngine\Events |
|
50 | - */ |
|
51 | - public const EVENT_NAME_REG_OPERATION = 'OCP\WorkflowEngine::registerOperations'; |
|
48 | + /** |
|
49 | + * @deprecated 17.0.0 Will be removed in NC19. Use the dedicated events in OCP\WorkflowEngine\Events |
|
50 | + */ |
|
51 | + public const EVENT_NAME_REG_OPERATION = 'OCP\WorkflowEngine::registerOperations'; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @deprecated 17.0.0 |
|
55 | - */ |
|
56 | - public const EVENT_NAME_REG_ENTITY = 'OCP\WorkflowEngine::registerEntities'; |
|
53 | + /** |
|
54 | + * @deprecated 17.0.0 |
|
55 | + */ |
|
56 | + public const EVENT_NAME_REG_ENTITY = 'OCP\WorkflowEngine::registerEntities'; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @deprecated 17.0.0 |
|
60 | - */ |
|
61 | - public const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks'; |
|
58 | + /** |
|
59 | + * @deprecated 17.0.0 |
|
60 | + */ |
|
61 | + public const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks'; |
|
62 | 62 | |
63 | - /** |
|
64 | - * Listen to `OCP\WorkflowEngine\Events\RegisterEntitiesEvent` at the |
|
65 | - * IEventDispatcher for registering your entities. |
|
66 | - * |
|
67 | - * @since 18.0.0 |
|
68 | - */ |
|
69 | - public function registerEntity(IEntity $entity): void; |
|
63 | + /** |
|
64 | + * Listen to `OCP\WorkflowEngine\Events\RegisterEntitiesEvent` at the |
|
65 | + * IEventDispatcher for registering your entities. |
|
66 | + * |
|
67 | + * @since 18.0.0 |
|
68 | + */ |
|
69 | + public function registerEntity(IEntity $entity): void; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Listen to `OCP\WorkflowEngine\Events\RegisterOperationsEvent` at the |
|
73 | - * IEventDispatcher for registering your operators. |
|
74 | - * |
|
75 | - * @since 18.0.0 |
|
76 | - */ |
|
77 | - public function registerOperation(IOperation $operator): void; |
|
71 | + /** |
|
72 | + * Listen to `OCP\WorkflowEngine\Events\RegisterOperationsEvent` at the |
|
73 | + * IEventDispatcher for registering your operators. |
|
74 | + * |
|
75 | + * @since 18.0.0 |
|
76 | + */ |
|
77 | + public function registerOperation(IOperation $operator): void; |
|
78 | 78 | |
79 | - /** |
|
80 | - * Listen to `OCP\WorkflowEngine\Events\RegisterChecksEvent` at the |
|
81 | - * IEventDispatcher for registering your operators. |
|
82 | - * |
|
83 | - * @since 18.0.0 |
|
84 | - */ |
|
85 | - public function registerCheck(ICheck $check): void; |
|
79 | + /** |
|
80 | + * Listen to `OCP\WorkflowEngine\Events\RegisterChecksEvent` at the |
|
81 | + * IEventDispatcher for registering your operators. |
|
82 | + * |
|
83 | + * @since 18.0.0 |
|
84 | + */ |
|
85 | + public function registerCheck(ICheck $check): void; |
|
86 | 86 | |
87 | - /** |
|
88 | - * @since 18.0.0 |
|
89 | - */ |
|
90 | - public function getRuleMatcher(): IRuleMatcher; |
|
87 | + /** |
|
88 | + * @since 18.0.0 |
|
89 | + */ |
|
90 | + public function getRuleMatcher(): IRuleMatcher; |
|
91 | 91 | } |
@@ -32,49 +32,49 @@ |
||
32 | 32 | * @since 9.1.0 |
33 | 33 | */ |
34 | 34 | class CommentsEntityEvent extends Event { |
35 | - /** |
|
36 | - * @deprecated 22.0.0 |
|
37 | - */ |
|
38 | - public const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; |
|
35 | + /** |
|
36 | + * @deprecated 22.0.0 |
|
37 | + */ |
|
38 | + public const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; |
|
39 | 39 | |
40 | - /** @var string */ |
|
41 | - protected $event; |
|
42 | - /** @var \Closure[] */ |
|
43 | - protected $collections; |
|
40 | + /** @var string */ |
|
41 | + protected $event; |
|
42 | + /** @var \Closure[] */ |
|
43 | + protected $collections; |
|
44 | 44 | |
45 | - /** |
|
46 | - * DispatcherEvent constructor. |
|
47 | - * |
|
48 | - * @param string $event |
|
49 | - * @since 9.1.0 |
|
50 | - */ |
|
51 | - public function __construct($event) { |
|
52 | - $this->event = $event; |
|
53 | - $this->collections = []; |
|
54 | - } |
|
45 | + /** |
|
46 | + * DispatcherEvent constructor. |
|
47 | + * |
|
48 | + * @param string $event |
|
49 | + * @since 9.1.0 |
|
50 | + */ |
|
51 | + public function __construct($event) { |
|
52 | + $this->event = $event; |
|
53 | + $this->collections = []; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param string $name |
|
58 | - * @param \Closure $entityExistsFunction The closure should take one |
|
59 | - * argument, which is the id of the entity, that comments |
|
60 | - * should be handled for. The return should then be bool, |
|
61 | - * depending on whether comments are allowed (true) or not. |
|
62 | - * @throws \OutOfBoundsException when the entity name is already taken |
|
63 | - * @since 9.1.0 |
|
64 | - */ |
|
65 | - public function addEntityCollection($name, \Closure $entityExistsFunction) { |
|
66 | - if (isset($this->collections[$name])) { |
|
67 | - throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
68 | - } |
|
56 | + /** |
|
57 | + * @param string $name |
|
58 | + * @param \Closure $entityExistsFunction The closure should take one |
|
59 | + * argument, which is the id of the entity, that comments |
|
60 | + * should be handled for. The return should then be bool, |
|
61 | + * depending on whether comments are allowed (true) or not. |
|
62 | + * @throws \OutOfBoundsException when the entity name is already taken |
|
63 | + * @since 9.1.0 |
|
64 | + */ |
|
65 | + public function addEntityCollection($name, \Closure $entityExistsFunction) { |
|
66 | + if (isset($this->collections[$name])) { |
|
67 | + throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); |
|
68 | + } |
|
69 | 69 | |
70 | - $this->collections[$name] = $entityExistsFunction; |
|
71 | - } |
|
70 | + $this->collections[$name] = $entityExistsFunction; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return \Closure[] |
|
75 | - * @since 9.1.0 |
|
76 | - */ |
|
77 | - public function getEntityCollections() { |
|
78 | - return $this->collections; |
|
79 | - } |
|
73 | + /** |
|
74 | + * @return \Closure[] |
|
75 | + * @since 9.1.0 |
|
76 | + */ |
|
77 | + public function getEntityCollections() { |
|
78 | + return $this->collections; |
|
79 | + } |
|
80 | 80 | } |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | $files_list = json_decode($files); |
39 | 39 | // in case we get only a single file |
40 | 40 | if (!is_array($files_list)) { |
41 | - $files_list = [$files]; |
|
41 | + $files_list = [$files]; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @psalm-taint-escape cookie |
46 | 46 | */ |
47 | 47 | function cleanCookieInput(string $value): string { |
48 | - if (strlen($value) > 32) { |
|
49 | - return ''; |
|
50 | - } |
|
51 | - if (preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) !== 1) { |
|
52 | - return ''; |
|
53 | - } |
|
54 | - return $value; |
|
48 | + if (strlen($value) > 32) { |
|
49 | + return ''; |
|
50 | + } |
|
51 | + if (preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) !== 1) { |
|
52 | + return ''; |
|
53 | + } |
|
54 | + return $value; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * alphanumeric characters |
61 | 61 | */ |
62 | 62 | if (isset($_GET['downloadStartSecret'])) { |
63 | - $value = cleanCookieInput($_GET['downloadStartSecret']); |
|
64 | - if ($value !== '') { |
|
65 | - setcookie('ocDownloadStarted', $value, time() + 20, '/'); |
|
66 | - } |
|
63 | + $value = cleanCookieInput($_GET['downloadStartSecret']); |
|
64 | + if ($value !== '') { |
|
65 | + setcookie('ocDownloadStarted', $value, time() + 20, '/'); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * Http range requests support |
73 | 73 | */ |
74 | 74 | if (isset($_SERVER['HTTP_RANGE'])) { |
75 | - $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
75 | + $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | OC_Files::get($dir, $files_list, $server_params); |
@@ -30,24 +30,24 @@ |
||
30 | 30 | * @template T |
31 | 31 | */ |
32 | 32 | class ServiceRegistration extends ARegistration { |
33 | - /** |
|
34 | - * @var string |
|
35 | - * @psalm-var class-string<T> |
|
36 | - */ |
|
37 | - private $service; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + * @psalm-var class-string<T> |
|
36 | + */ |
|
37 | + private $service; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @psalm-param class-string<T> $service |
|
41 | - */ |
|
42 | - public function __construct(string $appId, string $service) { |
|
43 | - parent::__construct($appId); |
|
44 | - $this->service = $service; |
|
45 | - } |
|
39 | + /** |
|
40 | + * @psalm-param class-string<T> $service |
|
41 | + */ |
|
42 | + public function __construct(string $appId, string $service) { |
|
43 | + parent::__construct($appId); |
|
44 | + $this->service = $service; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @psalm-return class-string<T> |
|
49 | - */ |
|
50 | - public function getService(): string { |
|
51 | - return $this->service; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @psalm-return class-string<T> |
|
49 | + */ |
|
50 | + public function getService(): string { |
|
51 | + return $this->service; |
|
52 | + } |
|
53 | 53 | } |