comparison Lib/IMPL/Web/Application/CustomResourceContract.pm @ 330:fe725fad2d90

Added access checking to web resources
author sergey
date Tue, 04 Jun 2013 19:25:54 +0400
parents 4abda21186cd
children 2ff1726c066c
comparison
equal deleted inserted replaced
329:50ff1595bd62 330:fe725fad2d90
21 ); 21 );
22 22
23 sub CTOR { 23 sub CTOR {
24 my ($this) = @_; 24 my ($this) = @_;
25 25
26 $this->verbs->{options} = OperationContract->new( binding => \&_HttpOptionsBinding ); 26 $this->verbs->{options} ||= OperationContract->new( binding => \&_HttpOptionsBinding );
27 27
28 while(my ($verb,$methodName) = each %RESOURCE_BINDINGS) { 28 while(my ($verb,$methodName) = each %RESOURCE_BINDINGS) {
29 $this->verbs->{lc($verb)} = OperationContract->new ( 29 $this->verbs->{lc($verb)} ||= OperationContract->new (
30 binding => sub { 30 binding => sub {
31 my ($resource,$action) = @_; 31 my ($resource,$action) = @_;
32 32
33 if (eval { $resource->can($methodName) }) { 33 if (eval { $resource->can($methodName) }) {
34 return $resource->$methodName($action); 34 return $resource->$methodName($action);