/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($projectId, $id)
 {
     if ($this->checkProjectPermissions($projectId) == false) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->service->destroyFile($projectId, $id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param  int $memberId
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $memberId)
 {
     if ($this->service->checkProjectPermissions($id) == false) {
         return ['error' => 'Access forbidden'];
     }
     $this->service->removeMember($id, $memberId);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if ($this->checkProjectOwner($id) == false) {
         return ['error' => 'Access Forbiden'];
     }
     return $this->service->update($request->all(), $id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (!$this->checkProjectOwner($id)) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->service->delete($id);
 }
 public function showFile($projectId, $id)
 {
     $filePath = $this->service->getFilePath($id);
     $fileContent = file_get_contents($filePath);
     $file64 = base64_encode($fileContent);
     return ['file' => $file64, 'size' => filesize($filePath), 'name' => basename($filePath)];
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     if ($this->checkProjectPermissions($id) == false) {
         return ['error' => 'Acesso Negado'];
     }
     return $this->service->update($request->all(), $id);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if ($this->isNotOwner($id) and $this->isNotMember($id)) {
         return ['error' => 'Access forbirdden'];
     }
     return $this->service->update($request->all(), $id);
 }
 /**
  * @param $request
  * @param Closure $next
  * @return array
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if ($this->service->checkProjectPermissions($projectId) == false) {
         return ['error' => 'You haven\'t permission to access project'];
     }
     return $next($request);
 }
 public function update(Request $request, $id)
 {
     try {
         $this->service->update($request->all(), $id);
     } catch (\Exception $e) {
         return 'Erro ao realizar atualização: ' . $e->getMessage();
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $projectId = $request->route("id") ? $request->route("id") : $request->route("project");
     if ($this->service->checkProjectOwner($projectId) == false && $this->service->checkProjectPermissions($projectId) == false) {
         return response(['message' => 'User don\'t have access to project'], 403);
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if ($this->service->checkProjectOwner($projectId) == false) {
         return ['error' => 'Access forbiden'];
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if ($this->service->checkProjectPermissions($projectId) == false) {
         return Response::json(['error' => true, 'message' => "Você não tem permissão para acessar esse projeto!"], 400);
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     if ($this->service->isOwner($projectId, $userId) == false) {
         return ['sucess' => false];
     }
     return $next($request);
 }
 public function store(Request $request)
 {
     $data['project_id'] = $request->project_id;
     $data['name'] = $request->name;
     $data['description'] = $request->description;
     $data['file'] = $request->file('file');
     $data['extension'] = $data['file']->getClientOriginalExtension();
     $this->service->createFile($data);
 }
 public function update(Request $request, $id)
 {
     try {
         $this->checkPermissions($this->repository->find($id)->project_id);
         $this->service->update($request->all(), $id);
     } catch (\Exception $e) {
         return ['error' => $e->getMessage()];
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     /*$client = Client::find($id); //consulta dos dados
     
             $client->update($request->all(),$id); //atualiza os dados
     
             return $client; //retornar os dados para serialização em JSON*/
     //return Client::find($id)->update($request->all());
     //return $this->repository->update($request->all(), $id);
     return $this->service->update($request->all(), $id);
 }
Beispiel #17
0
 public function delete($id)
 {
     $entity = Client::find($id);
     if (is_null($entity)) {
         return Errors::invalidId($id);
     }
     foreach ($entity->projects as $proj) {
         $this->projectService->delete($proj->id);
     }
     $this->repository->delete($id);
     return ['message' => "Registro deletado!"];
 }
 /**
  * Handle an incoming request.
  *
  * @param  Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $projectId = $request->route("id") ? $request->route("id") : $request->route("project");
     if (!$this->service->checkProjectOwner($projectId)) {
         return response(['message' => 'User don\'t have access to project'], 403);
         /*
                     return [ "code" => 403,
                "error" => "Access forbidden."
                ];
         * 
         */
     }
     return $next($request);
 }
 public function showTasks($id)
 {
     if ($this->checkProjectPermissions($id) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $this->service->showTasks($id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $taskId)
 {
     if ($this->projectService->checkProjectPermissions($id) == false) {
         return ['error' => 'Access forbidden'];
     }
     $this->repository->skipPresenter()->find($taskId)->delete();
 }
 private function checkProjectNotePermissions($projectId)
 {
     if ($this->projectService->checkProjectOwner($projectId) or $this->projectService->checkProjectMember($projectId)) {
         return true;
     }
     return false;
 }
 /**
  * @param $id
  * @param $fileId
  *
  * @return array
  */
 public function destroy($id, $fileId)
 {
     if (empty($id) or $this->projectService->checkProjectOwner($id) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $this->service->destroy($id, $fileId);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if ($this->service->checkProjectOwner($projectId) == false) {
         return ['error' => 'Access forbiden'];
     }
     return $next($request);
     /*
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     
     if($this->repository->isOwner($projectId, $userId) == false){
         return ['error' => 'Access forbidden'];
     }
     
     return $next($request);
     */
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //return $this->service->delete($id);
     try {
         $this->service->delete($id);
         return response()->json(['error' => false, 'message' => ['removeMember' => "Projeto removido{$id}"]]);
     } catch (ModelNotFoundException $e) {
         return response()->json($this->noFound($id));
     }
 }
Beispiel #25
0
 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->update($data, $id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'O Projeto que está tentando atualizar não existe'];
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if ($this->checkProjectPermissions($id) == false) {
         return "Access Forbidden";
     }
     $project = $this->repository->findOrFail($id);
     if (!is_object($project)) {
         return $project;
     }
     return $this->service->update($request->all(), $id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($this->service->checkProjectPermissions($id) == false) {
         return ['error' => 'Access Forbidden'];
     }
     $result = $this->repository->delete($id);
     if ($result) {
         return ['error' => 0];
     }
     return ['error' => 1, 'msg' => 'Erro ao tentar deletar o Project'];
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param $idFile
  * @return Response
  */
 public function destroy($id, $idFile)
 {
     try {
         if ($this->projectService->checkProjectPermissions($id) == false) {
             return ['error' => 'Access Forbidden'];
         }
         $this->service->delete($idFile);
         return ['error' => false, 'message' => 'Store file deleted'];
     } catch (ModelNotFoundException $ex) {
         return ['error' => true, 'message' => 'Store file error'];
     }
 }
 public function removeMember($project_id, $member_id)
 {
     try {
         return $this->service->removeMember($project_id, $member_id);
     } catch (ModelNotFoundException $e) {
         return $this->erroMsgm('Projeto não encontrado.');
     } catch (QueryException $e) {
         return $this->erroMsgm('Cliente não encontrado.');
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao remover o membro.');
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     /*$client = Client::find($id); //consulta dos dados
     
             $client->update($request->all(),$id); //atualiza os dados
     
             return $client; //retornar os dados para serialização em JSON*/
     //return Client::find($id)->update($request->all());
     //return $this->repository->update($request->all(), $id);
     if ($this->checkProjectOwner($id) == false) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->service->update($request->all(), $id);
 }