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); }
/** * @Ajax */ public function searchGroup() { \OC_Util::checkAdminUser(); $params = $this->request->get; $kind = isset($params['kind']) ? $params['kind'] : null; if (is_null($kind)) { return new JSONResponse(array("msg" => "criteria is not specified"), Http::STATUS_BAD_REQUEST); } if (!GK::checkGroupTypeLabel($kind)) { return new JSONResponse(array("msg" => "mode is not valid"), Http::STATUS_BAD_REQUEST); } $groups = $this->accessObjectMapper->findGroupsInMode(GK::modeToInt($kind)); $array = array(); if ($groups) { foreach ($groups as $group) { $array[] = array('id' => $group->getId(), 'name' => $group->getName()); } } return new JSONResponse($array); }