This morning I shipped off to the CPAN the first version of
DBIX::Class::Schema::RestrictWithObject. Originally hacked by mst as
RestrictByUser, this handy-dandy DBIx::Class::Schema component allows you to
automatically restrict your schemas with an object, meaning that all calls
to resultset() will be intercepted and optionally filtered with a method in
the restricting object. An example of a place where you could use this is a
Catalyst application where you could restrict the schema of logged in users
and automatically restrict their resultsets items that are associated with
them. This example is in the POD. Why is this a plus?

  - Ability to centralize restrictions into one class / file making them
  easier to maintain and locate
  - Less complexity when using data sets. With careful programming you
  can be sure that you will not accidentally expose data by forgetting to
  filter it because it is filtered at the model level.
  - Less clutter in your application because the code to restrict data
  sets is in a different place.
  - Easy switching of restricting objects to support many different rule
  sets. By using  Class::MOP or Moose you could conceivably generate new rule
  sets at runtime. Everyone loves Moose!

Take it for a test drive and if you are not satisfied send me an email and
I'll consider your suggestions.

http://search.cpan.org/~groditi/DBIx-Class-Schema-RestrictWithObject-0.0001/
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to