Fonctionnement des droits avec les services, retourne une array plutot qu'une chaine de caractère

This commit is contained in:
Michael RICOIS 2015-01-19 09:14:03 +00:00
parent a876608cb3
commit 574392b6c2
2 changed files with 16 additions and 4 deletions

View File

@ -574,11 +574,18 @@ class Scores_Ws_Server
*/
protected function checkPerm($perm)
{
$droits = $this->User->droits;
$output = false;
if ( preg_match('/\b'.$perm.'\b/i', $droits) ){
$output = true;
$droits = $this->User->droits;
if ( is_array($droits) ) {
if ( in_array($perm, $droits) ){
$output = true;
}
} else {
if ( preg_match('/\b'.$perm.'\b/i', $droits) ){
$output = true;
}
}
return $output;
}

View File

@ -148,7 +148,12 @@ class Gestion extends Scores_Ws_Server
$result->dateValidation = $this->User->dateValidation;
$result->nombreConnexions = $this->User->nombreConnexions;
$result->dateDerniereConnexion = $this->User->dateDerniereConnexion;
$result->droits = $this->User->droits;
// v2 auth return an array
if ( is_array($this->User->droits) ) {
$result->droits = join(' ', $this->User->droits);
} else {
$result->droits = $this->User->droits;
}
$result->droitsClients = $this->User->droitsClients;
$result->timeout = $this->User->timeout;
$result->clientTest = $this->User->clientTest;