/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { $user = $this->repository->findByUsername($this->getIdentity()->getRoleId()); if ($user->getRole() == 'salesman') { return new ApiProblem(403, 'The user is not has access this info'); } return $this->repository->find($id); }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { $user = $this->repository->findByUsername($this->getIdentity()->getRoleId()); if ($user->getRole() != "admin") { return new ApiProblem("403", "The user has not access to this info."); } return $this->repository->find($id); }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { $user = $this->repository->findByUsername($this->getIdentity()->getRoleId()); if ($user->getRole() == 'salesman') { return new ApiProblem(403, "O usuário não tem acesso à essas informações"); } return $this->repository->find($id); }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { try { $this->authService->hasRole('admin'); return $this->usersRepository->find($id); } catch (\Exception $e) { return new ApiProblem($e->getCode(), $e->getMessage()); } }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { $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->find($id); }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { return $this->repository->find($id); //return new ApiProblem(405, 'The GET method has not been defined for individual resources'); }
/** * Fetch a resource * * @param mixed $id * @return ApiProblem|mixed */ public function fetch($id) { return $this->repository->find($id); }