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


PHP Facades\Authorizer类代码示例

本文整理汇总了PHP中LucaDegasperi\OAuth2Server\Facades\Authorizer的典型用法代码示例。如果您正苦于以下问题:PHP Authorizer类的具体用法?PHP Authorizer怎么用?PHP Authorizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: store

 public function store(array $data)
 {
     try {
         $userId = Authorizer::getResourceOwnerId();
         $this->user = $this->repository->find($userId);
         $data['cliente_id'] = $this->user->cliente_id;
         //$this->validator->with($data)->passesOrFail();
         //Verificando se email existeformlogin
         $usuario = $this->repository->findWhere(['cliente_id' => $data['cliente_id'], 'email' => $data['email']]);
         if ($usuario->count()) {
             return ['warning' => true, 'message' => 'Email já cadastrado!'];
         }
         $data['token_senha'] = str_random(60);
         $this->repository->create($data);
         $data['link'] = 'www.teste.proload.com.br/#/acesso/' . $data['token_senha'];
         Mail::send('email.bemvindo', ['dado' => $data], function ($m) use($data) {
             $m->to($data['email'], $data['name'])->subject('Bem vindo ao ProDmed');
         });
         return ['success' => true, 'message' => 'Usuário cadastrado com sucesso!'];
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (QueryException $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
开发者ID:jaysongyn,项目名称:dmed,代码行数:25,代码来源:UserService.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     #Precisa desse validate para funcionar
     $validado = Authorizer::validateAccessToken();
     /*dd(Authorizer::validateAccessToken(),
       Authorizer::getResourceOwnerId(),
       Authorizer::getResourceOwnerType(),
       Authorizer::getAccessToken()->getId(),
       Authorizer::getAccessToken());*/
     /*$token = Authorizer::getAccessToken()->getId();
             $id_cliente = Authorizer::getResourceOwnerId();
     
             $token_db = DB::table('oauth_access_tokens')
                 ->where('id', $token)
                 ->where('grant_type', 'cliente')->first();
     
             #dd($token_db);
     
             if($validado && $token_db){
     
             }*/
     $checker = Authorizer::getChecker();
     $accessToken = $checker->getAccessToken();
     #dd($checker);
     #dd($accessToken);
     $accessTokenEntity = DB::table('oauth_access_tokens')->where('id', $accessToken)->first();
     #dd($accessTokenEntity);
     $grantType = $accessTokenEntity->grant_type ? $accessTokenEntity->grant_type : null;
     #dd($grantType);
     if ($grantType != 'cliente') {
         abort(403, 'Access forbidden');
     }
     return $next($request);
 }
开发者ID:phelippe,项目名称:multitest,代码行数:41,代码来源:OAuthCheckCliente.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $deliverymanId = Authorizer::getResourceOwnerId();
     if ($order = $this->orderService->updateStatus($id, $deliverymanId, $request->get('status'))) {
         return $order;
     }
     abort(400, 'Pedido não encontrado');
 }
开发者ID:douglasresendemaciel,项目名称:laravel_delivery,代码行数:15,代码来源:DeliverymanCheckoutController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $project_id = $request->project;
     if ($this->repository->isOwner($project_id, Authorizer::getResourceOwnerId()) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $next($request);
 }
开发者ID:henemer,项目名称:codeproject,代码行数:15,代码来源:CheckProjectOwner.php

示例5: store

 public function store(CheckoutRequest $request)
 {
     $data = $request->all();
     $client = $this->userRepository->find(Authorizer::getResourceOwnerId())->client->id;
     $data['client_id'] = $client;
     $order = $this->orderService->create($data);
     return $this->orderRepository->skipPresenter(false)->with($this->with)->find($order->id);
 }
开发者ID:ssistemas,项目名称:delivery,代码行数:8,代码来源:ClientCheckoutController.php

示例6: index

 public function index()
 {
     #$rtrn = $this->user_repository->skipPresenter()->find(Authorizer::getResourceOwnerId())->projects()->with(['client', 'tasks', 'notes', 'members', 'owner'])->get();
     $rtrn = $this->repository->findWithOwnerAndMember(Authorizer::getResourceOwnerId());
     #$rtrn = $this->user_repository->find(Authorizer::getResourceOwnerId())->projects()->with(['client', 'tasks', 'notes', 'members', 'owner'])->get();
     #return $this->user_repository->find(Authorizer::getResourceOwnerId())->projects()->with(['client', 'tasks', 'notes', 'members'])->get();
     return $rtrn;
 }
开发者ID:phelippe,项目名称:CodeProject,代码行数:8,代码来源:ProjectService.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     $user = $this->userRepository->skipPresenter()->find(Authorizer::getResourceOwnerId());
     if ($user->role != $role) {
         abort(403, 'Access forbidden');
     }
     return $next($request);
 }
