Changeset c59673ce8cf87c677db5c213f954df35ddbd7916

Show
Ignore:
Timestamp:
12/05/09 21:44:50 (9 months ago)
Author:
Stephen Bennett <spb@…>
Parents:
712bdf504027850e862f3ebd95bd8073771ca78f
Children:
60a55516fee8adb94bfd6ea006f91c9d2978b652
git-committer:
Stephen Bennett <spb@exherbo.org> / 2009-12-05T21:44:50Z+0000
Message:

Add role-based authorisation to the GMS authentication plugin, and add the relevant DBIC result classes that this requires.

Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • Makefile.PL

    r9d997c9 rc59673c  
    1010requires 'Catalyst::Plugin::ConfigLoader'; 
    1111requires 'Catalyst::Plugin::Static::Simple'; 
     12requires 'Catalyst::Plugin::Authentication'; 
     13requires 'Catalyst::Plugin::Authorization::Roles'; 
    1214requires 'Catalyst::Action::RenderView'; 
    1315requires 'Catalyst::View::TT'; 
  • lib/GMS/Authentication/User.pm

    r6112a5a rc59673c  
    2424 
    2525sub supported_features { 
    26     return { session => 1 }; 
     26    return { session => 1, roles => 1 }; 
    2727} 
    2828 
     
    5151} 
    5252 
     53sub roles { 
     54    my ($self) = @_; 
     55    #return $self->{_account}->roles; 
     56    my @ret; 
     57    foreach my $role ($self->{_account}->roles) { 
     58        push @ret, $role->name; 
     59    } 
     60    return @ret; 
     61} 
     62 
    53631; 
  • lib/GMS/Schema/Result/Account.pm

    r71bc43c rc59673c  
    1111__PACKAGE__->might_have('contact', 'GMS::Schema::Result::Contact', 'account_id'); 
    1212 
     13__PACKAGE__->has_many(user_roles => 'GMS::Schema::Result::UserRole', 'account_id'); 
     14__PACKAGE__->many_to_many(roles => 'user_roles', 'role'); 
     15 
    13161; 
    14  
    15  
  • lib/GMS/Web.pm

    r67960fe rc59673c  
    2222 
    2323                Authentication 
     24                Authorization::Roles 
    2425 
    2526                Session