Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Latest commit

 

History

History
48 lines (35 loc) · 948 Bytes

README.md

File metadata and controls

48 lines (35 loc) · 948 Bytes

Railt Authorization

Your application should use the Laravel Provider

Installation

  • composer require serafim/railt-authorization
  • Add into config/railt.php:
    ...
    'extensions' => [
        \Serafim\RailtAuthorization\AuthorizationExtension::class, 
    ]

Usage

Authenticated

The field that contains the directive @auth is only available to an authenticated user.

type Example {
    field: Result! @auth
}

Guest

The field that contains the directive @guest is only available to a guest (non-authenticated user).

type Example {
    field: Result! @guest
}

Authorization

The field that contains the directive @can(role: String!):

  1. Is only available to an authenticated user.
  2. Should pass the authorization gate defined in role argument.
type Example {
    field: Result! @can(role: "some")
}