Mercurial > pub > Impl
diff Lib/IMPL/Web/Application/ResourceContract.pm @ 330:fe725fad2d90
Added access checking to web resources
author | sergey |
---|---|
date | Tue, 04 Jun 2013 19:25:54 +0400 |
parents | 673581380e79 |
children | 2ff1726c066c |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/ResourceContract.pm Mon Jun 03 18:03:54 2013 +0400 +++ b/Lib/IMPL/Web/Application/ResourceContract.pm Tue Jun 04 19:25:54 2013 +0400 @@ -8,7 +8,9 @@ Exception => 'IMPL::Exception', ArgumentException => '-IMPL::ArgumentException', KeyNotFoundException => '-IMPL::KeyNotFoundException', - ResourceClass => 'IMPL::Web::Application::Resource' + ResourceClass => 'IMPL::Web::Application::CustomResource', + CustomContract => 'IMPL::Web::Application::CustomResourceContract', + Factory => 'IMPL::Object::Factory' }, base => [ 'IMPL::Object' => undef ], props => [ @@ -23,10 +25,9 @@ my $this = shift; my %args = @_; - $this->resourceFactory( $args{resourceFactory} || ResourceClass ); - - my $resources = $args{resources} || []; - my $verbs = $args{verbs} || {}; + my $factory = delete $args{resourceFactory} || ResourceClass; + my $resources = delete $args{resources} || []; + my $verbs = delete $args{verbs} || {}; die ArgumentException->new( resources => 'resources parameter must be a reference to an array' ) @@ -57,6 +58,8 @@ } $this->_namedResources( \%nameMap ); + + $this->resourceFactory( %args ? Factory->new($factory,\%args) : $factory ); } sub AddChildResourceContract {