[Catalyst] user maintenance

Matt S Trout dbix-class at trout.me.uk
Mon Sep 3 20:27:54 GMT 2007


On Fri, Aug 31, 2007 at 03:05:46PM -0700, Michael Higgins wrote:
> Hello, list --
> 
> I have a catalyst app about to get a bunch of new users. In
> anticipation of that, I'd like advice on how to maintain the
> user/acl tables I set up per the tutorial.
> 
> Basically, I just want to add the user and have a default role
> automagically appear in the corresponding acl table. When I delete the
> user, the user's role(s) go as well.

in MyApp::Schema::User -

sub insert {
  my $self = shift;
  my $ret = $self->next::method(@_);
  $self->add_to_roles(
    $self->result_source->schema->resultset('Role')
         ->find({ name => 'User' })
  );
  $ret;
}

(assuming you have a 'roles' many-many set up)

The delete should happen automatically.

For more questions, please ask the DBIx::Class list - Catalyst doesn't really
need to get involved with this logic at all.

> Which of the catalyst options would give me the quickest route to
> maintaining this list? And what is the best way to ... create
> related entries and cascade delete? (I'm still new at this.)
> 
> Is there some recommended way? What do other folks do? 
> 
> Cheers,
> 
> -- 
>  |\  /|        |   |          ~ ~  
>  | \/ |        |---|          `|` ?
>  |    |ichael  |   |iggins    \^ /
>  michael.higgins[at]evolone[dot]org
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the Catalyst mailing list