Hi Paul, It's actually pretty easy. Define a many_to_many relationship in your user to your role data.
Then use that instead of your 'has_many' in your Auth config. That's really it. Jay On May 11, 2010, at 2:11 PM, Paul Makepeace wrote: > On Sun, May 9, 2010 at 18:25, Paul Makepeace <[email protected]> wrote: > [snip to the most puzzling stuff] >> Finally, we have our roles via a join: user <-- user_role --> role. It >> seems like role_field is expecting a string but it's here getting an >> integer. Is there anyway of having go further into the role table with >> that integer key and compare on role.role? >> >> We used to use, >> __PACKAGE__->config->{authorization}->{dbic} = { >> role_class => 'DBIC_Readonly::Role', >> role_field => 'role', >> role_rel => 'map_user_role', # DBIx::Class only >> user_role_user_field => 'user', >> }; >> >> Now, >> __PACKAGE__->config->{authentication} = { >> default_realm => 'members', >> realms => { >> members => { >> credential => { >> class => 'Password', >> password_field => 'password', >> password_type => 'clear', >> }, >> store => { >> class => 'DBIx::Class', >> user_model => 'DBIC_Readonly::User', >> role_relation => 'map_user_role', >> role_field => 'role', >> }, >> }, >> }, >> }; >> >> with, (unchanged), >> User.pm, >> __PACKAGE__->has_many(map_user_role => 'IDL::Schema::UserRole' => 'user'); > > Anyone have an idea here? Any more info I can provide? I'm assuming > this isn't a functional regression but I'm at a loss what to do here. > I could change user_role to have strings instead of an FK to role but > would rather not as we lose some protection against bad role > names/data integrity. > > Paul > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
