GUI manager for RBAC (Role Base Access Control) Yii2. Easy to manage authorization of user

Overview

RBAC Manager for Yii 2

GUI manager for RBAC (Role Base Access Control) Yii2. Easy to manage authorization of user 😄 .

Latest Unstable Version Total Downloads Daily Downloads License Reference Status Build Status Dependency Status Scrutinizer Code Quality Code Climate

Documentation

Important: If you install version 3.x, please see this readme.

Installation

Install With Composer

The preferred way to install this extension is through composer.

Either run

php composer.phar require mdmsoft/yii2-admin "~1.0"
or
php composer.phar require mdmsoft/yii2-admin "~2.0"

or for the dev-master

php composer.phar require mdmsoft/yii2-admin "2.x-dev"

Or, you may add

"mdmsoft/yii2-admin": "~2.0"

to the require section of your composer.json file and execute php composer.phar update.

Install From the Archive

Download the latest release from here releases, then extract it to your project. In your application config, add the path alias for this extension.

return [
    ...
    'aliases' => [
        '@mdm/admin' => 'path/to/your/extracted',
        // for example: '@mdm/admin' => '@app/extensions/mdm/yii2-admin-2.0.0',
        ...
    ]
];

More...

screenshots

Comments
  • How can generate all main controllers routes

    How can generate all main controllers routes

    Good afternoon,

    I have use yii2-admin, in that all module's controllers routes is already or automatically generated but how can i generate all main controller's routes.
    In RouteController has no generate action for generate routes but Route/view has generate view file so, how can i use that generate.php view file.

    need more info 
    opened by GAMITG 23
  • Class mdm\admin\Module does not exist

    Class mdm\admin\Module does not exist

    I'm trying this extension for the first time

    I've succesfully run composer installation of yii2-admin

    In backend\config\main.php I've this (I omitted irrilevant code)

    return [
        ....
        'modules' => [
            'admin' => [
                'class' => 'mdm\admin\Module',
            ]
        ],
        'components' => [
            .... 
    
            'authManager' => [
                'class' => 'yii\rbac\DbManager', // or use 'yii\rbac\PhpManager'
            ],
            'as access' => [
                'class' => 'mdm\admin\components\AccessControl',
                'allowActions' => [
                    'admin/*', // add or remove allowed actions to this list
                ]
            ],
        ],
        ...
    ];
    

    Also, I've enabled pretty url (this is already working)

    When I go to http:///admin

    I got this Exception

    Class mdm\admin\Module does not exist
    

    What have I forgot / mistaken?

    to be verified docs 
    opened by realtebo 16
  • Restricting Access to Module

    Restricting Access to Module

    How do I suppose to restrict that? I know I can try the Application beforeAction but its a long route. I believe module should have a way of restricting users. I suggest to add property that limits by IDs or role something like

    if(id_is_in_admin_array or role_is_in_roles_array)
    {
        allow_access
    }
    else
        deny_access
    

    what do you think?

    opened by mtangoo 11
  • Error:items/RouteController,rotues parameter is an array rather than a string

    Error:items/RouteController,rotues parameter is an array rather than a string

    Hi,when I assign routes , I get a error. Php program to get routes parameters I selected multiple routes to a string is not an array. But after we use the foreach to traverse my routes parameters. I hope you can understand what I'm saying!

    to be verified 
    opened by TongJiankang 11
  • Rest api authentication

    Rest api authentication

    You can't authenticate user with behavior yii\filters\auth\QueryParamAuth in controller because of the way filters(behaviors) work.

    When multiple filters are configured for a single action, they are applied according to the rules described below:

    • Pre-filtering
      • Apply filters declared in the application in the order they are listed in behaviors().
      • Apply filters declared in the module in the order they are listed in behaviors().
      • Apply filters declared in the controller in the order they are listed in behaviors().
      • If any of the filters cancel the action execution, the filters (both pre-filters and post-filters) after it will not be applied.
    • Running the action if it passes the pre-filtering.
    • Post-filtering
      • Apply filters declared in the controller in the reverse order they are listed in behaviors().
      • Apply filters declared in the module in the reverse order they are listed in behaviors().
      • Apply filters declared in the application in the reverse order they are listed in behaviors().

    When request is being made it runs module behaviors that checks permissions while permissions are granted later in controller behaviors.

    namespace frontend\controllers;
    
    use common\models\ar\User;
    use common\models\Ipc;
    use yii\filters\auth\QueryParamAuth;
    use yii\helpers\Url;
    use yii\helpers\VarDumper;
    use yii\rest\Controller;
    use yii\web\Response;
    use yii\web\UnauthorizedHttpException;
    use yii\filters\AccessControl;
    
    class IpcApiController extends Controller {
    
        public function init() {
            parent::init();
            \Yii::$app->user->enableSession = false;
            \Yii::$app->user->loginUrl = null;
        }
    
        public function behaviors() {
            \Yii::$app->response->format = Response::FORMAT_XML;
            $behaviors = parent::behaviors();
            $behaviors['authenticator'] = [
                'class' => QueryParamAuth::className(),
                'tokenParam' => 'accessToken',
            ];
            return $behaviors;
        }
    }
    
    opened by kurrata 10
  • Missing required parameter

    Missing required parameter "id" when instantiating "mdm\admin\Module".

    I get error "Missing required parameter "id" when instantiating "mdm\admin\Module"." when try to install this module. I have installed it how it described in instruction.

    opened by fimak 9
  • Class yii\jui\AutoComplete not found

    Class yii\jui\AutoComplete not found

    Saat dalam local tidak ada maslah, namun saat di server produksi, mau create permission terjadi error. Class 'yii\jui\AutoComplete' not found. Kemudian ane lihat http://www.yiiframework.com/doc-2.0/yii-jui-autocomplete.html. codenya di /permission/_Form.php saya ubah menjadi

     <?= $form->field($model, 'ruleName')->widget(\yii\jui\AutoComplete::classname(), [
            'options' => [
                'class' => 'form-control',
            ],
            'clientOptions' => [
                'source' => array_keys(Yii::$app->authManager->getRules()),
            ]
        ]) ?>
    

    masih error juga.. Class 'yii\jui\AutoComplete' not found.

    opened by ardlian 8
  • Add access limit to module

    Add access limit to module

    Currently I cannot restrict someone to access module. So I have added checks to see if user is either is in defined array in config or user have admin role

    opened by mtangoo 8
  • Error on php7.2

    Error on php7.2

    For compatibiliy with PHP 7.2 which does not allow classes to be named Object anymore, we needed to rename yii\base\Object to yii\base\BaseObject.

    i found you use yii\base\Object in models/Assignment.php, models/Route.php and components/Configs.php. it's fix when i change parents of three class above to yii\base\BaseObject.

    opened by Masyhudi 7
  • Whitelist Rbac route

    Whitelist Rbac route

    Apparently using the RBAC module skips the ACF exceptions When I set my config to

        'as access' => [
            'class' => 'mdm\admin\components\AccessControl',
            'allowActions' => [
                '/sitemap',
    

    My sitemap is not available, only when I add that the the guest user role. Is there a way to hardcode certain access routes to be open to all ?

    Certain routes I want hardcoded to be accessed by all in order to not forget to set those routes.,

    opened by robov 7
  • How to use this module in backend for frontend routes?

    How to use this module in backend for frontend routes?

    yii2-advanced-app template. I've installed yii2-admin module in my /backend app, it works. Now I want to edit permissions only for frontend app, I use RBAC in DB for this but how to get frontend routes?

    opened by nelo23 7
  • Menu with subitems didn't show up on Bootstrap5

    Menu with subitems didn't show up on Bootstrap5

    Hello there,

    I installed a vanilla Yii2 advanced template and then follow this guideline: https://www.yiiframework.com/wiki/848/installation-guide-yii-2-advanced-template-with-rbac-system to implement yii2-admin.

    But when I try to show the menu, the options with sub items don't show at all: I can only click on the top item.

    I instantiate the menu using:

    use yii\bootstrap5\Breadcrumbs;
    use yii\bootstrap5\Html;
    use yii\bootstrap5\Nav;
    use yii\bootstrap5\NavBar;
    
    use mdm\admin\components\MenuHelper;
    
    [...]
    
    $menuItems = MenuHelper::getAssignedMenu(Yii::$app->user->id);
    
    		echo Nav::widget([
    			'options' => ['class' => 'navbar-nav ml-auto'], // navbar-right'],
    			'items' => $menuItems,
    			'encodeLabels' => False,
    		]);
    

    Any clue?

    Thank you!

    S.

    opened by numitec 1
  • Can not instantiate when controller file is abstract or interface class

    Can not instantiate when controller file is abstract or interface class

    in the file models/Route.php the function getActionRoutes

    protected function getActionRoutes($controller, &$result)
        {
            $token = "Get actions of controller '" . $controller->uniqueId . "'";
            Yii::beginProfile($token, __METHOD__);
            try {
                $prefix = '/' . $controller->uniqueId . '/';
                foreach ($controller->actions() as $id => $value) {
                    $result[$prefix . $id] = $prefix . $id;
                }
                $class = new \ReflectionClass($controller);
                if($class->->isAbstract() || $class->isInterface() ){
                    return;
                }
                foreach ($class->getMethods() as $method) {
                    $name = $method->getName();
                    if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
                        $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
                        $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
                        $result[$id] = $id;
                    }
                }
            } catch (\Exception $exc) {
                Yii::error($exc->getMessage(), __METHOD__);
            }
            Yii::endProfile($token, __METHOD__);
        }
    
    opened by easydowork 0
  • Support untuk PHP 8.1

    Support untuk PHP 8.1

    Dear Cak, PHP versi 8.1.5 Yii 2.0.46

    Untuk route: /admin/permission/index dengan

    Halaman gagal render karena :

    PHP Deprecated Warning – yii\base\ErrorException trim(): Passing null to parameter #1 ($string) of type string is deprecated

    opened by ahmadfadlydziljalal 1
Releases(2.12)
Owner
MDMunir Software
MDMunir Software
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

Laravel Authorization Laravel-authz is an authorization library for the laravel framework. It's based on Casbin, an authorization library that support

PHP-Casbin 243 Jan 4, 2023
An authorization library that supports access control models like ACL, RBAC, ABAC for webman plugin

An authorization library that supports access control models like ACL, RBAC, ABAC for webman plugin

PHP-Casbin 18 Dec 30, 2022
Manage authorization with granular role-based permissions in your Laravel Apps.

Governor For Laravel Manage authorization with granular role-based permissions in your Laravel apps. Goal Provide a simple method of managing ACL in a

GeneaLabs, LLC 149 Dec 23, 2022
Authentication, authorization and access control for PHP

Jasny Auth Authentication, authorization and access control for PHP. Features Multiple authorization strategies, like groups (for acl) and levels. Aut

Arnold Daniels 105 Dec 12, 2022
Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager

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.

Christoffer Niska 134 Oct 22, 2022
Tech-Admin is Laravel + Bootstrap Admin Panel With User Management And Access Control based on Roles and Permissions.

Tech-Admin | Laravel 8 + Bootstrap 4 Tech-Admin is Admin Panel With Preset of Roles, Permissions, ACL, User Management, Profile Management. Features M

TechTool India 39 Dec 23, 2022
Easy, native Laravel user authorization.

An easy, native role / permission management system for Laravel. Index Installation Migration Customization Model Customization Usage Checking Permiss

DirectoryTree 5 Dec 14, 2022
User role and Permission Management system with Paticie package

User role and Permission Management system with Paticie package Installation instruction Download or git clone https://github.com/KKOO727/User-role-ma

Ninja 2 Mar 4, 2022
A user, group, role and permission management for Codeigniter 4

CI4-Auth CI4-Auth is a user, group, role and permission management library for Codeigniter 4. CI4-Auth is based on the great Myth-Auth library for Cod

George Lewe 15 Dec 16, 2022
Dynamic ACL is a package that handles Access Control Level on your Laravel Application.

Dynamic ACL Dynamic ACL is a package that handles Access Control Level on your Laravel Application. It's fast to running and simple to use. Install an

yasin 8 Jul 31, 2022
Register ,Login , Logout , having access control

Helo what's up dude read by the name of creator lov3yp :D This script is inspired by Lov3yp#2018 And Burak karahan Installation steps: !- Import the s

Lov3yp 2 Nov 1, 2021
EvaOAuth provides a standard interface for OAuth1.0(a) / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few lines code.

EvaOAuth EvaOAuth provides a standard interface for OAuth1.0 / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few

AlloVince 256 Nov 16, 2022
EvaOAuth provides a standard interface for OAuth1.0(a) / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few lines code.

EvaOAuth EvaOAuth provides a standard interface for OAuth1.0 / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few

AlloVince 261 Jan 17, 2022
Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system.

Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system. Built on Bootstrap 4.

Jeremy Kenedy 2.8k Dec 31, 2022
Middleware to generate access logs for each request using the Apache's access log format

Middleware to generate access logs for each request using the Apache's access log format. This middleware requires a Psr log implementation, for example monolog.

Middlewares 20 Jun 23, 2022
Role-based Permissions for Laravel 5

ENTRUST (Laravel 5 Package) Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5. If you are looking for the Laravel 4 ve

Zizaco 6.1k Jan 5, 2023
Light-weight role-based permissions system for Laravel 6+ built in Auth system.

Kodeine/Laravel-ACL Laravel ACL adds role based permissions to built in Auth System of Laravel 8.0+. ACL middleware protects routes and even crud cont

Kodeine 781 Dec 15, 2022
A Powerful package for handling roles and permissions in Laravel with GUI.

Laravel Roles A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0, and 8.0+. Tab

Jeremy Kenedy 827 Jan 1, 2023
A framework agnostic authentication & authorization system.

Sentinel Sentinel is a PHP 7.3+ framework agnostic fully-featured authentication & authorization system. It also provides additional features such as

Cartalyst 1.4k Dec 30, 2022