Cleaned up error messages
git-svn-id: svn://10.0.0.236/trunk@221916 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -570,6 +570,18 @@ sub plans {
|
||||
return $self->{'plans'};
|
||||
}
|
||||
|
||||
=head2 type
|
||||
|
||||
Returns 'attachment'
|
||||
|
||||
=cut
|
||||
|
||||
sub type {
|
||||
my $self = shift;
|
||||
$self->{'type'} = 'attachment';
|
||||
return $self->{'type'};
|
||||
}
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Bugzilla::Attachment
|
||||
|
||||
@@ -203,7 +203,9 @@ sub elements_to_json {
|
||||
$json .= '{title:"'. $element->{'name'} .'",';
|
||||
$json .= 'objectId:"'. $element->{'element_id'}. '",';
|
||||
$json .= 'widgetId:"element'. $element->{'element_id'} .'",';
|
||||
$json .= 'actionsDisabled:["addCategory","addValue","addChild"],';
|
||||
$json .= 'actionsDisabled:["addCategory","addValue","addChild"';
|
||||
$json .= ',"remove"' unless $self->canedit;
|
||||
$json .= '],';
|
||||
$json .= 'isFolder:true,' if($element->check_for_children || $element->check_for_properties);
|
||||
$json .= 'childIconSrc:"testopia/img/circle.gif"},';
|
||||
}
|
||||
|
||||
@@ -487,6 +487,13 @@ sub obliterate {
|
||||
|
||||
}
|
||||
|
||||
sub canview {
|
||||
my $self = shift;
|
||||
return 1 if ($self->product_id == 0);
|
||||
return 1 if Bugzilla->user->can_see_product($self->product->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub canedit {
|
||||
my $self = shift;
|
||||
if ($self->product_id == 0){
|
||||
|
||||
@@ -432,6 +432,12 @@ sub obliterate {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub canview {
|
||||
my $self = shift;
|
||||
return 1 if $self->get_parent->canview;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub canedit {
|
||||
my $self = shift;
|
||||
return 1 if $self->get_parent->canedit;
|
||||
|
||||
@@ -330,6 +330,13 @@ sub obliterate {
|
||||
|
||||
}
|
||||
|
||||
sub canview {
|
||||
my $self = shift;
|
||||
my $element = Bugzilla::Testopia::Environment::Element->new($self->element_id);
|
||||
return 1 if $element->canview;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub canedit {
|
||||
my $self = shift;
|
||||
my $element = Bugzilla::Testopia::Environment::Element->new($self->element_id);
|
||||
|
||||
@@ -329,7 +329,7 @@ sub init {
|
||||
# TODO: is there a better way to do this?
|
||||
if ($obj eq 'environment'){
|
||||
my @prod_ids;
|
||||
foreach my $p (Bugzilla->user->get_selectable_products){
|
||||
foreach my $p (@{Bugzilla->user->get_selectable_products}){
|
||||
push @prod_ids, $p->id;
|
||||
}
|
||||
my $prod_ids = join(',',@prod_ids);
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
[% IF error == "testopia-permission-denied" %]
|
||||
[% title = "Insufficient Permissions" %]
|
||||
You are not authorized to view this [% object FILTER html %]
|
||||
You are not authorized to view [% object.type FILTER html %] [% object.id FILTER html %]
|
||||
[% ELSIF error == "testopia-read-only" %]
|
||||
[% title = "Insufficient Permissions" %]
|
||||
You are not authorized to edit [% object FILTER html %] [% id FILTER html %]
|
||||
You are not authorized to edit [% object.type FILTER html %] [% object.id FILTER html %]
|
||||
[% ELSIF error == "testopia-no-delete" %]
|
||||
[% title = "Insufficient Permissions" %]
|
||||
You are not authorized to delete [% object.type FILTER html %] [% object.id FILTER html %]
|
||||
You are not authorized to delete [% object.type FILTER html %] [% object.id FILTER html %]
|
||||
[% IF UserInGroup('admin') %]
|
||||
If you are the administrator, you can check that your installation
|
||||
allows deletion of Testopia objects in the
|
||||
|
||||
@@ -59,25 +59,38 @@ values for each of the properties.
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><input name="env_name" id="env_name" value="[% environment.name FILTER html %]" size="40"></td>
|
||||
<td><a href="tr_new_environment.cgi">Create a New Environment</a></td>
|
||||
<td>
|
||||
[% IF user.in_group('Testers') %]
|
||||
<a href="tr_new_environment.cgi">Create a New Environment</a></td>
|
||||
[% END %]
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Product</th>
|
||||
<td>[% PROCESS select sel = {
|
||||
<td>
|
||||
[% IF environment.canedit %]
|
||||
[% PROCESS select sel = {
|
||||
name => 'product_id',
|
||||
list => user.get_selectable_products,
|
||||
default => environment.product_id,
|
||||
accesskey => 'p'} %]
|
||||
[% ELSE %]
|
||||
[% environment.product.name FILTER html %]
|
||||
[% END %]
|
||||
</td>
|
||||
<td><a href="tr_admin_environment.cgi">Edit Environment Variables</a></td>
|
||||
<td>
|
||||
[% IF user.in_group('Testers') %]
|
||||
<a href="tr_admin_environment.cgi">Edit Environment Variables</a></td>
|
||||
[% END %]
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Archive</th><td><input type="checkbox" name="isactive" id="isactive" value="1" [% 'checked="checked"' IF NOT environment.isactive %]></td>
|
||||
[% IF environment.candelete %]
|
||||
<td><a href="tr_show_environment.cgi?env_id=[% environment.id FILTER none %]&action=delete">Delete his Environment</a></td>
|
||||
<td><a href="tr_show_environment.cgi?env_id=[% environment.id FILTER none %]&action=delete">Delete this Environment</a></td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% IF environment.canedit %]
|
||||
<tr>
|
||||
<td colspan=2" align="right"><input type="button" onclick="update()" value="Commit"></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
@@ -189,13 +189,13 @@ dojo.addOnLoad(function() {
|
||||
widgetId="environment[% environment.id %]"
|
||||
objectId="[% environment.id %]"
|
||||
isFolder="[% environment.element_count ? 'true' : 'false' %]"
|
||||
actionsDisabled="edit;move"></div>
|
||||
actionsDisabled="[% 'remove;' UNLESS environment.canedit %]edit;move"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
[% IF environment.canedit %]
|
||||
<td valign="top">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -236,6 +236,7 @@ dojo.addOnLoad(function() {
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
<td align="center"><a href="tr_show_environment.cgi?env_id=[% env.id FILTER none %]">[% env.id FILTER none %]</a></td>
|
||||
<td>[% env.name FILTER none %]</td>
|
||||
<td>[% env.product.name FILTER none %]</td>
|
||||
<td><a href="tr_show_environment.cgi?env_id=[% env.id FILTER none %]&action=[% env.isactive ? 'hide' : 'unhide' %]">[% env.isactive ? 'Archive' : 'Unarchive' %]</a>
|
||||
<td>
|
||||
[% IF env.edit %]
|
||||
<a href="tr_show_environment.cgi?env_id=[% env.id FILTER none %]&action=[% env.isactive ? 'hide' : 'unhide' %]">[% env.isactive ? 'Archive' : 'Unarchive' %]</a>
|
||||
[% END %]
|
||||
[% IF env.candelete %]
|
||||
|
|
||||
<a href="tr_show_environment.cgi?env_id=[% env.id FILTER none %]&action=delete">Delete</a>
|
||||
|
||||
@@ -38,7 +38,7 @@ use vars qw($vars);
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'admin pages'}) unless Bugzilla->user->in_group('admin');
|
||||
ThrowUserError("testopia-read-only") unless Bugzilla->user->in_group('admin');
|
||||
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new({});
|
||||
my $action = $cgi->param('action') || '';
|
||||
|
||||
@@ -52,7 +52,7 @@ use vars qw($vars);
|
||||
|
||||
print $cgi->header;
|
||||
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'environments'}) unless Bugzilla->user->in_group('Testers');
|
||||
ThrowUserError('testopia-permission-denied') unless Bugzilla->user->in_group('Testers');
|
||||
|
||||
my $action = $cgi->param('action') || '';
|
||||
my $env_id = $cgi->param('env_id') || 0;
|
||||
|
||||
@@ -77,7 +77,7 @@ elsif ($caserun_id){
|
||||
##################
|
||||
if ($action eq 'edit'){
|
||||
print $cgi->header;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'Attachment'}) unless $attachment->canedit;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => $attachment}) unless $attachment->canedit;
|
||||
|
||||
$vars->{'attachment'} = $attachment;
|
||||
$vars->{'isviewable'} = $attachment->isViewable($cgi);
|
||||
@@ -87,7 +87,7 @@ if ($action eq 'edit'){
|
||||
}
|
||||
elsif ($action eq 'do_edit') {
|
||||
print $cgi->header;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'Attachment'}) unless $attachment->canedit;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => $attachment}) unless $attachment->canedit;
|
||||
|
||||
my %newvalues = (
|
||||
'description' => $cgi->param('description') || '',
|
||||
@@ -113,7 +113,7 @@ elsif ($action eq 'do_edit') {
|
||||
elsif ($action eq 'remove') {
|
||||
print $cgi->header;
|
||||
ThrowUserError('testopia-missing-parameter', {'param' => 'case_id or plan_id'}) unless $obj;
|
||||
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $obj->canedit;
|
||||
ThrowUserError('testopia-no-delete', {'object' => $attachment}) unless $obj->canedit;
|
||||
$vars->{'attachment'} = $attachment;
|
||||
$vars->{'action'} = 'do_remove';
|
||||
$vars->{'obj'} = $obj;
|
||||
@@ -126,7 +126,7 @@ elsif ($action eq 'do_remove') {
|
||||
print $cgi->header;
|
||||
$vars->{'tr_message'} = "Attachment ". $attachment->description ." deleted";
|
||||
ThrowUserError('testopia-missing-parameter', {'param' => 'case_id or plan_id'}) unless $obj;
|
||||
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $obj->canedit;
|
||||
ThrowUserError('testopia-no-delete', {'object' => $attachment}) unless $obj->canedit;
|
||||
if ($plan_id){
|
||||
$attachment->unlink_plan($plan_id);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ elsif ($action eq 'do_remove') {
|
||||
|
||||
elsif ($action eq 'delete') {
|
||||
print $cgi->header;
|
||||
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
|
||||
ThrowUserError('testopia-no-delete', {'object' => $attachment}) unless $attachment->candelete;
|
||||
$vars->{'attachment'} = $attachment;
|
||||
$vars->{'action'} = 'do_delete';
|
||||
|
||||
@@ -159,7 +159,7 @@ elsif ($action eq 'delete') {
|
||||
elsif ($action eq 'do_delete') {
|
||||
print $cgi->header;
|
||||
$vars->{'tr_message'} = "Attachment ". $attachment->description ." deleted";
|
||||
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
|
||||
ThrowUserError('testopia-no-delete', {'object' => $attachment}) unless $attachment->candelete;
|
||||
|
||||
$attachment->obliterate;
|
||||
$vars->{'tr_message'} = "Attachment deleted";
|
||||
|
||||
@@ -48,7 +48,7 @@ my $product_id = $cgi->param('product_id');
|
||||
|
||||
ThrowUserError("testopia-missing-parameter", {param => "product_id"}) unless $product_id;
|
||||
my $product = Bugzilla::Testopia::Product->new($product_id);
|
||||
ThrowUserError('testopia-read-only', {'object' => 'Build'}) unless $product->canedit;
|
||||
ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit;
|
||||
|
||||
$vars->{'plan_id'} = $cgi->param('plan_id');
|
||||
$vars->{'product'} = $product;
|
||||
|
||||
@@ -48,7 +48,7 @@ my $product_id = $cgi->param('product_id');
|
||||
|
||||
ThrowUserError("testopia-missing-parameter", {param => "product_id"}) unless $product_id;
|
||||
my $product = Bugzilla::Testopia::Product->new($product_id);
|
||||
ThrowUserError('testopia-read-only', {'object' => 'Category'}) unless $product->canedit;
|
||||
ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit;
|
||||
|
||||
$vars->{'plan_id'} = $cgi->param('plan_id');
|
||||
$vars->{'product'} = $product;
|
||||
|
||||
@@ -58,7 +58,8 @@ my $env_id = $cgi->param('env_id');
|
||||
|
||||
#********************************************* UI Logic ************************************************#
|
||||
print $cgi->header;
|
||||
|
||||
my $env = Bugzilla::Testopia::Environment->new($env_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => $env}) unless $env->canview;
|
||||
my $xml = Bugzilla::Testopia::Environment::Xml->export($env_id);
|
||||
if (!defined($xml)) {
|
||||
$vars->{'tr_error'} .= "Exporting XML Environment Failed. Please try again.<BR/>";
|
||||
|
||||
@@ -196,7 +196,7 @@ elsif ($action eq 'Delete Selected'){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($1) if $p =~ $reg;
|
||||
if (($caserun && !$caserun->candelete)){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'});
|
||||
ThrowUserError("testopia-no-delete", {'object' => $caserun});
|
||||
}
|
||||
push @caseruns, $caserun if $caserun;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ if ($type eq 'build_coverage'){
|
||||
|
||||
my $action = $cgi->param('action') || '';
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $plan}) unless $plan->canview;
|
||||
my $report = {};
|
||||
my %buildseen;
|
||||
foreach my $case (@{$plan->test_cases}){
|
||||
@@ -104,7 +104,7 @@ elsif ($type eq 'bugcounts'){
|
||||
}
|
||||
validate_test_id($plan_id, 'plan');
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $plan}) unless $plan->canview;
|
||||
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $ref = $dbh->selectall_arrayref(
|
||||
|
||||
@@ -171,7 +171,7 @@ elsif ($action eq 'do_clone'){
|
||||
|
||||
elsif ($action eq 'Attach'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $case}) unless $case->canedit;
|
||||
|
||||
defined $cgi->upload('data')
|
||||
|| ThrowUserError("file_not_specified");
|
||||
@@ -206,7 +206,7 @@ elsif ($action eq 'Attach'){
|
||||
|
||||
elsif ($action eq 'Commit'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $case}) unless $case->canedit;
|
||||
do_update($case);
|
||||
$vars->{'tr_message'} = "Test case updated";
|
||||
$vars->{'backlink'} = $case;
|
||||
@@ -215,7 +215,7 @@ elsif ($action eq 'Commit'){
|
||||
|
||||
elsif ($action eq 'History'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'case'}) unless $case->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $case}) unless $case->canview;
|
||||
$vars->{'case'} = $case;
|
||||
$vars->{'diff'} = $case->compare_doc_versions($cgi->param('new'),$cgi->param('old'));
|
||||
$vars->{'new'} = $cgi->param('new');
|
||||
@@ -229,7 +229,7 @@ elsif ($action eq 'unlink'){
|
||||
my $plan_id = $cgi->param('plan_id');
|
||||
validate_test_id($plan_id, 'plan');
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case'})
|
||||
ThrowUserError("testopia-read-only", {'object' => $case})
|
||||
unless ($case->can_unlink_plan($plan_id));
|
||||
|
||||
if (scalar @{$case->plans} == 1){
|
||||
@@ -265,7 +265,7 @@ elsif ($action eq 'do_unlink'){
|
||||
|
||||
elsif ($action eq 'detach_bug'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $case}) unless $case->canedit;
|
||||
my @buglist;
|
||||
foreach my $bug (split(/[\s,]+/, $cgi->param('bug_id'))){
|
||||
ValidateBugID($bug);
|
||||
@@ -300,7 +300,7 @@ elsif ($action eq 'do_delete'){
|
||||
####################
|
||||
elsif ($action eq 'addcomponent' || $action eq 'removecomponent'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $case}) unless $case->canedit;
|
||||
my $comp = $cgi->param('component_id');
|
||||
detaint_natural($comp);
|
||||
validate_selection($comp, 'id', 'components');
|
||||
@@ -328,7 +328,7 @@ elsif ($action eq 'addcomponent' || $action eq 'removecomponent'){
|
||||
#TODO: Clean up styles and put them in skins
|
||||
else{
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'case'}) unless $case->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $case}) unless $case->canview;
|
||||
display($case);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ my $action = $cgi->param('action') || '';
|
||||
# For use on the classic form
|
||||
|
||||
if ($action eq 'Commit'){
|
||||
;
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
|
||||
display(do_update($caserun));
|
||||
}
|
||||
@@ -99,7 +98,7 @@ elsif ($action eq 'Attach'){
|
||||
|
||||
elsif ($action eq 'delete'){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
|
||||
ThrowUserError("testopia-no-delete", {'object' => $caserun}) if !$caserun->candelete;
|
||||
ThrowUserError("testopia-no-delete", {'object' => $caserun}) unless $caserun->candelete;
|
||||
$vars->{'title'} = 'Remove Test Case '. $caserun->case->id .' from Run: ' . $caserun->run->summary;
|
||||
$vars->{'bugcount'} = scalar @{$caserun->bugs};
|
||||
$vars->{'form_action'} = 'tr_show_caserun.cgi';
|
||||
@@ -109,7 +108,7 @@ elsif ($action eq 'delete'){
|
||||
}
|
||||
elsif ($action eq 'do_delete'){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
|
||||
ThrowUserError("testopia-no-delete", {'object' => $caserun}) if !$caserun->candelete;
|
||||
ThrowUserError("testopia-no-delete", {'object' => $caserun}) unless $caserun->candelete;
|
||||
$caserun->obliterate;
|
||||
|
||||
# See if there is a saved filter
|
||||
@@ -334,7 +333,7 @@ else {
|
||||
sub do_update {
|
||||
my $caserun = shift;
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) unless $caserun->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $caserun}) unless $caserun->canedit;
|
||||
|
||||
my $status = $cgi->param('status');
|
||||
my $notes = $cgi->param('notes');
|
||||
|
||||
@@ -139,7 +139,7 @@ elsif ($action eq 'getChildren'){
|
||||
|
||||
detaint_natural($id);
|
||||
trick_taint($type);
|
||||
|
||||
print STDERR $type;
|
||||
for ($type){
|
||||
/classification/ && do { get_products($id); };
|
||||
/product/ && do { get_categories($id); };
|
||||
@@ -166,6 +166,10 @@ elsif($action eq 'removeNode'){
|
||||
trick_taint($type);
|
||||
|
||||
my $env = Bugzilla::Testopia::Environment->new($env_id);
|
||||
unless ($env->canedit){
|
||||
print 'false';
|
||||
exit;
|
||||
}
|
||||
$env->delete_element($id);
|
||||
|
||||
print "true";
|
||||
@@ -188,6 +192,7 @@ elsif($action eq 'set_selected'){
|
||||
trick_taint($value);
|
||||
|
||||
my $env = Bugzilla::Testopia::Environment->new($env_id);
|
||||
exit unless $env->canedit;
|
||||
|
||||
my $property = Bugzilla::Testopia::Environment::Property->new($prop_id);
|
||||
my $elmnt_id = $property->element_id();
|
||||
@@ -216,6 +221,10 @@ elsif($action eq 'move'){
|
||||
trick_taint($environment_id);
|
||||
|
||||
my $env = Bugzilla::Testopia::Environment->new($environment_id);
|
||||
unless ($env->canedit){
|
||||
print "false";
|
||||
exit;
|
||||
}
|
||||
$element = Bugzilla::Testopia::Environment::Element->new($element_id);
|
||||
my $properties = $element->get_properties;
|
||||
if (scalar @$properties == 0){
|
||||
@@ -226,11 +235,9 @@ elsif($action eq 'move'){
|
||||
if ($success == 0){print "{error:\"error\"";exit;}
|
||||
}
|
||||
|
||||
print "true";exit;
|
||||
print "true";
|
||||
exit;
|
||||
|
||||
print "{error:\"";
|
||||
print "element_id: ".$element_id."<br>";
|
||||
print "environment_id: ".$environment_id."\"}";
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -245,14 +252,13 @@ sub display {
|
||||
|
||||
if(!defined($env)){
|
||||
my $env = Bugzilla::Testopia::Environment->new({'environment_id' => 0});
|
||||
ThrowUserError("testopia-read-only", {'object' => 'Environment'}) unless $env->canedit;
|
||||
$vars->{'environment'} = $env;
|
||||
$vars->{'action'} = 'do_add';
|
||||
$template->process("testopia/environment/add.html.tmpl", $vars)
|
||||
|| print $template->error();
|
||||
exit;
|
||||
}
|
||||
ThrowUserError('testopia-permission-denied', {object => 'Environment'}) unless $env->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $env}) unless $env->canview;
|
||||
my $category = Bugzilla::Testopia::Environment::Category->new({'id' => 0});
|
||||
if (Param('useclassification')){
|
||||
$vars->{'allhaschild'} = $category->get_all_child_count;
|
||||
@@ -294,7 +300,7 @@ sub get_categories{
|
||||
sub get_category_element_json {
|
||||
my ($id) = (@_);
|
||||
my $category = Bugzilla::Testopia::Environment::Category->new($id);
|
||||
return unless $category->canedit;
|
||||
return unless $category->canview;
|
||||
my $fish = $category->elements_to_json("TRUE");
|
||||
print $fish;
|
||||
}
|
||||
@@ -302,20 +308,21 @@ sub get_category_element_json {
|
||||
sub get_element_children {
|
||||
my ($id) = (@_);
|
||||
my $element = Bugzilla::Testopia::Environment::Element->new($id);
|
||||
return unless $element->canedit;
|
||||
print STDERR $element->canview;
|
||||
return unless $element->canview;
|
||||
print $element->children_to_json(1);
|
||||
}
|
||||
|
||||
sub get_env_elements {
|
||||
my ($id) = (@_);
|
||||
my $env = Bugzilla::Testopia::Environment->new($id);
|
||||
return unless $env->canedit;
|
||||
return unless $env->canview;
|
||||
print $env->elements_to_json(1);
|
||||
}
|
||||
|
||||
sub get_validexp_json {
|
||||
my ($id,$env_id) = (@_);
|
||||
my $property = Bugzilla::Testopia::Environment::Property->new($id);
|
||||
return unless $property->canedit;
|
||||
return unless $property->canview;
|
||||
print $property->valid_exp_to_json(1,$env_id);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ $vars->{'form_action'} = "tr_show_plan.cgi";
|
||||
if ($action eq 'Archive' || $action eq 'Unarchive'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $plan}) unless $plan->canedit;
|
||||
do_update($plan);
|
||||
$vars->{'plan'} = $plan;
|
||||
$plan->toggle_archive(Bugzilla->user->id);
|
||||
@@ -93,7 +93,7 @@ if ($action eq 'Archive' || $action eq 'Unarchive'){
|
||||
#############
|
||||
elsif ($action eq 'Clone'){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless Bugzilla->user->in_group('Testers');
|
||||
ThrowUserError("testopia-create-denied", {'object' => 'plans'}) unless Bugzilla->user->in_group('Testers');
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
do_update($plan);
|
||||
$vars->{'plan'} = $plan;
|
||||
@@ -104,7 +104,7 @@ elsif ($action eq 'Clone'){
|
||||
elsif ($action eq 'do_clone'){
|
||||
unless (Bugzilla->user->in_group('Testers')){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'});
|
||||
ThrowUserError("testopia-create-denied", {'object' => 'plans'});
|
||||
}
|
||||
|
||||
if ($serverpush) {
|
||||
@@ -224,7 +224,7 @@ elsif ($action eq 'do_clone'){
|
||||
elsif ($action eq 'Commit'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $plan}) unless $plan->canedit;
|
||||
do_update($plan);
|
||||
$vars->{'tr_message'} = "Test plan updated";
|
||||
$vars->{'backlink'} = $plan;
|
||||
@@ -245,7 +245,7 @@ elsif ($action eq 'Print'){
|
||||
elsif ($action eq 'History'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $plan}) unless $plan->canview;
|
||||
$vars->{'plan'} = $plan;
|
||||
$vars->{'diff'} = $plan->diff_plan_doc($cgi->param('new'),$cgi->param('old'));
|
||||
$vars->{'new'} = $cgi->param('new');
|
||||
@@ -260,7 +260,7 @@ elsif ($action eq 'History'){
|
||||
elsif ($action eq 'Attach'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $plan}) unless $plan->canedit;
|
||||
defined $cgi->upload('data')
|
||||
|| ThrowUserError("file_not_specified");
|
||||
my $filename = $cgi->upload('data');
|
||||
@@ -338,7 +338,7 @@ elsif ($action eq 'do_delete'){
|
||||
####################
|
||||
else{
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $plan}) unless $plan->canview;
|
||||
display($plan);
|
||||
}
|
||||
###################
|
||||
|
||||
@@ -69,7 +69,7 @@ my $action = $cgi->param('action') || '';
|
||||
if ($action eq 'Commit'){
|
||||
print $cgi->header;
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $run}) unless $run->canedit;
|
||||
do_update($run);
|
||||
$vars->{'tr_message'} = "Test run updated";
|
||||
$vars->{'backlink'} = $run;
|
||||
@@ -79,7 +79,7 @@ if ($action eq 'Commit'){
|
||||
elsif ($action eq 'History'){
|
||||
print $cgi->header;
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'run'}) unless $run->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $run}) unless $run->canview;
|
||||
$vars->{'run'} = $run;
|
||||
$template->process("testopia/run/history.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
@@ -92,7 +92,7 @@ elsif ($action eq 'History'){
|
||||
elsif ($action =~ /^Clone/){
|
||||
print $cgi->header;
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $run->plan}) unless $run->plan->canedit;
|
||||
my $case_list = $cgi->param('case_list');
|
||||
do_update($run);
|
||||
my @ids;
|
||||
@@ -129,7 +129,7 @@ elsif ($action eq 'do_clone'){
|
||||
|
||||
}
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->plan->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $run->plan}) unless $run->plan->canedit;
|
||||
my $summary = $cgi->param('summary');
|
||||
my $build = $cgi->param('build');
|
||||
my $plan_id = $cgi->param('plan_id');
|
||||
@@ -160,7 +160,7 @@ elsif ($action eq 'do_clone'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($id);
|
||||
unless ($case->canview){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'Test Case'});
|
||||
ThrowUserError('testopia-permission-denied', {'object' => $case});
|
||||
}
|
||||
push @case_ids, $id
|
||||
}
|
||||
@@ -268,7 +268,7 @@ elsif ($action eq 'clear_filter'){
|
||||
####################
|
||||
elsif ($action eq 'addcc'){
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $run}) unless $run->canedit;
|
||||
my @cclist = split(/[\s,]+/, $cgi->param('cc'));
|
||||
my %ccids;
|
||||
foreach my $email (@cclist){
|
||||
@@ -298,7 +298,7 @@ elsif ($action eq 'removecc'){
|
||||
elsif ($action eq 'Delete'){
|
||||
print $cgi->header;
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-no-delete", {'object' => 'run'}) unless $run->candelete;
|
||||
ThrowUserError("testopia-no-delete", {'object' => $run}) unless $run->candelete;
|
||||
$vars->{'run'} = $run;
|
||||
|
||||
$template->process("testopia/run/delete.html.tmpl", $vars) ||
|
||||
@@ -309,7 +309,7 @@ elsif ($action eq 'do_delete'){
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
unless ($run->candelete){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-no-delete", {'object' => 'run'});
|
||||
ThrowUserError("testopia-no-delete", {'object' => $run});
|
||||
}
|
||||
if ($serverpush) {
|
||||
print $cgi->multipart_init();
|
||||
@@ -420,7 +420,7 @@ sub do_update {
|
||||
|
||||
sub display {
|
||||
my $run = shift;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'run'}) unless $run->canview;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => $run}) unless $run->canview;
|
||||
# See if there is a saved filter
|
||||
if ($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id) && $action ne 'Filter' && $action ne 'clear_filter'){
|
||||
$cgi = Bugzilla::CGI->new($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id));
|
||||
|
||||
@@ -55,7 +55,7 @@ if ($action eq 'delete'){
|
||||
my $tag_id = $cgi->param('tagid');
|
||||
validate_test_id($tag_id, 'tag');
|
||||
my $tag = Bugzilla::Testopia::TestTag->new($tag_id);
|
||||
ThrowUserError("testopia-no-delete", {'object' => 'Tag'}) unless $tag->candelete;
|
||||
ThrowUserError("testopia-no-delete", {'object' => $tag}) unless $tag->candelete;
|
||||
$tag->obliterate;
|
||||
$vars->{'tr_message'} = "Tag " . $tag->name . " deleted";
|
||||
display();
|
||||
@@ -126,7 +126,7 @@ elsif ($action eq 'removetag'){
|
||||
$obj = Bugzilla::Testopia::TestRun->new($id);
|
||||
}
|
||||
ThrowUserError('testopia-unkown-object') unless $obj;
|
||||
ThrowUserError("testopia-read-only", {'object' => $type}) unless $obj->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => $obj}) unless $obj->canedit;
|
||||
$obj->remove_tag($tag_id);
|
||||
if ($cgi->param('method')){
|
||||
$vars->{'tr_message'} = "Removed tag From $type " . $obj->id;
|
||||
@@ -204,7 +204,8 @@ sub display {
|
||||
|
||||
my @products;
|
||||
foreach my $id (split(",", $cgi->param('product'))){
|
||||
push @products, Bugzilla::Testopia::Product->new($id) if detaint_natural($id);;
|
||||
my $product = Bugzilla::Testopia::Product->new($id);
|
||||
push @products, $product if Bugzilla->user->can_see_product($product->name);
|
||||
}
|
||||
$vars->{'products'} = \@products;
|
||||
|
||||
@@ -214,10 +215,12 @@ sub display {
|
||||
detaint_natural($id);
|
||||
push @tags, Bugzilla::Testopia::TestTag->new($id);
|
||||
}
|
||||
|
||||
my $name = trim($cgi->param('tag'));
|
||||
trick_taint($name);
|
||||
push @tags, Bugzilla::Testopia::TestTag->new($name);
|
||||
|
||||
if ($cgi->param('tag')){
|
||||
my $name = trim($cgi->param('tag'));
|
||||
trick_taint($name);
|
||||
push @tags, Bugzilla::Testopia::TestTag->new($name);
|
||||
}
|
||||
|
||||
$vars->{'tags'} = \@tags;
|
||||
$template->process("testopia/tag/show.html.tmpl", $vars)
|
||||
|
||||
Reference in New Issue
Block a user