Download the PHP package justcoded/yii2-rbac without Composer

On this page you can find all versions of the php package justcoded/yii2-rbac. 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 yii2-rbac

Yii 2 JustCoded RBAC extension


Extended RBAC Manager with route-based access.

Features

Pre-defined Roles and Permissions

By default this extension init such roles and permissions:

Permissions:

Roles:

Routes Scanner

Special console command (or GUI interface) has feature to scan your project files and import permissions like:

You can create additional roles (or add permissions to existed roles) to configure your system high-level access.

Routes Access filter

Most popular thing in RBAC configuration is to close access to some parts of the site (logged in area, different user roles, admin area, etc.).

Extension provides filter very similar to standard AccessControl which check {controller->uniqueId}/*, {controller->uniqueId}/{action->id} permission on page load and throw 403 error if you're not allowed to access routes.

GUI

Simple GUI* interface to manage your roles and permissions.

Note: GUI still has alpha version features. Don't share access to this GUI to your clients!

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Configuration

Component Setup

To use the RBAC extension, you need to configure the components array in your application configuration:

Bootstrap4 Themes Support

By default all views use standard yii2-bootstrap package with Boostrap v3. If you use modern Bootstrap 4, then you can overwrite some classes to use yii2-bootstrap4 package instead. Inside your configuration you need to reconfigure container dependencies like this:

Basic RBAC configuration

Please follow oficial documentation to configure RBAC storage (create necessary files or database tables).

If you use DbManager you can init database tables with the following migration command:

Init base roles

Before usage this extension you will need to init default roles, which are pre-defined for it.

To do that you will need to run several commands:

Usage

GUI interface

To use graphical interface just follow the route you specified as base when scan routes / configure module.

Note: Role Permissions selector is a hotfix solution, so it doesn't display proper tree structure when you move items between boxes. This will be fixed in next versions.

Route Access filter

RouteAccessControl filter can be used inside specific controller (or globally) to control access to controller actions on very high level.

Routes scanner insert permissions like:

{controller->uniqueId}/* {controller->uniqueId}/{action->id}

On controller beforeAction this filter check that current logged in user has permissions to access these routes.

To enable filter inside some specific controller:

Or you can configure this filter globally. Inside you current application config just add such section:

Example

You can check the example on our Yii2 starter kit.


All versions of yii2-rbac with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
yiisoft/yii2 Version ^2.0.12
kartik-v/yii2-widget-select2 Version ^2.1.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 justcoded/yii2-rbac contains the following files

Loading the files please wait ....