forked from Business/AccountHub
		
	Improve isManagerOf() error handling to prevent possible security bug
This commit is contained in:
		
							parent
							
								
									abb306a36e
								
							
						
					
					
						commit
						ce8e0fb4e3
					
				| @ -1,4 +1,5 @@ | |||||||
| <?php | <?php | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Get user info for the given username. |  * Get user info for the given username. | ||||||
|  * @param int $u username |  * @param int $u username | ||||||
| @ -85,10 +86,10 @@ function isManagerOf($m, $e) { | |||||||
| 
 | 
 | ||||||
|     $resp = json_decode($response->getBody(), TRUE); |     $resp = json_decode($response->getBody(), TRUE); | ||||||
|     if ($resp['status'] == "OK") { |     if ($resp['status'] == "OK") { | ||||||
|         return $resp['managerof']; |         return $resp['managerof'] === true; | ||||||
|     } else { |     } else { | ||||||
|         // this shouldn't happen, but in case it does just fake it.
 |         // this shouldn't happen, but in case it does just fake it.
 | ||||||
|         return ["name" => $u, "username" => $u, "uid" => $u]; |         return false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user