|
90 | 90 | use OCP\Group\Events\GroupDeletedEvent; |
91 | 91 | use OCP\Group\Events\UserAddedEvent; |
92 | 92 | use OCP\Group\Events\UserRemovedEvent; |
93 | | -use OCP\Group\ISubAdmin; |
94 | 93 | use OCP\IConfig; |
95 | | -use OCP\IGroupManager; |
96 | | -use OCP\INavigationManager; |
97 | 94 | use OCP\IURLGenerator; |
98 | | -use OCP\IUserSession; |
99 | 95 | use OCP\L10N\IFactory; |
100 | 96 | use OCP\Mail\IMailer; |
101 | 97 | use OCP\Security\ICrypto; |
@@ -230,93 +226,5 @@ public function register(IRegistrationContext $context): void { |
230 | 226 |
|
231 | 227 | #[\Override] |
232 | 228 | public function boot(IBootContext $context): void { |
233 | | - $context->injectFn($this->registerNavigationEntries(...)); |
234 | | - } |
235 | | - |
236 | | - /** |
237 | | - * Registers the navigation entries for the user settings. |
238 | | - * Needed as some entries are dynamic and thus we cannot use the appinfo/info.xml |
239 | | - * |
240 | | - * Registers the following entries: |
241 | | - * - Appearance and accessibility |
242 | | - * - Personal settings (named "Settings" for non-admins) |
243 | | - * - Accounts (only for subadmins) |
244 | | - * - Help & privacy (conditionally enabled based on config) |
245 | | - */ |
246 | | - public function registerNavigationEntries( |
247 | | - INavigationManager $navigationManager, |
248 | | - IURLGenerator $urlGenerator, |
249 | | - IUserSession $userSession, |
250 | | - IConfig $config, |
251 | | - ): void { |
252 | | - if ($userSession->getUser() === null) { |
253 | | - return; |
254 | | - } |
255 | | - |
256 | | - $l = Server::get(IFactory::class) |
257 | | - ->get('settings'); |
258 | | - $groupManager = Server::get(IGroupManager::class); |
259 | | - $subAdmin = Server::get(ISubAdmin::class); |
260 | | - $isAdmin = $groupManager->isAdmin($userSession->getUser()->getUID()); |
261 | | - $isSubAdmin = $subAdmin->isSubAdmin($userSession->getUser()); |
262 | | - |
263 | | - // Accessibility settings - the URL is dynamic (route parameters) which is currently not supported by appinfo.xml |
264 | | - $navigationManager->add([ |
265 | | - 'type' => 'settings', |
266 | | - 'id' => 'accessibility_settings', |
267 | | - 'order' => 2, |
268 | | - 'href' => $urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'theming']), |
269 | | - 'name' => $l->t('Appearance and accessibility'), |
270 | | - 'icon' => $urlGenerator->imagePath('theming', 'accessibility-dark.svg'), |
271 | | - ]); |
272 | | - |
273 | | - // Personal settings - this entry is dynamic so we cannot use appinfo |
274 | | - $navigationManager->add([ |
275 | | - 'type' => 'settings', |
276 | | - 'id' => 'settings_personal', |
277 | | - 'order' => 3, |
278 | | - 'href' => $urlGenerator->linkToRoute('settings.PersonalSettings.index'), |
279 | | - 'name' => $isAdmin |
280 | | - ? $l->t('Personal settings') |
281 | | - : $l->t('Settings'), |
282 | | - 'icon' => $isAdmin |
283 | | - ? $urlGenerator->imagePath('settings', 'personal.svg') |
284 | | - : $urlGenerator->imagePath('settings', 'admin.svg'), |
285 | | - ]); |
286 | | - |
287 | | - if ($isAdmin) { |
288 | | - $navigationManager->add([ |
289 | | - 'type' => 'settings', |
290 | | - 'id' => 'settings_administration', |
291 | | - 'order' => 4, |
292 | | - 'href' => $urlGenerator->linkToRoute('settings.adminSettings.index'), |
293 | | - 'name' => $l->t('Administration settings'), |
294 | | - 'icon' => $urlGenerator->imagePath('settings', 'admin.svg'), |
295 | | - ]); |
296 | | - } |
297 | | - |
298 | | - // User management is conditionally enabled for subadmins, but appinfo currently only supports full admins |
299 | | - if ($isSubAdmin) { |
300 | | - $navigationManager->add([ |
301 | | - 'type' => 'settings', |
302 | | - 'id' => 'core_users', |
303 | | - 'order' => 6, |
304 | | - 'href' => $urlGenerator->linkToRoute('settings.Users.usersList'), |
305 | | - 'name' => $l->t('Accounts'), |
306 | | - 'icon' => $urlGenerator->imagePath('settings', 'users.svg'), |
307 | | - ]); |
308 | | - } |
309 | | - |
310 | | - // conditionally enabled navigation entry |
311 | | - if ($config->getSystemValueBool('knowledgebaseenabled', true)) { |
312 | | - $navigationManager->add([ |
313 | | - 'type' => 'settings', |
314 | | - 'id' => 'help', |
315 | | - 'order' => 99998, |
316 | | - 'href' => $urlGenerator->linkToRoute('settings.Help.help'), |
317 | | - 'name' => $l->t('Help & privacy'), |
318 | | - 'icon' => $urlGenerator->imagePath('settings', 'help.svg'), |
319 | | - ]); |
320 | | - } |
321 | 229 | } |
322 | 230 | } |
0 commit comments