hide personal settings access when settings are forced by the administrator

This commit is contained in:
Simon Vieille 2021-08-11 11:57:43 +02:00
parent 5e4a7bcae4
commit a72bb87aa2
1 changed files with 20 additions and 1 deletions

View File

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