Updated constants and fixed some syntax errors.
git-svn-id: svn://10.0.0.236/trunk@220679 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -95,10 +95,10 @@ use constant PAUSED => 5;
|
||||
use constant BLOCKED => 6;
|
||||
|
||||
# Test Plan Permissions (bit flags)
|
||||
use constant READ => 1;
|
||||
use constant WRITE => 2;
|
||||
use constant DELETE => 4;
|
||||
use constant ADMIN => 8;
|
||||
use constant TR_READ => 1;
|
||||
use constant TR_WRITE => 2;
|
||||
use constant TR_DELETE => 4;
|
||||
use constant TR_ADMIN => 8;
|
||||
|
||||
use constant REL_AUTHOR => 0;
|
||||
use constant REL_EDITOR => 1;
|
||||
|
||||
@@ -1280,7 +1280,7 @@ sub can_unlink_plan {
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
return 1 if Bugzilla->user->in_group('admin');
|
||||
return 1 if Bugzilla->user->in_group('Testers') && Param("testopia-allow-group-member-deletes");
|
||||
return 1 if $plan->get_user_rights(Bugzilla->user->id) & DELETE;
|
||||
return 1 if $plan->get_user_rights(Bugzilla->user->id) & TR_DELETE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -798,7 +798,7 @@ sub update_tester {
|
||||
my $self = shift;
|
||||
my ($userid, $perms) = @_;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
||||
|
||||
$dbh->do("UPDATE test_plan_permissions SET permissions = ?
|
||||
WHERE userid = ? AND plan_id = ? AND grant_type = ?",
|
||||
undef, ($perms, $userid, $self->id, GRANT_DIRECT));
|
||||
@@ -994,10 +994,10 @@ sub tester_regexp_permissions {
|
||||
WHERE plan_id = ?", undef, $self->id);
|
||||
my $p;
|
||||
|
||||
$p->{'read'} = 1 & $perms;
|
||||
$p->{'write'} = 2 & $perms;
|
||||
$p->{'delete'} = 4 & $perms;
|
||||
$p->{'admin'} = 8 & $perms;
|
||||
$p->{'read'} = $perms >= TR_READ;
|
||||
$p->{'write'} = $perms >= TR_WRITE;
|
||||
$p->{'delete'} = $perms >= TR_DELETE;
|
||||
$p->{'admin'} = $perms >= TR_ADMIN;
|
||||
|
||||
return $p;
|
||||
}
|
||||
@@ -1015,10 +1015,10 @@ sub access_list {
|
||||
my @rows;
|
||||
foreach my $row (@$ref){
|
||||
push @rows, {'user' => Bugzilla::User->new($row->{'userid'}),
|
||||
'read' => 1 & $row->{'permissions'},
|
||||
'write' => 2 & $row->{'permissions'},
|
||||
'delete' => 4 & $row->{'permissions'},
|
||||
'admin' => 8 & $row->{'permissions'},
|
||||
'read' => $row->{'permissions'} >= TR_READ,
|
||||
'write' => $row->{'permissions'} >= TR_WRITE,
|
||||
'delete' => $row->{'permissions'} >= TR_DELETE,
|
||||
'admin' => $row->{'permissions'} >= TR_ADMIN,
|
||||
};
|
||||
}
|
||||
$self->{'access_list'} = \@rows;
|
||||
|
||||
@@ -46,7 +46,7 @@ use strict;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::User;
|
||||
use Bugzilla::Constants;
|
||||
use Bugzilla::Testopia::Constants
|
||||
use Bugzilla::Testopia::Constants;
|
||||
use Bugzilla::Config;
|
||||
use Bugzilla::Testopia::Environment;
|
||||
use Bugzilla::Bug;
|
||||
|
||||
@@ -27,7 +27,9 @@ This page allows plan managers to permit access to a test plan. By default, memb
|
||||
<b>Testers</b> group in Bugzilla will have read and write access. Beyond this, users login names
|
||||
(email addresses) that match a given regular expression will be granted the level of permissions
|
||||
specified. Lastly, individuals can be granted additional permissions by adding them
|
||||
explicitly.
|
||||
explicitly. In other words, you cannot remove permissions from a user explicitily that has those rights
|
||||
by virtue of membership in the Testers group or that matches the regular expression, although you can add
|
||||
additional rights.
|
||||
</p>
|
||||
<p>
|
||||
Delete and Admin rights are always handled by the access control list, unless the
|
||||
|
||||
@@ -24,6 +24,7 @@ use lib ".";
|
||||
|
||||
use Bugzilla;
|
||||
use Bugzilla::Constants;
|
||||
use Bugzilla::Testopia::Constants;
|
||||
use Bugzilla::Error;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::Testopia::Util;
|
||||
@@ -74,7 +75,8 @@ elsif ($action eq 'Add User'){
|
||||
$perms |= TR_WRITE if $cgi->param("nw");
|
||||
$perms |= TR_DELETE if $cgi->param("nd");
|
||||
$perms |= TR_ADMIN if $cgi->param("na");
|
||||
|
||||
|
||||
detaint_natural($perms);
|
||||
$plan->add_tester($userid, $perms);
|
||||
|
||||
display();
|
||||
@@ -109,6 +111,7 @@ sub do_update {
|
||||
$regexp_perms |= TR_DELETE if $cgi->param('pd');
|
||||
$regexp_perms |= TR_ADMIN if $cgi->param('pa');
|
||||
|
||||
detaint_natural($regexp_perms);
|
||||
$plan->set_tester_regexp($tester_regexp, $regexp_perms);
|
||||
|
||||
foreach my $row (@{$plan->access_list}){
|
||||
@@ -121,6 +124,7 @@ sub do_update {
|
||||
$perms |= TR_DELETE if $cgi->param('d'.$row->{'user'}->id);
|
||||
$perms |= TR_ADMIN if $cgi->param('a'.$row->{'user'}->id);
|
||||
|
||||
detaint_natural($perms);
|
||||
$plan->update_tester($row->{'user'}->id, $perms);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user