• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Facades\Authorizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __construct

 /**
  * @param VendasRepository $repository
  * @param VendasService $service
  */
 public function __construct(VendasRepository $repository, VendasService $service, RevendedoresRepository $revendedoresRepository)
 {
     $this->repository = $repository;
     $this->service = $service;
     $this->revendedoresRepository = $revendedoresRepository;
     $userId = Authorizer::getResourceOwnerId();
     $revendedor = $this->revendedoresRepository->findWhere(['id_usuario' => $userId]);
     $this->id_revendedor = $revendedor[0]['id'];
 }
开发者ID:JhonnyHRocha,项目名称:lince,代码行数:13,代码来源:VendasController.php


示例17: checkPermissions

 public function checkPermissions($projectId)
 {
     $owner = $this->project->find($projectId)->owner_id;
     $userId = Authorizer::getResourceOwnerId();
     if ($owner != $userId and !$this->hasMember($projectId)) {
         throw new \Exception('Access Denied');
     }
     return true;
 }
开发者ID:cristianvuolo,项目名称:cursoLaravelAnguar,代码行数:9,代码来源:ProjectTaskController.php


示例18: store

 public function store(CheckoutRequest $request)
 {
     $id = Authorizer::getResourceOwnerID();
     $data = $request->all();
     $clientId = $this->userRepository->find($id)->client->id;
     $data['client_id'] = $clientId;
     $order = $this->orderService->create($data);
     return $this->repository->with($this->with)->find($order->id);
 }
开发者ID:AllanKlaus,项目名称:CodeDelivery,代码行数:9,代码来源:ClientCheckoutController.php


示例19: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $clientId = $this->userRepository->find(Authorizer::getResourceOwnerId())->client->id;
     $data['client_id'] = $clientId;
     $order = $this->orderService->create($data);
     $order = $this->orderRepository->with('items')->find($order->id);
     return $order;
 }
开发者ID:pdayvson,项目名称:laravel-codedelirevy,代码行数:15,代码来源:ClientCheckoutController.php


示例20: handle

 public function handle($request, Closure $next, $role)
 {
     $id = Authorizer::getResourceOwnerID();
     $user = $this->userRepository->find($id);
     if ($user->role != $role) {
         abort('403', 'Access Forbidden');
     }
     return $next($request);
 }
开发者ID:AllanKlaus,项目名称:CodeDelivery,代码行数:9,代码来源:OAuthCheckRole.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Employe类代码示例发布时间:2022-05-23
下一篇:
PHP available\Directory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap