PerlDancer / Dancer2-Plugin-Auth-Extensible

Extensible authentication framework for Dancer2 apps
9 stars 20 forks source link

More Tools for handling roles #49

Open jacoby opened 8 years ago

jacoby commented 8 years ago

I'm just starting my dive into Dancer, and for my lab's purposes, I'm seeing a heavy use of roles. I'm happy to see things like _requirerole and _require_anyrole, and _user_hasrole and _userroles will be very useful as well.

But I'm wanting to have the tools for handing account creation within the app, and while _updateuser seems to have most of the data points of a user handled, I am not seeing and cannot think through how to add a user role without rolling my own insert, and that sort of thing is what we're using DBIx::Class to avoid, isn't it?

So, I would like, along with _user_hasrole and _userroles, _add_userrole and _remove_userrole, hopefully working something like:

add_user_role 'bofh' , 'admin' ;
remove_user_role 'pfy' , 'helpdesk' ;

I am using the suggested users, roles, and user_roles tables.

SysPete commented 8 years ago

@jacoby thanks for raising this issue: I agree that we need such methods. I'll add these soon (just have some other work to do 1st).