开发者ID:adrianodrix,项目名称:codedelivery.dev,代码行数:15,代码来源:OAuthCheckRole.php

示例8: createToken

 public function createToken(Request $request)
 {
     $json = $request->json()->all();
     $request = new Request();
     $request->request->replace($json);
     Authorizer::setRequest($request);
     return $this->respond(Authorizer::issueAccessToken());
 }
开发者ID:kidshenlong,项目名称:comic-cloud-lumen,代码行数:8,代码来源:AuthController.php

示例9: all

 public function all($id = null, $limit = 6)
 {
     $this->setPresenter();
     if (!is_null($id)) {
         return $this->repository->findWhere(['project_id' => $id]);
     }
     return $this->repository->recentTasks(Authorizer::getResourceOwnerId(), $limit);
 }
开发者ID:netoudi,项目名称:laravel-angularjs,代码行数:8,代码来源:ProjectTaskService.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $id = $request->id;
     if (!$this->repository->isOwner($id, Authorizer::getResourceOwnerId())) {
         return response()->json(['error' => true, 'message' => ['owner' => 'You are not an authorized user in this project']], 403);
     }
     return $next($request);
 }
开发者ID:brunowerneck,项目名称:CodeProject,代码行数:15,代码来源:CheckProjectOwner.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();
     $cursoId = $request->curso;
     if ($this->repository->isOwner($cursoId, $userId) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $next($request);
 }
开发者ID:silviobarretto,项目名称:codeproject,代码行数:16,代码来源:CheckCursoOwner.php

示例12: __construct

 public function __construct(EmpresaRepository $repository, EmpresaValidator $validator, PrefeituraGoiania $prefeitura, UserRepository $userRepository)
 {
     $this->repository = $repository;
     $this->validator = $validator;
     $this->prefeitura = $prefeitura;
     $this->userRepository = $userRepository;
     $userId = Authorizer::getResourceOwnerId();
     $this->user = $this->userRepository->find($userId);
 }
开发者ID:jaysongyn,项目名称:dmed,代码行数:9,代码来源:EmpresaService.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, ...$params)
 {
     $id = Authorizer::getResourceOwnerId();
     $user = $this->userRepository->find($id);
     if (!in_array($user->role, $params)) {
         abort(403, 'Access Forbidden');
     }
     return $next($request);
 }
开发者ID:douglasresendemaciel,项目名称:laravel_delivery,代码行数:16,代码来源:OAuthCheckRole.php

示例14: 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 ['success' => false, 'userId' => 'Forbidden'];
     }
     return $next($request);
 }
开发者ID:tiagocardosos,项目名称:laravel-codeeducation,代码行数:16,代码来源:CheckProjectOwner.php

示例15: store

 public function store(Request $request)
 {
     $id = Authorizer::getResourceOwnerId();
     $dados = $request->all();
     $cliente = $this->userRepository->find($id)->cliente->id;
     $dados['cliente_id'] = $cliente;
     $pedido = $this->pedidoService->criar($dados);
     return $this->repository->with('items')->find($pedido->id);
 }
开发者ID:rpc1910,项目名称:LaravelDelivery,代码行数:9,代码来源:ClientCarrinhoController.php


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