Yii 2.0: yii2-user-management

User management module for Yii 2
27 followers

User management module for Yii 2

Perks

  • User management
  • RBAC (roles, permissions and stuff) with web interface
  • Registration, authorization, password recovery and so on
  • Visit log
  • Optimised (zero DB queries during usual user workflow)
  • Nice widgets like GhostMenu or GhostHtml::a where elements are visible only if user has access to route where they point

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist webvimark/module-user-management "*"

or add

"webvimark/module-user-management": "*"

to the require section of your composer.json file.

Configuration and stuff on the project page

https://github.com/webvimark/user-management

P.S. because syntax here differs from github and I'm to lazy to rewrite it

Plan

This is development version, so to make it production I need to do:

  1. Refactoring, refactoring and more refactoring
  2. Automated tests
  3. Integration with social networks

Bug reports and feedback

Either on github or forum

Total 12 comments

#19940 report it
alren at 2016/09/05 02:49am
how can i install and use module

Hi, i try your tutorial about installaiton and usage in your github account step by step. i ran the command and it works. "composer require --prefer-dist webvimark/module-user-management 1.0.7"

i add the your code in my config/web.php file

'components'=>[
    'user' => [
        'class' => 'webvimark\modules\UserManagement\components\UserConfig',
 
        // Comment this if you don't want to record user logins
        'on afterLogin' => function($event) {
                \webvimark\modules\UserManagement\models\UserVisitLog::newVisitor($event->identity->id);
            }
    ],
],
 
'modules'=>[
    'user-management' => [
        'class' => 'webvimark\modules\UserManagement\UserManagementModule',
 
        // 'enableRegistration' => true,
 
        // Here you can set your handler to change layout for any controller or action
        // Tip: you can use this event in any module
        'on beforeAction'=>function(yii\base\ActionEvent $event) {
                if ( $event->action->uniqueId == 'user-management/auth/login' )
                {
                    $event->action->controller->layout = 'loginLayout.php';
                };
            },
    ],
],

and i add the your code in my config/console.php

'modules'=>[
    'user-management' => [
        'class' => 'webvimark\modules\UserManagement\UserManagementModule',
            'controllerNamespace'=>'vendor\webvimark\modules\UserManagement\controllers', // To prevent yii help from crashing
    ],
],

but i try to run the command step 3 "./yii migrate --migrationPath=vendor/webvimark/module-user-management/migrations/"

i take a error "Migration failed.Directory specified in migrationPATh doesn't exist: cendor/webvimark/module-user-management/migrations/"

but i still go step 4 and i add in sitecontroller.php

public function behaviors()
{
    return [
        'ghost-access'=> [
            'class' => 'webvimark\modules\UserManagement\components\GhostAccessControl',
        ],
    ];
}

i try to connect my page, i take error "Class webvimark\modules\UserManagement\components\UserConfig does not exist"

i use ubuntu16. there are 3 webvimark directory in /home/ubuntu16/vendor/webvimark/ and /var/www/html/proje2/vendor/UserManagement and /var/www/html/proje2/vendor/webvimark/

what should i do?

Thanks.

#19800 report it
saebaryo at 2016/03/13 04:58pm
Re: fa icon not showing

try to set

'encodeLabels' => false,

under your Nav::widget()

#19738 report it
Daniel at 2016/01/14 01:54am
fa icon not showing

Hi,

I am using kartik yii-practical as base, and I can make this extension works!

However, I see that the icons for backend routes, which are fa icons are not showing.

Any help?

#19638 report it
Commun at 2015/10/26 03:12pm
Adding fields to the database table and methods to the model of Yii 2-User Extension

While looking for an extension that will simplify things, I find this yii2-user.dmeroff.ru/docs - Dektrium project and would like to add what are important for me miss in the model and table.

First of all , I have my user table(model) in my database but after passing throught your extension I found it coul really help me but the problem I have is in my table a part from user id, name,email,profile photo(for comment(thumbnail) and profile) and password field I have also gender,telephone number(which the user can use to log in) and my user model has other methods too. how can I handle that using your extension?

Secondly, I want to put the log in view and sign up view at the same time on the main layout(kind of using them as blocks), How can I do that?

Does it support Internationalization?how?

Thanks for the help

#19595 report it
PMP at 2015/09/24 06:13am
Not able to access this

Hello, I done as per read me file. Installed this by composer,added return [ 'ghost-access'=> [ 'class' => 'webvimark\modules\UserManagement\components\GhostAccessControl', ], in site controller.

echo GhostMenu::widget([ 'encodeLabels'=>false, 'activateParents'=>true, 'items' => [ [ 'label' => 'Backend routes', 'items'=>UserManagementModule::menuItems() ], [ 'label' => 'Frontend routes', 'items'=>[ ['label'=>'Login', 'url'=>['/user-management/auth/login']], ['label'=>'Logout', 'url'=>['/user-management/auth/logout']], ], ], ], ]); on login action

i checked in database, tables are created and in User table, superadmin user is present as user.

but when i go to login page , it gives me error of Getting unknown property: yii\web\User::isSuperadmin

what I have missed here? I am using Basic template

#19540 report it
sganz at 2015/08/27 11:17am
Great Module!

Running this on a simple 'Basic' template App and was up in running very quickly. Simple interface and nice easy integration.

Sandy

#19169 report it
MGHollander at 2015/04/03 09:50am
cannot login as superadmin solution

I had the same issue as rhigel. The solution was simple. I'm using the yii2-advanced template as base and in the backend/config/main.php and frontend/config/main.php I commented the following lines:

'user' => [
    'identityClass' => 'common\models\User',
    'enableAutoLogin' => true,
],

After that it worked for me.

#19166 report it
rhigel at 2015/04/02 04:30pm
cannot login as superadmin

i use yii2 advance. migration works. and i change SiteController into :

public function behaviors()
    {
        return [
            'ghost-access'=> [
                    'class' => 'webvimark\modules\UserManagement\components\GhostAccessControl',
            ],            
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

i can not login into application. in the debug mode i found "SELECT * FROM user WHERE (id=1) AND (status=10)". why status is 10 and not 1. and how to fix this.

thank you.

#19068 report it
Vimark at 2015/03/07 04:41pm
Re: Error when using SQL Server

By default they are disabled (no permissions for them)

You have to add them to "commonPermission" - http://yoursite.com/user-management/permission/index

#19066 report it
Natalis at 2015/03/07 11:00am
Error when using SQL Server

Thank you Vimark

I have tried to connect with mysql database migration works. So I decided to create the tables manually in SQL server by converting the mysql script, the module appeared to work.

Now the links "Password Recovery" and "Registration" are redirecting me to the home page even if I try them accessing as a guest.

#19064 report it
Vimark at 2015/03/07 05:00am
Re: Error when using SQL Server

I guess it's because there are safeUp in migrations (which is also triggering transaction).

I'll fix it when I'll be near computer.

But have to warn you that this module is not fully compatible with Yii2 advanced template and has never been tested with it

#19063 report it
Natalis at 2015/03/07 04:46am
Error when using SQL Server

Thank you for the nice module I have tried to install in Yii2 advanced template, connected with SQL server, and the driver am using is sqlsrv.

I getting the following error when I run migration "Microsoft ODBC Driver 11 Exception for SQL server Transaction that was started in MARS batch is still active at the end of the batch. Transaction is rolled back "

Is there any one who has encountered a similar error?

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet