add an option to force settings to users

This commit is contained in:
Simon Vieille
2020-09-24 14:26:25 +02:00
parent 4b6a1f2989
commit c7f9fd1b8b
10 changed files with 192 additions and 147 deletions
+7 -1
View File
@@ -24,6 +24,7 @@ use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
use OCA\SideMenu\AppInfo\Application;
use OCA\SideMenu\Service\ConfigProxy;
class PersonalSettingController extends Controller
{
@@ -37,11 +38,12 @@ class PersonalSettingController extends Controller
*/
private $userSession;
public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession)
public function __construct($appName, IRequest $request, IConfig $config, ConfigProxy $configProxy, IUserSession $userSession)
{
parent::__construct($appName, $request);
$this->config = $config;
$this->configProxy = $configProxy;
$this->userSession = $userSession;
}
@@ -104,6 +106,10 @@ class PersonalSettingController extends Controller
}
}
if ($this->configProxy->getAppValueBool('force', '0')) {
$doSave = false;
}
if ($doSave) {
$this->config->setUserValue($user->getUid(), Application::APP_ID, $name, $value);