public function run()
 {
     $group = new Group();
     $groups = $this->resultsToArray($group->read(true, null, 1, 0));
     $ret = $this->getGroupTree($groups);
     $this->response->setBody(json_encode(array("GroupsHierarchy" => $ret), JSON_PRETTY_PRINT));
 }
 public function run()
 {
     $groupName = $this->request->getPar('group');
     $group = new Group();
     $group->setName($groupName);
     $rGroup = $group->read();
     $this->sendModel($rGroup);
 }
示例#3
0
 public function securityChecks()
 {
     $this->standardize();
     $parentGroup = self::getGroupName($this->getParent());
     if ($this->getName() === Group::$superUserGroupName) {
         throw new GraphException('cannot use system group name: ' . self::$superUserGroupName . ' for group', 400);
     }
     if ($this->getName() === Group::$everyoneGroupName) {
         throw new GraphException('cannot create system group: ' . Group::$everyoneGroupName . ' for group name', 400);
     }
     if ($parentGroup === Group::$superUserGroupName) {
         throw new GraphException('cannot use system group: ' . Group::$superUserGroupName . ' as parent', 400);
     }
     $fGroup = new Group();
     $fGroup->setName($this->getName());
     if ($fGroup->read() !== null) {
         throw new GraphException('group ' . $this->getName() . ' already exists', 400);
     }
     if ($this->getParent() !== Group::$everyoneGroupName) {
         $fGroup = new Group();
         $fGroup->setName($this->getParent());
         if ($fGroup->read() === null) {
             throw new GraphException('parent group: ' . $this->getParent() . ' does not exists', 400);
         }
     }
 }