Download the PHP package railken/amethyst-permission without Composer

On this page you can find all versions of the php package railken/amethyst-permission. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package amethyst-permission

amethyst-permission

Action Status

Amethyst package.

Define permissions with an extensive customization for your data and routes.

Requirements

PHP 7.2 and later.

TODO

Installation

You can install it via Composer by typing the following command:

The package will automatically register itself.

Usage

A simple usage looks like this

Permissions will be automatically reloaded whenever a eloquent.saved is fired for Permission model.

Effect

The effect can be either accept or deny. Without any permissions any user is denied to perform anything. If you add both permission accept and deny both of them are applied.

For example you could set "user can see all comments" and "user cannot see this comment". At the end the user can see all comments except the one that you defined.

Type

The type of your permission indicate which class will be used to resolve your request.

It can be either data or route, but you can extend it in amethyst.permissions.permission

Agent

The agent is retrieved through the facade Illuminate\Support\Facades\Auth and the method user().

When this field is null it means that it's applied to all agents.

Agent must return a condition true or false.

If you wish to see the syntax see nicoSWD/php-rule-parser.

Before parsing with the logic parser, a twig parser comes in. The only variable passed is the agent and it is your App\Models\User. You can then use whanever logic you want to get the information you want. For example you can filter by any attributes and any relations (e.g. groups): {{ agent.groups.contains('myGroupName') ? 1 : 0 }} === 1

Payload

A payload in YAML the define the specification of your permission. For example for the permission route it can be a wildcard for the url.

Payload - Route

Some examples:

Enable endpoint /profile for each user.

You can also use an array

Enable endpoints foo.* (foo.index, foo.create, foo.show, foo.update, foo.delete) for user id 2

Payload - Data

The following example will permit the user#2 to visualize only the data named post that contains in the name foo

List of all actions: query, create, update, remove


All versions of amethyst-permission with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
amethyst/core Version 0.3.*
amethyst/owner Version 0.3.*
railken/template Version ^1.1
nicoswd/php-rule-parser Version ^0.7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package railken/amethyst-permission contains the following files

Loading the files please wait ....