| @@ 138-156 (lines=19) @@ | ||
| 135 | return $result; |
|
| 136 | } |
|
| 137 | ||
| 138 | public function groups($project, $username) |
|
| 139 | { |
|
| 140 | $this->setUp($project); |
|
| 141 | $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
| 142 | $query = new SimpleRequest('query', $params); |
|
| 143 | $result = []; |
|
| 144 | ||
| 145 | try { |
|
| 146 | $res = $this->api->getRequest($query); |
|
| 147 | if (isset($res["batchcomplete"]) && isset($res["query"]["users"][0]["groups"])) { |
|
| 148 | $result = $res["query"]["users"][0]["groups"]; |
|
| 149 | } |
|
| 150 | } catch (Exception $e) { |
|
| 151 | // The api returned an error! Ignore |
|
| 152 | } |
|
| 153 | ||
| 154 | return $result; |
|
| 155 | } |
|
| 156 | ||
| 157 | public function globalGroups($project, $username) |
|
| 158 | { |
|
| 159 | $this->setUp($project); |
|
| @@ 157-175 (lines=19) @@ | ||
| 154 | return $result; |
|
| 155 | } |
|
| 156 | ||
| 157 | public function globalGroups($project, $username) |
|
| 158 | { |
|
| 159 | $this->setUp($project); |
|
| 160 | $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
| 161 | $query = new SimpleRequest('query', $params); |
|
| 162 | $result = []; |
|
| 163 | ||
| 164 | try { |
|
| 165 | $res = $this->api->getRequest($query); |
|
| 166 | if (isset($res["batchcomplete"]) && isset($res["query"]["globaluserinfo"]["groups"])) { |
|
| 167 | $result = $res["query"]["globaluserinfo"]["groups"]; |
|
| 168 | } |
|
| 169 | } catch (Exception $e) { |
|
| 170 | // The api returned an error! Ignore |
|
| 171 | } |
|
| 172 | ||
| 173 | return $result; |
|
| 174 | } |
|
| 175 | ||
| 176 | /** |
|
| 177 | * Get a list of namespaces on the given project. |
|
| 178 | * |
|