Currently what is best module to manage users?


(Pellicanipasquale) #1

There’s so much confusion, so many modules that seem dead and I thought about creating this thread, thanks


(Softark) #2

Hi @paskuale,

This is just my personal opinion, but my answer is there’s none.

The user management is really a must have functionality in almost all web application. But at the same time the business requirement regarding user management differs from app to app. So it’s quite difficult to find an extension that satisfies the exact needs of a specific app. Sometimes it’s too bloated for your app, and sometimes it lacks the critical functionality to your app.

Meanwhile, yii lets you write your own user management module quite easily with the concept of UserIdentity interface. You can create a table for the users with any attribute you want it to have. And gii will create a CRUD skeleton for it that is ready to be customized. Usually this process is rather easier and more satisfying than adopting some third party extension.


(Pellicanipasquale) #3

So I look for some examples of using this UserIdentity, thanks


(Softark) #4

You can see User model in yii2-app-basic. This is the simplest example that implements UserIdentity interface. Unfortunately it’s not suitable for user management in an ordinary web app, because it is not backed by a db table.

You can see much more practical an example in yii2-app-advanced template, which is User ActiveRecord model that implements UserIdentity interface. It also supports ‘registration’, ‘confirmation via email’, ‘forgot password’, … etc.

I usually start from yii2-app-basic, not from yii2-app-advanced, because the former is more practical than the latter as a whole.

This is what I would usually do regarding the user management:

  1. Install yii2-app-basic.
  2. Remove the built-in User model.
  3. Create some user table in my db.
    I use the migrations in yii2-app-advanced as the skeleton which I customize to suits my business requirements.
  4. Generate new User model using gii.
  5. Modify the new User model to implement UserIdentity interface.
  6. Transplant some useful models, views, forms and controller actions from yii2-app-advanced to implement necessary functionalities.

And …

  1. Add mdmsoft\yii2-admin extension to support ACF and RBAC.
  2. Construct RBAC hierarchy using migration.
  3. Create web UI to manage User model.
    Basically it is created by gii’s CRUD generator. But some extra coding is needed to implement the “Role Assignment” functionality for the users.

Implementing authentication and authorization is not a trivial thing and I always spend a lot of time for it.:sweat_smile:


(Pellicanipasquale) #5

Thanks for who work with advanced instead? Any solution?


(Softark) #6

I’m sorry, but I don’t understand what you want to ask.
Please try to be more specific about what you want for you app, then someone may be able to suggest a solution.


(Robertwent) #7

For a general purpose solution with admin gui, I would take a look at https://github.com/2amigos/yii2-usuario

It’s based on a previously popular extension which is no longer in active development.

It works with the advanced starter template and you can separate the users from the admin or front-end or keep them as one.

You get login, register, forgotten password functionality and editable templates out of the box.


(Pellicanipasquale) #8

yii2-app-advanced.


(Pellicanipasquale) #9

so the project is valid? He seemed forgotten by everyone…


(Ross Addison) #10

sjaakp/yii2-pluto excellent. RBAC. Dropped the other two you mentioned. No problems as yet. Integrates really well with yii2 advanced template. Deserves a lot more stars! He has followed up with improvements that I have suggested on GitHub.


(Robertwent) #11

I have got the impression in the past that the best way to do this is to write your own code with the built in rbac.
I generally just build little apps with a couple of users so this works for me as it lets me edit in an admin area without having to write everything to do it.
I’ve not tries the recently suggested yii2-pluto


(Robertwent) #12

yii2-pluto also looks very new and has no commits for 4 months and 14 in total.
So I would give it a miss for now.