Download the PHP package ivko/yii-auth without Composer
On this page you can find all versions of the php package ivko/yii-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ivko/yii-auth
More information about ivko/yii-auth
Files in ivko/yii-auth
Package yii-auth
Short Description Web UI for the authorization manager of Yii PHP framework.
License BSD-3-Clause
Informations about the package yii-auth
yii-auth
Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager (CAuthManager). You can read more about Yii's authorization manager in the framework documentation under Authentication and Authorization.
Auth was developed to provide a modern and responsive user interface for managing user permissions in Yii projects. To achieve its goals it was built using my popular Twitter Bootstrap extension.
Auth is written according to Yii's conventions and it follows the separation of concerns priciple and therefore it doesn't require you to extend from its classes. Instead it provides additional functionality for the authorization manager through a single behavior.
Demo
You can try out the live demo here.
Requirements
- Twitter Bootstrap extension for Yii version 2.0.0 or above
Usage
Setup
Download the latest release from Yii extensions.
Unzip the module under protected/modules/auth and add the following to your application config:
protected/config/main.php
Please note that while the module doesn't require you to use a database, if you wish to use CDbAuthManager you need it's schema (it can be found in the framework under web/auth).
Configuration
Configure the module to suit your needs. Here's a list of the available configurations (with default values).
Enabling caching
To enable caching for CDbAuthManager you can use CachedDbAuthManager that provides caching for access checks. Here's an example configuration for the component:
Checking access
When you wish to check if the current user has a certain permission you can use the CWebUser::checkAccess() method which can be access from anywhere in your application through Yii::app() like so:
In order to keep your permissions dynamic you should never check for a specific role or task, instead you should always check for an operation. For more information on Yii's authorization manager refer to the framework documentation on Authentication and Authorization.
Checking access using a filter
You can also use a filter to automatically check access before controller actions are called. Operations used with this filter has to be named as follows (moduleId.)controllerId.actionId, where moduleId is optional. You can also use a wildcard *controllerId.*** instead of the actionId to cover all actions in the controller or module.**** instead of the controllerId to cover all controllers in the module.
For more information on how filters work refer to the framework documentation on Controllers.
Internationalization
Do you wish to provide a translation for Auth? If so, please do a pull request for it. Translations should be placed in the messages folder under a folder named according to its locale (e.g. en_us).
Note
Note: Version 1.0.6-wip use and require yiistrap!! yiistrap is next generation yii-bootsrap