コード例 #1
0
 public function testRemoveUser()
 {
     $auth = new Authentification();
     $auth->add_user('toto', 'toto');
     $auth->remove_user('toto');
     $users = $auth->get_users();
     $this->assertArrayNotHasKey('toto', $users);
 }
コード例 #2
0
ファイル: index.php プロジェクト: JulienUsson/ZZTask
         $admin->add_admin($params['login']);
     }
     break;
     //--------------- SET_ADMIN ------------------
 //--------------- SET_ADMIN ------------------
 case 'set_admin':
     if ($params['isAdmin'] == 'true') {
         echo json_encode($admin->add_admin($params['login']));
     } else {
         echo json_encode($admin->remove_admin($params['login']));
     }
     break;
     //--------------- GET_USERS ------------------
 //--------------- GET_USERS ------------------
 case 'get_users':
     foreach ($auth->get_users() as $login => $pass) {
         $users[] = array('login' => $login, 'isAdmin' => $admin->is_admin($login));
     }
     unset($login);
     unset($pass);
     echo json_encode($users);
     break;
     //--------------- REMOVE_USER ------------------
 //--------------- REMOVE_USER ------------------
 case 'remove_user':
     echo json_encode($auth->remove_user($params['login']));
     break;
     //--------------- RESET_USER ------------------
 //--------------- RESET_USER ------------------
 case 'reset_user':
     echo json_encode($auth->reset_password($params['login']));