[Rt-commit] r13638 - in rt/3.8/trunk: . share/html/Dashboards

sartak at bestpractical.com sartak at bestpractical.com
Thu Jun 26 20:09:09 EDT 2008


Author: sartak
Date: Thu Jun 26 20:09:07 2008
New Revision: 13638

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Dashboard.pm
   rt/3.8/trunk/share/html/Dashboards/Subscription.html

Log:
 r63283 at onn:  sartak | 2008-06-26 20:06:09 -0400
 Add CurrentUserCanSubscribe and check it in Subscription


Modified: rt/3.8/trunk/lib/RT/Dashboard.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Dashboard.pm	(original)
+++ rt/3.8/trunk/lib/RT/Dashboard.pm	Thu Jun 26 20:09:07 2008
@@ -297,6 +297,15 @@
     );
 }
 
+sub CurrentUserCanSubscribe {
+    my $self = shift;
+    my $privacy = shift;
+
+    $self->_CurrentUserCan($privacy,
+        Right => 'SubscribeDashboard',
+    );
+}
+
 sub CurrentUserCanModify {
     my $self = shift;
     my $privacy = shift;

Modified: rt/3.8/trunk/share/html/Dashboards/Subscription.html
==============================================================================
--- rt/3.8/trunk/share/html/Dashboards/Subscription.html	(original)
+++ rt/3.8/trunk/share/html/Dashboards/Subscription.html	Thu Jun 26 20:09:07 2008
@@ -238,6 +238,9 @@
     }
     # create
     else {
+        Abort(loc("Unable to subscribe to dashboard [_1]: Permission denied", $DashboardId))
+            unless $DashboardObj->CurrentUserCanSubscribe;
+
         my ($val, $msg) = $SubscriptionObj->Create(
             Name        => 'Subscription',
             Description => 'Subscription to dashboard ' . $DashboardId,


More information about the Rt-commit mailing list