@@ -32,68 +32,68 @@ |
||
32 | 32 | */ |
33 | 33 | interface ISubAdmin { |
34 | 34 | |
35 | - /** |
|
36 | - * add a SubAdmin |
|
37 | - * @param IUser $user user to be SubAdmin |
|
38 | - * @param IGroup $group group $user becomes subadmin of |
|
39 | - * |
|
40 | - * @since 16.0.0 |
|
41 | - */ |
|
42 | - public function createSubAdmin(IUser $user, IGroup $group): void; |
|
35 | + /** |
|
36 | + * add a SubAdmin |
|
37 | + * @param IUser $user user to be SubAdmin |
|
38 | + * @param IGroup $group group $user becomes subadmin of |
|
39 | + * |
|
40 | + * @since 16.0.0 |
|
41 | + */ |
|
42 | + public function createSubAdmin(IUser $user, IGroup $group): void; |
|
43 | 43 | |
44 | - /** |
|
45 | - * delete a SubAdmin |
|
46 | - * @param IUser $user the user that is the SubAdmin |
|
47 | - * @param IGroup $group the group |
|
48 | - * |
|
49 | - * @since 16.0.0 |
|
50 | - */ |
|
51 | - public function deleteSubAdmin(IUser $user, IGroup $group): void; |
|
44 | + /** |
|
45 | + * delete a SubAdmin |
|
46 | + * @param IUser $user the user that is the SubAdmin |
|
47 | + * @param IGroup $group the group |
|
48 | + * |
|
49 | + * @since 16.0.0 |
|
50 | + */ |
|
51 | + public function deleteSubAdmin(IUser $user, IGroup $group): void; |
|
52 | 52 | |
53 | - /** |
|
54 | - * get groups of a SubAdmin |
|
55 | - * @param IUser $user the SubAdmin |
|
56 | - * @return IGroup[] |
|
57 | - * |
|
58 | - * @since 16.0.0 |
|
59 | - */ |
|
60 | - public function getSubAdminsGroups(IUser $user): array; |
|
53 | + /** |
|
54 | + * get groups of a SubAdmin |
|
55 | + * @param IUser $user the SubAdmin |
|
56 | + * @return IGroup[] |
|
57 | + * |
|
58 | + * @since 16.0.0 |
|
59 | + */ |
|
60 | + public function getSubAdminsGroups(IUser $user): array; |
|
61 | 61 | |
62 | - /** |
|
63 | - * get SubAdmins of a group |
|
64 | - * @param IGroup $group the group |
|
65 | - * @return IUser[] |
|
66 | - * |
|
67 | - * @since 16.0.0 |
|
68 | - */ |
|
69 | - public function getGroupsSubAdmins(IGroup $group): array; |
|
62 | + /** |
|
63 | + * get SubAdmins of a group |
|
64 | + * @param IGroup $group the group |
|
65 | + * @return IUser[] |
|
66 | + * |
|
67 | + * @since 16.0.0 |
|
68 | + */ |
|
69 | + public function getGroupsSubAdmins(IGroup $group): array; |
|
70 | 70 | |
71 | - /** |
|
72 | - * checks if a user is a SubAdmin of a group |
|
73 | - * @param IUser $user |
|
74 | - * @param IGroup $group |
|
75 | - * @return bool |
|
76 | - * |
|
77 | - * @since 16.0.0 |
|
78 | - */ |
|
79 | - public function isSubAdminOfGroup(IUser $user, IGroup $group): bool; |
|
71 | + /** |
|
72 | + * checks if a user is a SubAdmin of a group |
|
73 | + * @param IUser $user |
|
74 | + * @param IGroup $group |
|
75 | + * @return bool |
|
76 | + * |
|
77 | + * @since 16.0.0 |
|
78 | + */ |
|
79 | + public function isSubAdminOfGroup(IUser $user, IGroup $group): bool; |
|
80 | 80 | |
81 | - /** |
|
82 | - * checks if a user is a SubAdmin |
|
83 | - * @param IUser $user |
|
84 | - * @return bool |
|
85 | - * |
|
86 | - * @since 16.0.0 |
|
87 | - */ |
|
88 | - public function isSubAdmin(IUser $user): bool; |
|
81 | + /** |
|
82 | + * checks if a user is a SubAdmin |
|
83 | + * @param IUser $user |
|
84 | + * @return bool |
|
85 | + * |
|
86 | + * @since 16.0.0 |
|
87 | + */ |
|
88 | + public function isSubAdmin(IUser $user): bool; |
|
89 | 89 | |
90 | - /** |
|
91 | - * checks if a user is a accessible by a subadmin |
|
92 | - * @param IUser $subadmin |
|
93 | - * @param IUser $user |
|
94 | - * @return bool |
|
95 | - * |
|
96 | - * @since 16.0.0 |
|
97 | - */ |
|
98 | - public function isUserAccessible(IUser $subadmin, IUser $user): bool; |
|
90 | + /** |
|
91 | + * checks if a user is a accessible by a subadmin |
|
92 | + * @param IUser $subadmin |
|
93 | + * @param IUser $user |
|
94 | + * @return bool |
|
95 | + * |
|
96 | + * @since 16.0.0 |
|
97 | + */ |
|
98 | + public function isUserAccessible(IUser $subadmin, IUser $user): bool; |
|
99 | 99 | } |
@@ -28,8 +28,8 @@ |
||
28 | 28 | use OCP\Template; |
29 | 29 | |
30 | 30 | class Personal implements IPersonalProviderSettings { |
31 | - public function getBody(): Template { |
|
32 | - return new Template('twofactor_backupcodes', 'personal'); |
|
33 | - } |
|
31 | + public function getBody(): Template { |
|
32 | + return new Template('twofactor_backupcodes', 'personal'); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | } |
@@ -35,34 +35,34 @@ |
||
35 | 35 | * a reload but if the session variable is set we properly redirect to the login page. |
36 | 36 | */ |
37 | 37 | class ReloadExecutionMiddleware extends Middleware { |
38 | - /** @var ISession */ |
|
39 | - private $session; |
|
40 | - /** @var IURLGenerator */ |
|
41 | - private $urlGenerator; |
|
38 | + /** @var ISession */ |
|
39 | + private $session; |
|
40 | + /** @var IURLGenerator */ |
|
41 | + private $urlGenerator; |
|
42 | 42 | |
43 | - public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | - $this->session = $session; |
|
45 | - $this->urlGenerator = $urlGenerator; |
|
46 | - } |
|
43 | + public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | + $this->session = $session; |
|
45 | + $this->urlGenerator = $urlGenerator; |
|
46 | + } |
|
47 | 47 | |
48 | - public function beforeController($controller, $methodName) { |
|
49 | - if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | - throw new ReloadExecutionException(); |
|
51 | - } |
|
52 | - } |
|
48 | + public function beforeController($controller, $methodName) { |
|
49 | + if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | + throw new ReloadExecutionException(); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | - if ($exception instanceof ReloadExecutionException) { |
|
56 | - $this->session->remove('clearingExecutionContexts'); |
|
54 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | + if ($exception instanceof ReloadExecutionException) { |
|
56 | + $this->session->remove('clearingExecutionContexts'); |
|
57 | 57 | |
58 | - return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | - 'core.login.showLoginForm', |
|
60 | - ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | - )); |
|
62 | - } |
|
58 | + return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | + 'core.login.showLoginForm', |
|
60 | + ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | + )); |
|
62 | + } |
|
63 | 63 | |
64 | - return parent::afterException($controller, $methodName, $exception); |
|
65 | - } |
|
64 | + return parent::afterException($controller, $methodName, $exception); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | } |
@@ -32,119 +32,119 @@ |
||
32 | 32 | * @since 16.0.0 |
33 | 33 | */ |
34 | 34 | class InMemoryFile implements ISimpleFile { |
35 | - /** |
|
36 | - * Holds the file name. |
|
37 | - * |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - private $name; |
|
41 | - |
|
42 | - /** |
|
43 | - * Holds the file contents. |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private $contents; |
|
48 | - |
|
49 | - /** |
|
50 | - * InMemoryFile constructor. |
|
51 | - * |
|
52 | - * @param string $name The file name |
|
53 | - * @param string $contents The file contents |
|
54 | - * @since 16.0.0 |
|
55 | - */ |
|
56 | - public function __construct(string $name, string $contents) { |
|
57 | - $this->name = $name; |
|
58 | - $this->contents = $contents; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @inheritdoc |
|
63 | - * @since 16.0.0 |
|
64 | - */ |
|
65 | - public function getName() { |
|
66 | - return $this->name; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @inheritdoc |
|
71 | - * @since 16.0.0 |
|
72 | - */ |
|
73 | - public function getSize() { |
|
74 | - return strlen($this->contents); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * @inheritdoc |
|
79 | - * @since 16.0.0 |
|
80 | - */ |
|
81 | - public function getETag() { |
|
82 | - return ''; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @inheritdoc |
|
87 | - * @since 16.0.0 |
|
88 | - */ |
|
89 | - public function getMTime() { |
|
90 | - return time(); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @inheritdoc |
|
95 | - * @since 16.0.0 |
|
96 | - */ |
|
97 | - public function getContent() { |
|
98 | - return $this->contents; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @inheritdoc |
|
103 | - * @since 16.0.0 |
|
104 | - */ |
|
105 | - public function putContent($data) { |
|
106 | - $this->contents = $data; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * In memory files can't be deleted. |
|
111 | - * |
|
112 | - * @since 16.0.0 |
|
113 | - */ |
|
114 | - public function delete() { |
|
115 | - // unimplemented for in memory files |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @inheritdoc |
|
120 | - * @since 16.0.0 |
|
121 | - */ |
|
122 | - public function getMimeType() { |
|
123 | - $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
124 | - return $fileInfo->buffer($this->contents); |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Stream reading is unsupported for in memory files. |
|
129 | - * |
|
130 | - * @throws NotPermittedException |
|
131 | - * @since 16.0.0 |
|
132 | - */ |
|
133 | - public function read() { |
|
134 | - throw new NotPermittedException( |
|
135 | - 'Stream reading is unsupported for in memory files' |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Stream writing isn't available for in memory files. |
|
141 | - * |
|
142 | - * @throws NotPermittedException |
|
143 | - * @since 16.0.0 |
|
144 | - */ |
|
145 | - public function write() { |
|
146 | - throw new NotPermittedException( |
|
147 | - 'Stream writing is unsupported for in memory files' |
|
148 | - ); |
|
149 | - } |
|
35 | + /** |
|
36 | + * Holds the file name. |
|
37 | + * |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + private $name; |
|
41 | + |
|
42 | + /** |
|
43 | + * Holds the file contents. |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private $contents; |
|
48 | + |
|
49 | + /** |
|
50 | + * InMemoryFile constructor. |
|
51 | + * |
|
52 | + * @param string $name The file name |
|
53 | + * @param string $contents The file contents |
|
54 | + * @since 16.0.0 |
|
55 | + */ |
|
56 | + public function __construct(string $name, string $contents) { |
|
57 | + $this->name = $name; |
|
58 | + $this->contents = $contents; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @inheritdoc |
|
63 | + * @since 16.0.0 |
|
64 | + */ |
|
65 | + public function getName() { |
|
66 | + return $this->name; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @inheritdoc |
|
71 | + * @since 16.0.0 |
|
72 | + */ |
|
73 | + public function getSize() { |
|
74 | + return strlen($this->contents); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * @inheritdoc |
|
79 | + * @since 16.0.0 |
|
80 | + */ |
|
81 | + public function getETag() { |
|
82 | + return ''; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @inheritdoc |
|
87 | + * @since 16.0.0 |
|
88 | + */ |
|
89 | + public function getMTime() { |
|
90 | + return time(); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @inheritdoc |
|
95 | + * @since 16.0.0 |
|
96 | + */ |
|
97 | + public function getContent() { |
|
98 | + return $this->contents; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @inheritdoc |
|
103 | + * @since 16.0.0 |
|
104 | + */ |
|
105 | + public function putContent($data) { |
|
106 | + $this->contents = $data; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * In memory files can't be deleted. |
|
111 | + * |
|
112 | + * @since 16.0.0 |
|
113 | + */ |
|
114 | + public function delete() { |
|
115 | + // unimplemented for in memory files |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @inheritdoc |
|
120 | + * @since 16.0.0 |
|
121 | + */ |
|
122 | + public function getMimeType() { |
|
123 | + $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
124 | + return $fileInfo->buffer($this->contents); |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Stream reading is unsupported for in memory files. |
|
129 | + * |
|
130 | + * @throws NotPermittedException |
|
131 | + * @since 16.0.0 |
|
132 | + */ |
|
133 | + public function read() { |
|
134 | + throw new NotPermittedException( |
|
135 | + 'Stream reading is unsupported for in memory files' |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Stream writing isn't available for in memory files. |
|
141 | + * |
|
142 | + * @throws NotPermittedException |
|
143 | + * @since 16.0.0 |
|
144 | + */ |
|
145 | + public function write() { |
|
146 | + throw new NotPermittedException( |
|
147 | + 'Stream writing is unsupported for in memory files' |
|
148 | + ); |
|
149 | + } |
|
150 | 150 | } |
@@ -34,24 +34,24 @@ |
||
34 | 34 | |
35 | 35 | interface IAvatarManager { |
36 | 36 | |
37 | - /** |
|
38 | - * return a user specific instance of \OCP\IAvatar |
|
39 | - * @see IAvatar |
|
40 | - * @param string $user the ownCloud user id |
|
41 | - * @return IAvatar |
|
42 | - * @throws \Exception In case the username is potentially dangerous |
|
43 | - * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
44 | - * @since 6.0.0 |
|
45 | - */ |
|
46 | - public function getAvatar(string $user) : IAvatar; |
|
37 | + /** |
|
38 | + * return a user specific instance of \OCP\IAvatar |
|
39 | + * @see IAvatar |
|
40 | + * @param string $user the ownCloud user id |
|
41 | + * @return IAvatar |
|
42 | + * @throws \Exception In case the username is potentially dangerous |
|
43 | + * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
44 | + * @since 6.0.0 |
|
45 | + */ |
|
46 | + public function getAvatar(string $user) : IAvatar; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Returns a guest user avatar instance. |
|
50 | - * |
|
51 | - * @param string $name The guest name, e.g. "Albert". |
|
52 | - * @return IAvatar |
|
53 | - * @since 16.0.0 |
|
54 | - */ |
|
55 | - public function getGuestAvatar(string $name): IAvatar; |
|
48 | + /** |
|
49 | + * Returns a guest user avatar instance. |
|
50 | + * |
|
51 | + * @param string $name The guest name, e.g. "Albert". |
|
52 | + * @return IAvatar |
|
53 | + * @since 16.0.0 |
|
54 | + */ |
|
55 | + public function getGuestAvatar(string $name): IAvatar; |
|
56 | 56 | |
57 | 57 | } |
@@ -33,75 +33,75 @@ |
||
33 | 33 | */ |
34 | 34 | class GuestAvatarController extends Controller { |
35 | 35 | |
36 | - /** |
|
37 | - * @var ILogger |
|
38 | - */ |
|
39 | - private $logger; |
|
36 | + /** |
|
37 | + * @var ILogger |
|
38 | + */ |
|
39 | + private $logger; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var IAvatarManager |
|
43 | - */ |
|
44 | - private $avatarManager; |
|
41 | + /** |
|
42 | + * @var IAvatarManager |
|
43 | + */ |
|
44 | + private $avatarManager; |
|
45 | 45 | |
46 | - /** |
|
47 | - * GuestAvatarController constructor. |
|
48 | - * |
|
49 | - * @param $appName |
|
50 | - * @param IRequest $request |
|
51 | - * @param IAvatarManager $avatarManager |
|
52 | - * @param ILogger $logger |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - $appName, |
|
56 | - IRequest $request, |
|
57 | - IAvatarManager $avatarManager, |
|
58 | - ILogger $logger |
|
59 | - ) { |
|
60 | - parent::__construct($appName, $request); |
|
61 | - $this->avatarManager = $avatarManager; |
|
62 | - $this->logger = $logger; |
|
63 | - } |
|
46 | + /** |
|
47 | + * GuestAvatarController constructor. |
|
48 | + * |
|
49 | + * @param $appName |
|
50 | + * @param IRequest $request |
|
51 | + * @param IAvatarManager $avatarManager |
|
52 | + * @param ILogger $logger |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + $appName, |
|
56 | + IRequest $request, |
|
57 | + IAvatarManager $avatarManager, |
|
58 | + ILogger $logger |
|
59 | + ) { |
|
60 | + parent::__construct($appName, $request); |
|
61 | + $this->avatarManager = $avatarManager; |
|
62 | + $this->logger = $logger; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Returns a guest avatar image response. |
|
67 | - * |
|
68 | - * @PublicPage |
|
69 | - * @NoCSRFRequired |
|
70 | - * |
|
71 | - * @param string $guestName The guest name, e.g. "Albert" |
|
72 | - * @param string $size The desired avatar size, e.g. 64 for 64x64px |
|
73 | - * @return FileDisplayResponse|Http\Response |
|
74 | - */ |
|
75 | - public function getAvatar($guestName, $size) { |
|
76 | - $size = (int) $size; |
|
65 | + /** |
|
66 | + * Returns a guest avatar image response. |
|
67 | + * |
|
68 | + * @PublicPage |
|
69 | + * @NoCSRFRequired |
|
70 | + * |
|
71 | + * @param string $guestName The guest name, e.g. "Albert" |
|
72 | + * @param string $size The desired avatar size, e.g. 64 for 64x64px |
|
73 | + * @return FileDisplayResponse|Http\Response |
|
74 | + */ |
|
75 | + public function getAvatar($guestName, $size) { |
|
76 | + $size = (int) $size; |
|
77 | 77 | |
78 | - // min/max size |
|
79 | - if ($size > 2048) { |
|
80 | - $size = 2048; |
|
81 | - } elseif ($size <= 0) { |
|
82 | - $size = 64; |
|
83 | - } |
|
78 | + // min/max size |
|
79 | + if ($size > 2048) { |
|
80 | + $size = 2048; |
|
81 | + } elseif ($size <= 0) { |
|
82 | + $size = 64; |
|
83 | + } |
|
84 | 84 | |
85 | - try { |
|
86 | - $avatar = $this->avatarManager->getGuestAvatar($guestName); |
|
87 | - $avatarFile = $avatar->getFile($size); |
|
85 | + try { |
|
86 | + $avatar = $this->avatarManager->getGuestAvatar($guestName); |
|
87 | + $avatarFile = $avatar->getFile($size); |
|
88 | 88 | |
89 | - $resp = new FileDisplayResponse( |
|
90 | - $avatarFile, |
|
91 | - $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, |
|
92 | - ['Content-Type' => $avatarFile->getMimeType()] |
|
93 | - ); |
|
94 | - } catch (\Exception $e) { |
|
95 | - $this->logger->error('error while creating guest avatar', [ |
|
96 | - 'err' => $e, |
|
97 | - ]); |
|
98 | - $resp = new Http\Response(); |
|
99 | - $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
100 | - return $resp; |
|
101 | - } |
|
89 | + $resp = new FileDisplayResponse( |
|
90 | + $avatarFile, |
|
91 | + $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, |
|
92 | + ['Content-Type' => $avatarFile->getMimeType()] |
|
93 | + ); |
|
94 | + } catch (\Exception $e) { |
|
95 | + $this->logger->error('error while creating guest avatar', [ |
|
96 | + 'err' => $e, |
|
97 | + ]); |
|
98 | + $resp = new Http\Response(); |
|
99 | + $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
100 | + return $resp; |
|
101 | + } |
|
102 | 102 | |
103 | - // Cache for 30 minutes |
|
104 | - $resp->cacheFor(1800); |
|
105 | - return $resp; |
|
106 | - } |
|
103 | + // Cache for 30 minutes |
|
104 | + $resp->cacheFor(1800); |
|
105 | + return $resp; |
|
106 | + } |
|
107 | 107 | } |
@@ -30,10 +30,10 @@ |
||
30 | 30 | * @since 16.0.0 |
31 | 31 | */ |
32 | 32 | interface IConfigHandler { |
33 | - /** |
|
34 | - * @param mixed $optionValue |
|
35 | - * @return mixed the same type as $optionValue |
|
36 | - * @since 16.0.0 |
|
37 | - */ |
|
38 | - public function handle($optionValue); |
|
33 | + /** |
|
34 | + * @param mixed $optionValue |
|
35 | + * @return mixed the same type as $optionValue |
|
36 | + * @since 16.0.0 |
|
37 | + */ |
|
38 | + public function handle($optionValue); |
|
39 | 39 | } |
@@ -28,47 +28,47 @@ |
||
28 | 28 | |
29 | 29 | class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { |
30 | 30 | |
31 | - /** @var BirthdayService */ |
|
32 | - private $birthdayService; |
|
31 | + /** @var BirthdayService */ |
|
32 | + private $birthdayService; |
|
33 | 33 | |
34 | - /** @var IConfig */ |
|
35 | - private $config; |
|
34 | + /** @var IConfig */ |
|
35 | + private $config; |
|
36 | 36 | |
37 | - /** |
|
38 | - * GenerateAllBirthdayCalendarsBackgroundJob constructor. |
|
39 | - * |
|
40 | - * @param BirthdayService $birthdayService |
|
41 | - * @param IConfig $config |
|
42 | - */ |
|
43 | - public function __construct(BirthdayService $birthdayService, |
|
44 | - IConfig $config) { |
|
45 | - $this->birthdayService = $birthdayService; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
37 | + /** |
|
38 | + * GenerateAllBirthdayCalendarsBackgroundJob constructor. |
|
39 | + * |
|
40 | + * @param BirthdayService $birthdayService |
|
41 | + * @param IConfig $config |
|
42 | + */ |
|
43 | + public function __construct(BirthdayService $birthdayService, |
|
44 | + IConfig $config) { |
|
45 | + $this->birthdayService = $birthdayService; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param array $arguments |
|
51 | - */ |
|
52 | - public function run($arguments) { |
|
53 | - $userId = $arguments['userId']; |
|
54 | - $purgeBeforeGenerating = $arguments['purgeBeforeGenerating'] ?? false; |
|
49 | + /** |
|
50 | + * @param array $arguments |
|
51 | + */ |
|
52 | + public function run($arguments) { |
|
53 | + $userId = $arguments['userId']; |
|
54 | + $purgeBeforeGenerating = $arguments['purgeBeforeGenerating'] ?? false; |
|
55 | 55 | |
56 | - // make sure admin didn't change his mind |
|
57 | - $isGloballyEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); |
|
58 | - if ($isGloballyEnabled !== 'yes') { |
|
59 | - return; |
|
60 | - } |
|
56 | + // make sure admin didn't change his mind |
|
57 | + $isGloballyEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); |
|
58 | + if ($isGloballyEnabled !== 'yes') { |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // did the user opt out? |
|
63 | - $isUserEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
64 | - if ($isUserEnabled !== 'yes') { |
|
65 | - return; |
|
66 | - } |
|
62 | + // did the user opt out? |
|
63 | + $isUserEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
64 | + if ($isUserEnabled !== 'yes') { |
|
65 | + return; |
|
66 | + } |
|
67 | 67 | |
68 | - if ($purgeBeforeGenerating) { |
|
69 | - $this->birthdayService->resetForUser($userId); |
|
70 | - } |
|
68 | + if ($purgeBeforeGenerating) { |
|
69 | + $this->birthdayService->resetForUser($userId); |
|
70 | + } |
|
71 | 71 | |
72 | - $this->birthdayService->syncUser($userId); |
|
73 | - } |
|
72 | + $this->birthdayService->syncUser($userId); |
|
73 | + } |
|
74 | 74 | } |
@@ -28,38 +28,38 @@ |
||
28 | 28 | |
29 | 29 | class Capabilities implements ICapability { |
30 | 30 | |
31 | - /** @var IURLGenerator */ |
|
32 | - private $urlGenerator; |
|
31 | + /** @var IURLGenerator */ |
|
32 | + private $urlGenerator; |
|
33 | 33 | |
34 | - public function __construct(IURLGenerator $urlGenerator) { |
|
35 | - $this->urlGenerator = $urlGenerator; |
|
36 | - } |
|
34 | + public function __construct(IURLGenerator $urlGenerator) { |
|
35 | + $this->urlGenerator = $urlGenerator; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Function an app uses to return the capabilities |
|
40 | - * |
|
41 | - * @return array Array containing the apps capabilities |
|
42 | - * @since 8.2.0 |
|
43 | - */ |
|
44 | - public function getCapabilities() { |
|
45 | - $url = $this->urlGenerator->linkToRouteAbsolute('cloud_federation_api.requesthandlercontroller.addShare'); |
|
46 | - $capabilities = ['ocm' => |
|
47 | - [ |
|
48 | - 'enabled' => true, |
|
49 | - 'apiVersion' => '1.0-proposal1', |
|
50 | - 'endPoint' => substr($url, 0, strrpos($url, '/')), |
|
51 | - 'resourceTypes' => [ |
|
52 | - [ |
|
53 | - 'name' => 'file', |
|
54 | - 'shareTypes' => ['user', 'group'], |
|
55 | - 'protocols' => [ |
|
56 | - 'webdav' => '/public.php/webdav/', |
|
57 | - ] |
|
58 | - ], |
|
59 | - ] |
|
60 | - ] |
|
61 | - ]; |
|
38 | + /** |
|
39 | + * Function an app uses to return the capabilities |
|
40 | + * |
|
41 | + * @return array Array containing the apps capabilities |
|
42 | + * @since 8.2.0 |
|
43 | + */ |
|
44 | + public function getCapabilities() { |
|
45 | + $url = $this->urlGenerator->linkToRouteAbsolute('cloud_federation_api.requesthandlercontroller.addShare'); |
|
46 | + $capabilities = ['ocm' => |
|
47 | + [ |
|
48 | + 'enabled' => true, |
|
49 | + 'apiVersion' => '1.0-proposal1', |
|
50 | + 'endPoint' => substr($url, 0, strrpos($url, '/')), |
|
51 | + 'resourceTypes' => [ |
|
52 | + [ |
|
53 | + 'name' => 'file', |
|
54 | + 'shareTypes' => ['user', 'group'], |
|
55 | + 'protocols' => [ |
|
56 | + 'webdav' => '/public.php/webdav/', |
|
57 | + ] |
|
58 | + ], |
|
59 | + ] |
|
60 | + ] |
|
61 | + ]; |
|
62 | 62 | |
63 | - return $capabilities; |
|
64 | - } |
|
63 | + return $capabilities; |
|
64 | + } |
|
65 | 65 | } |