/**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     $user = $this->usersRepository->findByUsername($this->getIdentity()->getRoleId());
     if ($user->getRole() != "admin") {
         return new ApiProblem(403, "The user has not access to this info.");
     }
     return $this->usersRepository->findAll();
 }
Пример #2
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     $username = $this->getIdentity()->getRoleId();
     $user = $this->repository->findByUsername($username);
     if ($user->getRole() != 'admin') {
         return new ApiProblem(403, 'O usuário não tem permissão para acessar esta informação');
     }
     return $this->repository->findAll();
 }
Пример #3
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     try {
         $this->authService->hasRole('admin');
         return $this->usersRepository->findAll();
     } catch (\Exception $e) {
         return new ApiProblem($e->getCode(), $e->getMessage());
     }
 }
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     return $this->repository->findAll();
 }
Пример #5
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     return $this->repository->findAll();
     //return new ApiProblem(405, 'The GET method has not been defined for collections');
 }