Exemplo n.º 1
0
             }
         } else {
             if (count($segments) > 1 && $segments[1]) {
                 // Make sure the user is editing their own info, or the user is an administrator
                 if ($role === 'admin') {
                     // Allow the editing of the role too
                     $response = $Cosmo->usersUpdate($segments[1], $username, $name, $photo, $bio, $facebook, $twitter, $role, $email);
                 } else {
                     if ($username === $_PUT['username']) {
                         $response = $Cosmo->usersUpdate($segments[1], $username, $name, $photo, $bio, $facebook, $twitter, NULL, $email);
                     }
                 }
             } else {
                 if ($reset) {
                     // Reset password
                     $response['token'] = $Cosmo->passwordReset($segments[1]);
                 }
             }
         }
         break;
     case 'DELETE':
         if ($role === 'admin') {
             if (isset($segments[2])) {
                 $response = $Cosmo->usersRoleDelete($segments[1]);
             } else {
                 $response = $Cosmo->usersDelete($segments[1]);
             }
         }
         break;
 }
 break;