[Catalyst] Customizing Authentication/Roles

Matt S Trout dbix-class at trout.me.uk
Wed Sep 13 11:43:22 CEST 2006


Christopher H. Laco wrote:
> Matt S Trout wrote:
>   
>> Christopher H. Laco wrote:
>>     
>>> As I start laying out the framework for Mango, one of the things I want
>>> to do is use roles on a virtual 'per site' basis; within the same cat
>>> app.
>>>
>>> From a table standpoint, that is roughly:
>>>
>>>     sites:
>>>         id, name
>>>
>>>     users
>>>         id, username, password
>>>
>>>     roles
>>>         id, site_id, name
>>>
>>>     users_roles
>>>         site_id, user_id, role_id
>>>
>>> When a user logs in, they may have different roles for different sites.
>>> Maybe they're an admin for one site, but only a publisher for another.
>>> Two sites maybe have the same role name, which means the stock ROles
>>> stuffs in Auth isn't going to cut it.
>>>
>>> I want to reuse as much of what exists as possible from Auth/Roles, but
>>> I haven't a clue on what direction to start making changes.
>>>
>>> Any ideas on how you would do this?
>>>       
>> Multiple site instances.
>>
>> See Dave Kamholz (ningu)'s branch.
>>
>>     
>
> Sigh.
>
> app_context_split?   Age: 2 months
>
>
> No thanks. If it's not release, it doesn't exist for this project.
>   
It can be made release, it just needs testing before it becomes so.

Alternatively, you could point the user and role models at custom ones 
with an ACCEPT_CONTEXT that applies ->search({ site_id => 
$current_site_id }) based on the request.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +




More information about the Catalyst mailing list