diff --git a/README.md b/README.md index 4bbaa97..77fe318 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -Yii2 RBAC module -============== +# Yii2 RBAC module -1 Introduction ----------------------------- +## Introduction [![Latest Stable Version](https://poser.pugx.org/itstructure/yii2-rbac-module/v/stable)](https://packagist.org/packages/itstructure/yii2-rbac-module) [![Latest Unstable Version](https://poser.pugx.org/itstructure/yii2-rbac-module/v/unstable)](https://packagist.org/packages/itstructure/yii2-rbac-module) @@ -11,41 +9,31 @@ Yii2 RBAC module [![Build Status](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/badges/build.png?b=master)](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/?branch=master) -**Rbac module** -- Module for the Yii2 framework, which provides management with the next data: +**RBAC module** - Module for the Yii2 framework, which provides management with the next data: - Roles - Permissions -2 Dependencies ----------------------------- +![RBAC extension structure](https://github.com/itstructure/yii2-rbac-module/blob/master/yii2_rbac_structure_en.jpg) + +## Dependencies - php >= 7.1 - composer - MySql >= 5.5 -3 Installation ----------------------------- +## Installation -### 3.1 General from remote repository +### General from remote repository Via composer: -```composer require "itstructure/yii2-rbac-module": "^3.0.0"``` - -or in section **require** of composer.json file set the following: -``` -"require": { - "itstructure/yii2-rbac-module": "^3.0.0" -} -``` -and command ```composer install```, if you install yii2 project extensions first, - -or command ```composer update```, if all yii2 project extensions are already installed. +`composer require itstructure/yii2-rbac-module "~3.0.1"` -### 3.2 If you are testing this package from local server directory +### If you are testing this package from local server directory -In application ```composer.json``` file set the repository, like in example: +In application `composer.json` file set the repository, like in example: -``` +```json "repositories": [ { "type": "path", @@ -63,9 +51,9 @@ Here, Then run command: -```composer require itstructure/yii2-rbac-module:dev-master --prefer-source``` +`composer require itstructure/yii2-rbac-module:dev-master --prefer-source` -### 3.3 Addition components +### Addition components In accordance with the [documentation for Yii2](http://www.yiiframework.com/doc-2.0/guide-security-authorization.html), set **authManager** for application: @@ -84,27 +72,26 @@ In accordance with the [documentation for Yii2](http://www.yiiframework.com/doc- yii migrate --migrationPath=@yii/rbac/migrations ``` -4 Usage ----------------------------- +## Usage + +### Main properties + +- The **name** of module: `rbac` +- The **namespace** for used classes: `Itstructure\RbacModule`. +- The **alias** to access in to module root directory: `@rbac`. -### 4.1 Main properties +- **There is not a layout !** It's taken from application layout **main** by default **or how it is configured**. You cat set `layout` attribute in module by custom. -- The **name** of module: ```rbac``` -- The **namespace** for used classes: ```Itstructure\RbacModule```. -- The **alias** to access in to module root directory: ```@rbac```. -- **There is not a layout !** It's taken from application layout **main** by default **or how it is -configured**. -You cat set ```layout``` attribute in module by custom. -- **View** component is taken by default from the framework like **yii\web\View**. You cat set -**view** component in module by custom. +- **View** component is taken by default from the framework like **yii\web\View**. You cat set **view** component in module by custom. -### 4.2 Application config +### Application config Base application config must be like in example below: ```php use Itstructure\RbacModule\Module; use Itstructure\RbacModule\controllers\{RoleController, PermissionController, ProfileController}; ``` + ```php 'modules' => [ 'rbac' => [ @@ -118,16 +105,17 @@ use Itstructure\RbacModule\controllers\{RoleController, PermissionController, Pr ], ``` -### 4.3 Useful module attributes +### Useful module attributes + +You can set the following attributes in a module config: -- ```loginUrl``` - set url to be redirected if you are not authorized. -- ```accessRoles``` - The roles of users who are allowed access to work with this package. -- ```urlPrefix``` - Url prefix for redirect and view links (Default is empty). -- ```urlPrefixNeighbor``` - Url prefix for redirect and view links of neighbor entity (Default is empty). +- `loginUrl` - set url to be redirected if you are not authorized. +- `accessRoles` - The roles of users who are allowed access to work with this package. +- `urlPrefix` - Url prefix for redirect and view links (Default is empty). +- `urlPrefixNeighbor` - Url prefix for redirect and view links of neighbor entity (Default is empty). -License ----------------------------- +## License -Copyright © 2018 Andrey Girnik girnikandrey@gmail.com. +Copyright © 2018-2020 Andrey Girnik girnikandrey@gmail.com. Licensed under the [MIT license](http://opensource.org/licenses/MIT). See LICENSE.txt for details. diff --git a/changelog.md b/changelog.md index 3ad32b1..93c2633 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ ### CHANGE LOG: +**3.0.1 July 17, 2020:** +- Bug fix for `registerTranslations()` method. Set it static. +- Readme fixes. + **3.0.0 August 5, 2018:** - Code fixes according with the PSR standards. - Rename ```RolesController``` to ```RoleController```. diff --git a/src/Module.php b/src/Module.php index 3ca1d0e..5b73b93 100644 --- a/src/Module.php +++ b/src/Module.php @@ -150,7 +150,7 @@ public static function t($category, $message, $params = [], $language = null) * * @return void */ - private function registerTranslations(): void + private static function registerTranslations(): void { self::$_translations = [ 'modules/rbac/*' => [ diff --git a/yii2_rbac_structure_en.jpg b/yii2_rbac_structure_en.jpg new file mode 100644 index 0000000..5d1bea8 Binary files /dev/null and b/yii2_rbac_structure_en.jpg differ