当前位置: 首页>>代码示例>>PHP>>正文


PHP ProjectRepository::isMember方法代码示例

本文整理汇总了PHP中CodeProject\Repositories\ProjectRepository::isMember方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectRepository::isMember方法的具体用法?PHP ProjectRepository::isMember怎么用?PHP ProjectRepository::isMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeProject\Repositories\ProjectRepository的用法示例。


在下文中一共展示了ProjectRepository::isMember方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete($task_id)
 {
     $task = ProjectTask::find($task_id);
     if (is_null($task)) {
         return Errors::invalidId($task_id);
     }
     $user_id = \Authorizer::getResourceOwnerId();
     if (!$this->projectRepository->isMember($task->project_id, $user_id)) {
         return Errors::basic('Acesso negado. Você não é membro do projeto desta tarefa.');
     }
     $this->repository->delete($task_id);
     return ['message' => "Registro deletado!"];
 }
开发者ID:nelioalves,项目名称:teste-team,代码行数:13,代码来源:ProjectTaskService.php

示例2: delete

 public function delete($file_id)
 {
     $projectFile = ProjectFile::find($file_id);
     if (is_null($projectFile)) {
         return Errors::invalidId($file_id);
     }
     $user_id = \Authorizer::getResourceOwnerId();
     if (!$this->projectRepository->isMember($projectFile->project_id, $user_id)) {
         return Errors::basic('Acesso negado. Você não é membro do projeto deste arquivo.');
     }
     $nome = $projectFile->id . '.' . $projectFile->extension;
     $this->repository->delete($file_id);
     $this->storage->delete($nome);
     return ['message' => "Registro e arquivo deletados!"];
 }
开发者ID:nelioalves,项目名称:teste-team,代码行数:15,代码来源:ProjectFileService.php

示例3: addMember

 public function addMember($data, $project_id)
 {
     $project = Project::find($project_id);
     if (is_null($project)) {
         return Errors::invalidId($project_id);
     }
     if (!array_key_exists('user_id', $data)) {
         return Errors::basic("Campo user_id obrigatorio");
     }
     $user_id = $data['user_id'];
     // Como o create ja insere o dono como membro, nao haveria necessidade desta verificacao
     if ($user_id == $project->owner_id) {
         return Errors::basic("Este usuario ja eh o dono do projeto");
     }
     if ($this->repository->isMember($project_id, $user_id)) {
         return Errors::basic("Este usuario ja eh membro do projeto");
     }
     $data['project_id'] = $project_id;
     return $this->projectMemberService->create($data);
 }
开发者ID:nelioalves,项目名称:teste-team,代码行数:20,代码来源:ProjectService.php

示例4: update

 public function update(array $data, $file_id)
 {
     $file = ProjectFile::find($file_id);
     if (is_null($file)) {
         return Errors::invalidId($file_id);
     }
     try {
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE);
         if ($data['project_id'] != $file->project_id) {
             return Errors::basic('Você não pode alterar o projeto do arquivo.');
         }
         if ($data['extension'] != $file->extension) {
             return Errors::basic('Você não pode alterar a extensão do arquivo.');
         }
         $user_id = \Authorizer::getResourceOwnerId();
         if (!$this->projectRepository->isMember($file->project_id, $user_id)) {
             return Errors::basic('Acesso negado. Você não é membro do projeto selecionado.');
         }
         return $this->repository->update($data, $file_id);
     } catch (ValidatorException $e) {
         return Errors::basic($e->getMessageBag());
     }
 }
开发者ID:nelioalves,项目名称:curso-modulo-angular,代码行数:23,代码来源:ProjectFileService.php

示例5: checkProjectMember

 private function checkProjectMember($projectId)
 {
     return $this->repository->isMember($projectId, Authorizer::getResourceOwnerId());
 }
开发者ID:henemer,项目名称:codeproject,代码行数:4,代码来源:ProjectFileController.php

示例6: checkProjectMember

 /**
  * @param $project_id
  * @return array
  */
 public function checkProjectMember($project_id)
 {
     $user_id = \Authorizer::getResourceOwnerId();
     return $this->repository->isMember($project_id, $user_id);
 }
开发者ID:adrianodrix,项目名称:codeproject.dev,代码行数:9,代码来源:ProjectService.php

示例7: isMember

 public function isMember($projectId, $userId)
 {
     return $this->repository->isMember($projectId, $userId);
 }
开发者ID:nativadesenvolvimento,项目名称:codeproject_curso,代码行数:4,代码来源:ProjectService.php


注:本文中的CodeProject\Repositories\ProjectRepository::isMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。