[Dbix-class] [ANNOUNCE] DBIx::Class::Schema::RestrictWithObject

Guillermo Roditi groditi at gmail.com
Sat May 19 23:04:27 GMT 2007


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 r=
ule
   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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070519/e6d=
b8998/attachment.htm


More information about the Dbix-class mailing list