I've thought about this a bit, and there are a couple of ways to deal with it.
The simplest I can think of is to add a project_id column to the permissions table. Let it default to NULL, which means that if a permission is set then it applies across all projects the user has access to. The project_id could either be a real association to a project, or just a yaml encoded list of valid projects. Then you need to override the authorization functions to use this value as well, so your calls might look like. link_if_authorized 'action', :controller=>'cont', :action=>'action', :project=>proj.id You would also need to set up the permission entries view to handle multiple projects for assignment. This could get really messy, or you could have an admin view on a per project basis. On Thursday, April 20, 2006, at 12:15 PM, Paul Robinson wrote: >OK, I've not seen anything out there on this, but maybe you guys can >make a suggestion. > >I have Users, and they of course have Roles. However, the Roles they >have are not global, they are only in place for certain Projects. >There are some Roles that are generic - e.g. a 'General User' role >applies to all Users, irrespective of Project > >So, a user might be a 'Manager' for one project and a 'Designer' on >another project. > >I need to be able to simply manage this process and over-ride stuff >in lib like link_if_authorized. > >I have spent two days writing code, it's an absolute mess, and I >think it's because I'm not thinking clearly about how to handle what >is in effect a 3-way HABTM relationship: Projects HABTM Users, Users >HABTM Roles, Roles HABTM Projects. > >As a result, I'm not going to paste any code here - just curious if >anybody has any ideas about how they would approach this to help me >clear my head. > >-- >Paul Robinson > > >_______________________________________________ >engine-users mailing list >[email protected] >http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox. _______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
