當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authorizer類代碼示例

本文整理匯總了PHP中Authorizer的典型用法代碼示例。如果您正苦於以下問題:PHP Authorizer類的具體用法?PHP Authorizer怎麽用?PHP Authorizer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Authorizer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     return $this->repository->isOwner($projectId, $userId) == false;
     return $next($request);
 }
開發者ID:alfredudu,項目名稱:laravel_angular,代碼行數:7,代碼來源:CheckProjectOwner.php

示例2: index

 public function index(Request $request)
 {
     if ($request->query->get('project_type', 'owner') == 'owner') {
         return $this->repository->findOwner(\Authorizer::getResourceOwnerId(), $request->query->get('limit'));
     }
     return $this->repository->findMember(\Authorizer::getResourceOwnerId(), $request->query->get('limit'));
 }
開發者ID:vik0803,項目名稱:project-manager-laravel,代碼行數:7,代碼來源:ProjectController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return $this->repository->findWhere(['owner_id' => \Authorizer::getResourceOwnerId()]);
     //return $this->repository->findWithOwnerAndMember(Authorizer::getResourceOwnerId());
     //return $this->repository->all();
     //return $this->repository->with(['client', 'user'])->all();
 }
開發者ID:robinhodemorais,項目名稱:laravel_codeproject,代碼行數:12,代碼來源:ProjectController.php

示例4: handle

 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     if ($this->repository->isOwner($id, $userId) == false) {
         return ['error' => 'Access forbidden'];
     }
 }
開發者ID:90lucasgabriel,項目名稱:activity,代碼行數:8,代碼來源:CheckProjectOwner.php

示例5: getAuthUserId

 /**
  * Retorna o user logado no OAuth
  * @return int
  * @throws \Exception
  */
 protected function getAuthUserId()
 {
     $userId = \Authorizer::getResourceOwnerId();
     if (is_null($userId)) {
         $this->failedAuthorization();
     }
     return $userId;
 }
開發者ID:gdgfoz,項目名稱:codelab-todo-api,代碼行數:13,代碼來源:BaseRequest.php

示例6: all

 public function all($limit = null)
 {
     try {
         return $this->repository->setPresenter($this->presenter)->findWithOwnerAndMember(\Authorizer::getResourceOwnerId(), $limit);
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Nenhum registro encontrado.', "messageDev" => $e->getMessage()];
     }
 }
開發者ID:jonasleitep4,項目名稱:curso-laravel-angular,代碼行數:8,代碼來源:ProjectService.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     //return $this->repository->findWhere(['owner_id' => \Authorizer::getResourceOwnerId()]);
     //return $this->repository->findWithOwnerAndMember(\Authorizer::getResourceOwnerId());
     return $this->repository->findOwner(\Authorizer::getResourceOwnerId(), $request->query->get('limit'));
     //return $this->repository->all();
     //return $this->repository->with(['client', 'user'])->all();
 }
開發者ID:estevesklein,項目名稱:CodeProject-curso-laravel,代碼行數:13,代碼來源:ProjectController.php

示例8: handle

 /**
  * 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->projects;
     if ($this->repository->isOwner($projectId, $userId) == false) {
         return ['error' => 'Access denied! You must be the project owner to access this resource'];
     }
     return $next($request);
 }
開發者ID:emersonrodrigod,項目名稱:codeproject,代碼行數:16,代碼來源:CheckProjectOwner.php

示例9: handle

 /**
  * 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->repository->isOwner($projectId, $userId) == false) {
         return ['error' => "Acesso negado"];
     }
     return $next($request);
 }
開發者ID:lucasinoue,項目名稱:projeto,代碼行數:16,代碼來源:CheckProjectOwner.php

示例10: store

 public function store(Requests\CheckoutRequest $request)
 {
     $data = $request->all();
     $id = \Authorizer::getResourceOwnerId();
     $clientId = $this->userRepository->find($id)->client->id;
     $data['client_id'] = $clientId;
     $order = $this->service->create($data);
     return $this->repository->with($this->with)->find($order->id);
 }
開發者ID:nagahshi,項目名稱:Laravel-CodeDelivery,代碼行數:9,代碼來源:ClientCheckoutController.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projeto = $request->projeto;
     if ($this->repository->isOwner($projeto, $userId) == false) {
         return ['error' => 'Access Forbbiden'];
     }
     return $next($request);
 }
開發者ID:igorfaria06,項目名稱:laravel,代碼行數:16,代碼來源:ChecarDonoProjeto.php

示例12: logout

 /**
  * @author LAHAXE Arnaud
  *
  * @apiGroup Auth
  * @apiName logout
  * @api      {post} /oauth/logout Logout
  *
  * @return \Illuminate\Http\RedirectResponse|\Laravel\Lumen\Http\Redirector
  */
 public function logout()
 {
     /** @var TokenHelper $tokenHelper */
     $tokenHelper = \App::make(TokenHelper::class);
     $tokenHelper->deleteTokens(\Authorizer::getChecker()->getAccessToken()->getId());
     // reset session if some dev use session in a rest api :D
     \Session::flush();
     return response()->json([], 202);
 }
開發者ID:ndrx-io,項目名稱:elude,代碼行數:18,代碼來源:Auth.php

示例13: handle

 /**
  * 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);
 }
開發者ID:heitorluz,項目名稱:codeproject,代碼行數:16,代碼來源:CheckProjectOwner.php

示例14: handle

 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $project_id = $request->id;
     if (!$this->repository->isOwner($userId, $project_id)) {
         return ['error' => 'Access forbiden!'];
     }
     return $next($request);
 }
開發者ID:marioAquinoJF,項目名稱:laravelWithAngular,代碼行數:9,代碼來源:CheckProjectOwner.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user_id = \Authorizer::getResourceOwnerId();
     $project_id = $request->project;
     $projects = $this->repository->skipPresenter()->findWhere(['id' => $project_id, 'owner_id' => $user_id]);
     if (count($projects) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $next($request);
 }
開發者ID:phelippe,項目名稱:CodeProject,代碼行數:17,代碼來源:CheckProjectOwner.php


注:本文中的Authorizer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。