Edit search was not working.

Check that we have at least one admin in a plan.


git-svn-id: svn://10.0.0.236/trunk@253366 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com 2008-08-04 19:12:25 +00:00
parent fa380687ab
commit bd5601f1c4
3 changed files with 26 additions and 9 deletions

View File

@ -1098,6 +1098,21 @@ sub access_list {
return $self->{'access_list'};
}
sub has_admin {
my ($self, $deleted) = @_;
my $dbh = Bugzilla->dbh;
my $ref = $dbh->selectcol_arrayref(
"SELECT userid
FROM test_plan_permissions
WHERE plan_id = ?
AND userid != ?
AND permissions >= ?",undef,
$self->id, $deleted, TR_ADMIN);
return scalar @$ref;
}
=head2 attachments
Returns a reference to a list of attachments on this plan

View File

@ -551,16 +551,17 @@ Ext.extend(ReportGrid, Ext.grid.GridPanel, {
var q = r.get('query');
var type;
type = q.match(/tr_list_(run|case|plan|caserun)s/);
if (!type){
if (!type) {
type = q.match(/tr_(run|case|plan|caserun)_reports/);
}
else {
Ext.Msg.show({
title: "Non-editable",
text: "This Search or Report cannot be edited",
icon: Ext.MessageBox.ERROR
});
return;
if (!type) {
Ext.Msg.show({
title: "Non-editable",
msg: "This Search or Report cannot be edited",
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
return;
}
}
type = type[1];

View File

@ -87,6 +87,7 @@ elsif ($action eq 'delete'){
detaint_natural($userid);
my $user = Bugzilla::User->new($userid);
ThrowUserError('baduser') unless $user;
ThrowUserError('testopia-no-admins') unless $plan->has_admin($user->id) > 0;
$plan->remove_tester($user->id);
print "{success: true, action: 'Removed User', value: '" . $user->login ."'}";
exit;