Download the PHP package dtkahl/php-access-control without Composer

On this page you can find all versions of the php package dtkahl/php-access-control. 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 php-access-control

Latest Stable Version License Build Status

PHP access control

This package provides an access control (right management) system based on user, roles, rights and objects.

User

The main reason of this package is to prove whether the user has a specific right or not.

A user can have a right on different ways:

Roles

A role is a defined set of rights and can extend another existing role. Roles can be assigned on a global scope or on a specific object.

Objects

An user can have a specific role for a specific object. As example: The User "John" has the role "author" on the object "BlogPost".

A object can be any class that implements ObjectInterface. As example it could be the Eloquent model class BlogPost.

Installation

Install with Composer:

Usage

create User(s)

This is not really a big deal. You just need a class that implements the UserAccessInterface.

This requires you to implement one method:

create Objects

This is a step you can skip if you only want to implement global rights. If you wan to have object roles and rights you have to implement the ObjectInterface in your objects class.

This requires three methods:

define roles an rights

This could take place anywhere in your application but needs to be done before checking rights. The best place could be inside a dependency injection container.

Defining a role

Namespaces are new with issue #10 and new release 2.0.0

Extending a role

define an object

create the judge instance

The Judge class

This is the main class to check rights or roles. You normally want let your dependency container to return a instance of this class.

It has the following public methods:

registerRole($role)

Register a new global role for the Judge instance.

registerObject($object)

Register a new object for the Judge instance.

setUser($user)

Set the default user for the Judge instance.

getUser()

Return the default user of the Judge instance.

checkRight($rights, $object = null, $user = null)

Throws NotAllowedException if the user do not have the given right(s).

If given object is null it only checks global rights. If given user is null it uses the default user.

Example:

hasRight($rights, $object = null, $user = null)

This is a proxy for checkRights() but instead of throwing an exception it only return true or false.

checkRole

Throws NotALlowedException if the user do not have the given role.

If given object is null it only checks global roles. If given user is null it uses the default user. If parameter check_extend_roles is true (default: false) the given role is also checked against the extend roles of the roles the user has. (see issue #9)

Example:

hasRight

This is a proxy for checkRole() but instead of throwing an exception it only return true or false.


All versions of php-access-control with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
dtkahl/php-array-tools Version ^3.0
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 dtkahl/php-access-control contains the following files

Loading the files please wait ....