# HG changeset patch # User sourcer # Date 1308598964 -14400 # Node ID 068acfe903c3a1b6e082b0fdf29ef760a570f89f # Parent 59e5fcb59d864845b2d813a9ca6713a2a1afde30 corrected schema resolution mechanism diff -r 59e5fcb59d86 -r 068acfe903c3 Lib/IMPL/Security.pm --- a/Lib/IMPL/Security.pm Mon Jun 06 03:30:36 2011 +0400 +++ b/Lib/IMPL/Security.pm Mon Jun 20 23:42:44 2011 +0400 @@ -11,7 +11,7 @@ sub AccessCheck { my ($self, $object, $desiredAccess, $context) = @_; - $context = IMPL::Security::Context->contextCurrent; + $context ||= IMPL::Security::Context->contextCurrent; $_->() or return 0 foreach @{$self->Rules}; diff -r 59e5fcb59d86 -r 068acfe903c3 Lib/IMPL/Security/Role.pm --- a/Lib/IMPL/Security/Role.pm Mon Jun 06 03:30:36 2011 +0400 +++ b/Lib/IMPL/Security/Role.pm Mon Jun 20 23:42:44 2011 +0400 @@ -65,7 +65,7 @@ Проверяет наличие ролей указанных ролей из списка @roles_list. Допускается использование как самих объектов, так и имен ролей. -Возвращает 0 в случае неудачи, 1 при наличии необходимых ролей +Возвращает 0 в случае неудачи (хотябы одна роль не была удовлетворена), 1 при наличии необходимых ролей. =back diff -r 59e5fcb59d86 -r 068acfe903c3 Lib/IMPL/Web/Application/ControllerUnit.pm --- a/Lib/IMPL/Web/Application/ControllerUnit.pm Mon Jun 06 03:30:36 2011 +0400 +++ b/Lib/IMPL/Web/Application/ControllerUnit.pm Mon Jun 20 23:42:44 2011 +0400 @@ -57,6 +57,7 @@ } $info->{wrapper} = 'TransactionWrapper'; + $info->{method} ||= $method; $self->class_data(CONTROLLER_METHODS)->{$method} = $info; } } @@ -69,10 +70,12 @@ if ( not ref $info ) { $self->class_data(CONTROLLER_METHODS)->{$method} = { wrapper => 'FormWrapper', - schema => $info + schema => $info, + method => $method }; } elsif (ref $info eq 'HASH') { $info->{wrapper} = 'FormWrapper'; + $info->{method} ||= $method; $self->class_data(CONTROLLER_METHODS)->{$method} = $info; } else { @@ -129,7 +132,8 @@ my ($self,$method,$action,$methodInfo) = @_; my $unit = $self->new($action); - return $unit->$method($unit->MakeParams($methodInfo)); + my $handler = $methodInfo->{method}; + return $unit->$handler($unit->MakeParams($methodInfo)); } sub FormWrapper { @@ -150,6 +154,8 @@ $form ); + my $handler = $methodInfo->{method}; + $result{formName} = $form; $result{formSchema} = $schema; @@ -163,7 +169,7 @@ my $unit = $self->new($action,\%result); eval { - $result{result} = $unit->$method($unit->MakeParams($methodInfo)); + $result{result} = $unit->$handler($unit->MakeParams($methodInfo)); }; if (my $err = $@) { $result{state} = STATE_INVALID; @@ -182,7 +188,8 @@ $result{formData} = $transform->Transform($action->query); } - $result{formErrors} = $transform->Errors->as_list; + # ignore errors for new forms + #$result{formErrors} = $transform->Errors->as_list; $result{state} = STATE_NEW; }