Пример #1
0
 /**
  * @Ajax
  */
 public function setMode()
 {
     \OC_Util::checkAdminUser();
     $params = $this->request->post;
     $value = isset($params['value']) ? $params['value'] : null;
     if (is_null($value)) {
         throw new \Exception("mode {$value} can not be null", 1);
     }
     if (!GK::checkMode($value)) {
         throw new \Exception("mode {$value} is incorrect", 1);
     }
     $this->appConfig->setValue('gatekeeper', 'mode', $value);
     return new JSONResponse(array('status' => 'ok'));
 }
Пример #2
0
 public function __construct($mode, $session, $accessObjectMapper, $groupManager, $remote = FALSE, $refreshDelay = -1)
 {
     if (!is_string($mode) || !GK::checkMode($mode)) {
         throw new \Exception("Mode {$mode} is invalid");
     }
     if (!GK::checkMode($mode)) {
         throw new \Exception("Mode {$mode} is not valid", 1);
     }
     $this->whiteListMode = $mode === GK::WHITELIST_MODE;
     $this->blackListMode = $mode === GK::BLACKLIST_MODE;
     $this->minimalMode = $mode === GK::MINIMAL_MODE;
     if (!$this->minimalMode) {
         $this->groupType = GK::modeToInt($mode);
     }
     $this->session = $session;
     $this->accessObjectMapper = $accessObjectMapper;
     $this->groupManager = $groupManager;
     $this->cache = array();
     $this->remote = $remote;
     $this->refreshDelay = intval($refreshDelay);
 }
Пример #3
0
 public function testCheckMode()
 {
     $this->assertTrue(!GK::checkMode('foo'));
 }