コード例 #1
0
ファイル: UserController.php プロジェクト: bakgat/notos
 /**
  * Resets the password of a given user
  *
  * @param $userId
  * @param Request $request
  * @return User
  */
 public function resetPassword($orgId, $userId, Request $request)
 {
     $password = $request->input('password');
     $user = $this->userService->userOfId($userId);
     if ($user) {
         $user = $this->userService->resetPassword($user, $password);
         return $this->jsonResponse($user);
     } else {
         abort(404, 'User with id [' . $user . '] not found.');
     }
 }
コード例 #2
0
ファイル: UserServiceTest.php プロジェクト: bakgat/notos
 /**
  * @test
  * @group userservice
  */
 public function should_throw_role_not_found_when_adding_user_to_role()
 {
     $this->setExpectedException('Bakgat\\Notos\\Domain\\Model\\ACL\\Exceptions\\RoleNotFoundException');
     $this->roleRepo->shouldReceive('get')->andThrow('Bakgat\\Notos\\Domain\\Model\\ACL\\Exceptions\\RoleNotFoundException');
     $this->userService->addUserToRole($this->karl, 'non_exists', $this->klimtoren);
 }