Browse Source

hide personal settings access when settings are forced by the administrator

develop
Simon Vieille 2 months ago
parent
commit
a72bb87aa2
  1. 21
      lib/Settings/PersonalSection.php

21
lib/Settings/PersonalSection.php

@ -19,6 +19,7 @@
namespace OCA\SideMenu\Settings;
use OCA\SideMenu\AppInfo\Application;
use OCA\SideMenu\Service\ConfigProxy;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
@ -35,10 +36,16 @@ class PersonalSection implements IIconSection
*/
private $url;
public function __construct(IURLGenerator $url, IL10N $l)
/**
* @var ConfigProxy
*/
private $configProxy;
public function __construct(IURLGenerator $url, IL10N $l, ConfigProxy $configProxy)
{
$this->url = $url;
$this->l = $l;
$this->configProxy = $configProxy;
}
/**
@ -49,6 +56,10 @@ class PersonalSection implements IIconSection
*/
public function getID()
{
if ($this->configProxy->getAppValueBool('force', '0')) {
return '';
}
return Application::APP_ID;
}
@ -60,6 +71,10 @@ class PersonalSection implements IIconSection
*/
public function getName()
{
if ($this->configProxy->getAppValueBool('force', '0')) {
return '';
}
return $this->l->t(Application::APP_NAME);
}
@ -72,6 +87,10 @@ class PersonalSection implements IIconSection
*/
public function getPriority()
{
if ($this->configProxy->getAppValueBool('force', '0')) {
return null;
}
return 70;
}

Loading…
Cancel
Save