Restrict who can delete what under what circumstances.
git-svn-id: svn://10.0.0.236/trunk@215234 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a283139c51
commit
305e456910
@ -1339,8 +1339,14 @@ Returns true if the logged in user has rights to delete this test case.
|
||||
|
||||
sub candelete {
|
||||
my $self = shift;
|
||||
return $self->canedit && Param("allow-test-deletion")
|
||||
&& (Bugzilla->user->id == $self->author->id || Bugzilla->user->in_group('admin'));
|
||||
return 0 unless ($self->canedit && Param("allow-test-deletion"));
|
||||
return 1 if Bugzilla->user->in_group('admin');
|
||||
|
||||
# Allow case author to delete as long as this case does not appear in any runs.
|
||||
return 1 if Bugzilla->user->id == $self->author->id && get_caserun_count == 0;
|
||||
|
||||
# Allow plan author to delete if this case is linked to one plan only.
|
||||
return 1 if scalar(@{$self->plans}) == 1 && Bugzilla->user->id == @{$self->plans}[0]->author->id;
|
||||
}
|
||||
|
||||
###############################
|
||||
|
||||
@ -984,9 +984,8 @@ Returns true if the logged in user has rights to delete this case-run.
|
||||
sub candelete {
|
||||
my $self = shift;
|
||||
|
||||
return ($self->canedit
|
||||
&& Param('allow-test-deletion'));
|
||||
|
||||
return 0 unless $self->canedit && Param('allow-test-deletion');
|
||||
return $self->run->manager->id == Bugzilla->user->id;
|
||||
}
|
||||
|
||||
=head2 obliterate
|
||||
|
||||
@ -889,8 +889,8 @@ Returns true if the logged in user has rights to delete this plan
|
||||
|
||||
sub candelete {
|
||||
my $self = shift;
|
||||
return $self->canedit && Param("allow-test-deletion")
|
||||
&& (Bugzilla->user->id == $self->author->id || Bugzilla->user->in_group('admin'));
|
||||
return 0 unless $self->canedit && Param("allow-test-deletion");
|
||||
return (Bugzilla->user->id == $self->author->id || Bugzilla->user->in_group('admin'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -749,8 +749,10 @@ Returns true if the logged in user has rights to delete this test run.
|
||||
|
||||
sub candelete {
|
||||
my $self = shift;
|
||||
return $self->canedit && Param('allow-test-deletion')
|
||||
&& (Bugzilla->user->id == $self->manager->id || Bugzilla->user->in_group('admin'));
|
||||
return 0 unless $self->canedit && Param('allow-test-deletion');
|
||||
return (Bugzilla->user->id == $self->manager->id
|
||||
|| Bugzilla->user->id == $self->plan->author->id
|
||||
|| Bugzilla->user->in_group('admin'));
|
||||
}
|
||||
|
||||
###############################
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user