public function run() { $groupName = Group::standardizeGroupName($this->request->getPar('group')); $group = new Group(); $group->setName($groupName); $group = $group->read(); if ($group === null) { throw new GraphException('Group ' . $groupName . ' not found'); } $nGroup = Group::getByRequest(); $nGroup->setId($group->getId()); $nGroup->setVersion($group->getVersion()); $this->sendModel($nGroup->update()); }
public function run() { $group = Group::standardizeGroupName($this->request->getPar('group')); $userGroup = new UserGroup(); $userGroup->setGroup($group); $userGroups = $userGroup->read(true); $ret = array(); if ($userGroups !== null) { foreach ($userGroups as $uGroup) { $res = $this->forward('/users/user/' . $uGroup->getUserId()); if ($res->getStatusCode() !== 200) { Log::err('user: '******' not found'); } else { $ret[] = json_decode($res->getBody(), true)['User']['username']; } } } $this->response->setBody(json_encode(array('GroupUsers' => array('group' => $group, 'users' => $ret)), JSON_PRETTY_PRINT)); }
public function standardize() { $this->content['group'] = Group::standardizeGroupName($this->content['group']); }