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