本文整理汇总了PHP中LucaDegasperi\OAuth2Server\Facades\Authorizer::getResourceOwnerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorizer::getResourceOwnerId方法的具体用法?PHP Authorizer::getResourceOwnerId怎么用?PHP Authorizer::getResourceOwnerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LucaDegasperi\OAuth2Server\Facades\Authorizer
的用法示例。
在下文中一共展示了Authorizer::getResourceOwnerId方法的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()];
}
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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');
}
示例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;
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: __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'];
}
示例11: 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;
}
示例12: updateStatus
public function updateStatus(Request $request, $id)
{
$idDeliveryman = Authorizer::getResourceOwnerId();
$order = $this->service->updateStatus($id, $idDeliveryman, $request->get('status'));
if ($order) {
return $this->repository->find($order->id);
}
abort(400, "Order not found!");
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$idUser = Authorizer::getResourceOwnerId();
$idProject = $request->project;
if ($this->repository->isOwner($idProject, $idUser) == false) {
return ['success' => false];
}
return $next($request);
}
示例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 ['error' => "Acesso negado."];
}
return $next($request);
}
示例15: geo
public function geo(Request $request, Geo $geo, $id)
{
$idDeliveryman = Authorizer::getResourceOwnerId();
$order = $this->orderRepository->getByIdAndDeliveryman($id, $idDeliveryman);
$geo->lat = $request->get('lat');
$geo->long = $request->get('long');
event(new GetLocationDeliveryMan($geo, $order));
return $geo;
}