[Rt-commit] rt branch, 4.2/dashboard-tables, updated. rt-4.0.0rc6-183-g1c4fd3a
Shawn Moore
sartak at bestpractical.com
Tue Mar 22 14:00:11 EDT 2011
The branch, 4.2/dashboard-tables has been updated
via 1c4fd3aad9ab35c43cfa68cb6020e372175c46b0 (commit)
via b96dbec61465cfeeb69751bc0dfcbb558b94e2bd (commit)
via 8d821d643c63d36f51c26ed7e592d2592a1ff824 (commit)
from 580922e61a53330e32127caa4d31dbced4dc69aa (commit)
Summary of changes:
lib/RT/Dashboard.pm | 17 +++++++----------
lib/RT/Dashboards.pm | 38 ++++++++++----------------------------
2 files changed, 17 insertions(+), 38 deletions(-)
- Log -----------------------------------------------------------------
commit 8d821d643c63d36f51c26ed7e592d2592a1ff824
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Mar 22 13:55:09 2011 -0400
Make RT::Dashboard an RT::Record
diff --git a/lib/RT/Dashboard.pm b/lib/RT/Dashboard.pm
index 286cf9a..2135f70 100644
--- a/lib/RT/Dashboard.pm
+++ b/lib/RT/Dashboard.pm
@@ -48,33 +48,30 @@
=head1 NAME
- RT::Dashboard - an API for saving and retrieving dashboards
+ RT::Dashboard - a dashboard object
=head1 SYNOPSIS
- use RT::Dashboard
+ use RT::Dashboard;
=head1 DESCRIPTION
- Dashboard is an object that can belong to either an RT::User or an
- RT::Group. It consists of an ID, a name, and a number of
- saved searches and portlets.
-
=head1 METHODS
=cut
package RT::Dashboard;
-
-use RT::SavedSearch;
-
use strict;
use warnings;
-use base qw/RT::SharedSetting/;
+use base 'RT::Record';
+use RT::SavedSearch;
use RT::System;
+
+sub Table { 'Dashboards' }
+
RT::System::AddRights(
SubscribeDashboard => 'Subscribe to dashboards', #loc_pair
commit b96dbec61465cfeeb69751bc0dfcbb558b94e2bd
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Mar 22 13:55:18 2011 -0400
RT::Dashboards needs a ->Table
diff --git a/lib/RT/Dashboards.pm b/lib/RT/Dashboards.pm
index c2946b6..701a607 100644
--- a/lib/RT/Dashboards.pm
+++ b/lib/RT/Dashboards.pm
@@ -67,6 +67,8 @@ use base 'RT::SearchBuilder';
use RT::Dashboard;
+sub Table { 'Dashboards' }
+
=head2 LimitToObject
The Dashboards object will load the dashboards belonging to the passed-in user
commit 1c4fd3aad9ab35c43cfa68cb6020e372175c46b0
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Mar 22 13:59:42 2011 -0400
Kill LimitToPrivacy for a real LimitToObject
diff --git a/lib/RT/Dashboards.pm b/lib/RT/Dashboards.pm
index 701a607..5037b6f 100644
--- a/lib/RT/Dashboards.pm
+++ b/lib/RT/Dashboards.pm
@@ -80,35 +80,15 @@ sub LimitToObject {
my $self = shift;
my $obj = shift;
- my $privacy = join('-',ref($obj),$obj->Id);
- return $self->LimitToPrivacy($privacy);
-}
-
-=head2 LimitToPrivacy
-
-Takes one argument: a privacy string, of the format "<class>-<id>", as produced
-by RT::Dashboard::Privacy(). The Dashboards object will load the dashboards
-belonging to that user or group. Repeated calls to the same object should DTRT.
-
-=cut
-
-sub LimitToPrivacy {
- my $self = shift;
- my $privacy = shift;
-
- my $object = $self->_GetObject($privacy);
-
- if ($object) {
- $self->{'objects'} = [];
- my @dashboard_atts = $object->Attributes->Named('Dashboard');
- foreach my $att (@dashboard_atts) {
- my $dashboard = RT::Dashboard->new($self->CurrentUser);
- $dashboard->Load($privacy, $att->Id);
- push(@{$self->{'objects'}}, $dashboard);
- }
- } else {
- $RT::Logger->error("Could not load object $privacy");
- }
+ $self->Limit(
+ FIELD => 'ObjectType',
+ VALUE => ref($obj);
+ );
+
+ $self->Limit(
+ FIELD => 'ObjectId',
+ VALUE => $obj->id,
+ );
}
=head2 NewItem
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list