add member proxy for new key + unset value
[scpubgit/DX.git] / lib / DX / ActionPolicy / LockScope.pm
CommitLineData
3e465d5d 1package DX::ActionPolicy::LockScope;
2
3use DX::Class;
4
5with 'DX::Role::ActionPolicy';
6
7has lock_to_depth => (is => 'ro', required => 1);
8
9has next_policy => (is => 'ro', required => 1);
10
11sub allows {
12 my ($self, $action) = @_;
13 my $first = $action->target_path->[0];
14 return 0 unless $first =~ /^(\d+)$/ and $first > $self->lock_to_depth;
15 return $self->next_policy->allows($action);
16}
17
181;