[Rt-commit] r13726 - in rt/3.8/trunk: share/html/Dashboards/Elements t/web

sartak at bestpractical.com sartak at bestpractical.com
Tue Jul 1 19:22:26 EDT 2008


Author: sartak
Date: Tue Jul  1 19:22:25 2008
New Revision: 13726

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/share/html/Dashboards/Elements/Tabs
   rt/3.8/trunk/t/web/dashboards-groups.t

Log:
 r63612 at onn:  sartak | 2008-07-01 19:22:12 -0400
 Better SubscribeDashboard right check, expand group dashboard tests


Modified: rt/3.8/trunk/share/html/Dashboards/Elements/Tabs
==============================================================================
--- rt/3.8/trunk/share/html/Dashboards/Elements/Tabs	(original)
+++ rt/3.8/trunk/share/html/Dashboards/Elements/Tabs	Tue Jul  1 19:22:25 2008
@@ -87,7 +87,7 @@
     };
 
     delete $tabs->{"this"}{"subtabs"}{"c_Subscription"}
-        if !$session{'CurrentUser'}->HasRight(Right => 'SubscribeDashboard', Object => $RT::System);
+        unless $DashboardObj->CurrentUserCanSubscribe;
 
     $current_subtab = $modify;
 }

Modified: rt/3.8/trunk/t/web/dashboards-groups.t
==============================================================================
--- rt/3.8/trunk/t/web/dashboards-groups.t	(original)
+++ rt/3.8/trunk/t/web/dashboards-groups.t	Tue Jul  1 19:22:25 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 19;
+use Test::More tests => 38;
 use RT::Test;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -58,3 +58,40 @@
 
 $m->get_ok("$url/Dashboards");
 $m->content_contains("New dashboard", "new dashboard link shows because we have the ModifyDashboard right on inner group");
+
+$m->follow_link_ok({text => "New dashboard"});
+$m->form_name('ModifyDashboard');
+is_deeply([$m->current_form->param('Privacy')], ["RT::Group-" . $inner_group->Id], "the only selectable privacy is inner group");
+$m->field("Name" => 'inner dashboard');
+$m->content_lacks('Delete', "Delete button hidden because we are creating");
+
+$m->click_button(value => 'Save Changes');
+$m->content_lacks("No permission to create dashboards");
+$m->content_contains("Saved dashboard inner dashboard");
+$m->content_lacks('Delete', "Delete button hidden because we lack DeleteDashboard");
+
+my $dashboard = RT::Dashboard->new($currentuser);
+my ($id) = $m->content =~ /name="id" value="(\d+)"/;
+ok($id, "got an ID, $id");
+$dashboard->LoadById($id);
+is($dashboard->Name, "inner dashboard");
+
+is($dashboard->Privacy, 'RT::Group-' . $inner_group->Id, "correct privacy");
+is($dashboard->PossibleHiddenSearches, 0, "all searches are visible");
+
+$m->get_ok("/Dashboards/Modify.html?id=$id");
+$m->content_lacks("inner dashboard", "no SeeDashboard right");
+$m->content_contains("Permission denied");
+
+$user_obj->PrincipalObj->GrantRight(Right => 'SeeDashboard', Object => $inner_group);
+$m->get_ok("/Dashboards/Modify.html?id=$id");
+$m->content_contains("inner dashboard", "we now have SeeDashboard right");
+$m->content_lacks("Permission denied");
+
+$m->content_lacks('Subscription', "Subscription link still hidden because we lack SubscribeDashboard on this dashboard's privacy");
+
+$user_obj->PrincipalObj->GrantRight(Right => 'SubscribeDashboard', Object => $inner_group);
+
+$m->get_ok("/Dashboards/Modify.html?id=$id");
+$m->content_contains('Subscription', "We now have SubscribeDashboard on inner group");
+


More information about the Rt-commit mailing list