[Rt-commit] rt branch, 4.2/reminder-permissions, updated. rt-4.0.0rc4-89-g624f621
? sunnavy
sunnavy at bestpractical.com
Thu Feb 10 06:31:50 EST 2011
The branch, 4.2/reminder-permissions has been updated
via 624f62112c4667b654974da3ed6193e1aa81ef4a (commit)
via 8e1c18f796e760a1090625782eba7a445714ad8a (commit)
via f906e159139c968a281710b0d23a5abd6736d6de (commit)
via 0e81d13c9182a800edf57dd75a15fa5105a0190c (commit)
via 8c69dbb7226df84611a58a9ca3809af3ea48751f (commit)
via 8b7bb1c1dee7e8683dd68d0aba81554db62ee8f0 (commit)
via c971d2ba5320a17d823f77ccc2550a0013f35761 (commit)
via 055a6d077beb8b23464e8fe3bceae22b450bc485 (commit)
via f4e0f71317024ed5cde84474e355ddd081f84744 (commit)
via 98c6cde89b0bcc84bf14fa427156f493e30d1bd9 (commit)
from 7ed1dd9d714217cd21eb2bc1ff11e3ef1af457e6 (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 68 +++++++++++++++++++++++++------
lib/RT/Reminders.pm | 11 +++++-
share/html/Elements/Tabs | 2 +-
share/html/Ticket/Elements/Reminders | 63 +++++++++++++++++++++++-------
share/html/Ticket/Elements/ShowSummary | 3 -
share/html/Ticket/Reminders.html | 4 +-
t/web/reminders-permissions.t | 11 ++---
7 files changed, 120 insertions(+), 42 deletions(-)
- Log -----------------------------------------------------------------
commit 98c6cde89b0bcc84bf14fa427156f493e30d1bd9
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 16:07:49 2011 +0800
safer to do permission check in the lib api
diff --git a/lib/RT/Reminders.pm b/lib/RT/Reminders.pm
index 58e19c9..6030369 100644
--- a/lib/RT/Reminders.pm
+++ b/lib/RT/Reminders.pm
@@ -116,6 +116,16 @@ sub Add {
@_
);
+ return ( 0, $self->loc('Permission Denied') )
+ unless $self->CurrentUser->HasRight(
+ Right => 'CreateTicket',
+ Object => $self->TicketObj->QueueObj,
+ )
+ && $self->CurrentUser->HasRight(
+ Right => 'ModifyTicket',
+ Object => $self->TicketObj,
+ );
+
my $reminder = RT::Ticket->new($self->CurrentUser);
# the 2nd return value is txn id, which is useless here
my ( $status, undef, $msg ) = $reminder->Create(
@@ -137,6 +147,11 @@ sub Add {
sub Open {
my $self = shift;
my $reminder = shift;
+ return ( 0, $self->loc('Permission Denied') )
+ unless $self->CurrentUser->HasRight(
+ Right => 'ModifyTicket',
+ Object => $reminder,
+ );
my ( $status, $msg ) = $reminder->SetStatus('open');
$self->TicketObj->_NewTransaction(
@@ -150,6 +165,11 @@ sub Open {
sub Resolve {
my $self = shift;
my $reminder = shift;
+ return ( 0, $self->loc('Permission Denied') )
+ unless $self->CurrentUser->HasRight(
+ Right => 'ModifyTicket',
+ Object => $reminder,
+ );
my ( $status, $msg ) = $reminder->SetStatus('resolved');
$self->TicketObj->_NewTransaction(
Type => 'ResolveReminder',
commit f4e0f71317024ed5cde84474e355ddd081f84744
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 16:28:56 2011 +0800
return more action results to page
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 806d27d..a88cb40 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1956,31 +1956,41 @@ sub ProcessTicketReminders {
if ( $args->{'update-reminders'} ) {
while ( my $reminder = $reminder_collection->Next ) {
+ my ( $status, $msg, $old_subject );
if ( $reminder->Status ne 'resolved' && $args->{ 'Complete-Reminder-' . $reminder->id } ) {
- $Ticket->Reminders->Resolve($reminder);
+ ( $status, $msg ) = $Ticket->Reminders->Resolve($reminder);
}
elsif ( $reminder->Status eq 'resolved' && !$args->{ 'Complete-Reminder-' . $reminder->id } ) {
- $Ticket->Reminders->Open($reminder);
+ ( $status, $msg ) = $Ticket->Reminders->Open($reminder);
}
if ( exists( $args->{ 'Reminder-Subject-' . $reminder->id } ) && ( $reminder->Subject ne $args->{ 'Reminder-Subject-' . $reminder->id } )) {
- $reminder->SetSubject( $args->{ 'Reminder-Subject-' . $reminder->id } ) ;
+ $old_subject = $reminder->Subject;
+ ( $status, $msg ) = $reminder->SetSubject( $args->{ 'Reminder-Subject-' . $reminder->id } ) ;
}
if ( exists( $args->{ 'Reminder-Owner-' . $reminder->id } ) && ( $reminder->Owner != $args->{ 'Reminder-Owner-' . $reminder->id } )) {
- $reminder->SetOwner( $args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
+ ( $status, $msg ) = $reminder->SetOwner( $args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
}
if ( exists( $args->{ 'Reminder-Due-' . $reminder->id } ) && $args->{ 'Reminder-Due-' . $reminder->id } ne '' ) {
my $DateObj = RT::Date->new( $session{'CurrentUser'} );
+ my $due = $args->{ 'Reminder-Due-' . $reminder->id };
+
$DateObj->Set(
Format => 'unknown',
- Value => $args->{ 'Reminder-Due-' . $reminder->id }
+ Value => $due,
);
if ( defined $DateObj->Unix && $DateObj->Unix != $reminder->DueObj->Unix ) {
- $reminder->SetDue( $DateObj->ISO );
+ ( $status, $msg ) = $reminder->SetDue( $DateObj->ISO );
+ }
+ else {
+ $msg = loc( "invalid due date: [_1]", $due );
}
}
+ push @results,
+ loc( "Reminder '[_1]': ", $old_subject || $reminder->Subject ) . $msg
+ if $msg;
}
}
@@ -1996,7 +2006,9 @@ sub ProcessTicketReminders {
Due => $due_obj->ISO
);
if ( $status ) {
- push @results, loc("Reminder '[_1]' added", $args->{'NewReminder-Subject'});
+ push @results,
+ loc( "Reminder '[_1]': ", $args->{'NewReminder-Subject'} )
+ . loc("Created");
}
else {
push @results, $msg;
commit 055a6d077beb8b23464e8fe3bceae22b450bc485
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 16:30:44 2011 +0800
we should always show reminders link if with EnableReminders
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index ebe221d..e85b059 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -473,7 +473,7 @@ my $build_admin_menu = sub {
$tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id, );
#}
- if ( RT->Config->Get('EnableReminders') && $can->('ModifyTicket') ) {
+ if ( RT->Config->Get('EnableReminders') ) {
$tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id, );
}
commit c971d2ba5320a17d823f77ccc2550a0013f35761
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 16:31:43 2011 +0800
permission check fix to reminders page
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index d618a87..3773a9c 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -50,6 +50,7 @@ $Ticket => undef
$id => undef
$ShowCompleted => 0
$Edit => 0
+$ShowSave => 1
</%args>
<%init>
@@ -69,37 +70,38 @@ my $reminder_collection = $count_reminders->Collection;
</%init>
<input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
<input type="hidden" class="hidden" name="update-reminders" value="1" />
+% my $editable = 0;
% if ($has_reminders) {
<table border="0" cellpadding="1" cellspacing="0" class="collection-as-table"<% $Edit ? ' style="width: auto;"' : '' |n %>>
<tr>
% if ( $Edit ) {
<th class="collection-as-table" colspan="5"><&|/l&>Reminders</&></th>
% } else {
-% if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
<th class="collection-as-table"></th>
-% }
<th class="collection-as-table"><&|/l&>Reminder</&></th>
<th class="collection-as-table"><&|/l&>Due</&></th>
<th class="collection-as-table"><&|/l&>Owner</&></th>
% }
</tr>
% my $i = 0;
-% my $visible = 0;
+
% while ( my $reminder = $reminder_collection->Next ) {
% $i++;
% if ( $reminder->Status eq 'resolved' && !$ShowCompleted ) {
<tr class="hidden"><td><input type="hidden" class="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" /></td></tr>
% $i++;
-% } elsif ($Edit) {
+% }
+% else {
+% $editable = 1 if !$editable && $reminder->CurrentUserHasRight( 'ModifyTicket' );
+% if ($Edit) {
<& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &>
-% $visible++;
-% } else {
+% } else {
<& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket, Index => $i &>
-% $visible++;
+% }
% }
% }
</table>
-% if ( $visible > 0 && $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+% if ( $editable ) {
<i><&|/l&>(Check box to complete)</&></i><br /><br />
% }
% } else {
@@ -113,11 +115,23 @@ my $reminder_collection = $count_reminders->Collection;
% }
% }
-% if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+% if ( $Ticket->QueueObj->CurrentUserHasRight('CreateTicket') && $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+% $RT::Logger->error( $Ticket->CurrentUser->id );
+% $RT::Logger->error( $Ticket->id );
+% $RT::Logger->error( $Ticket->CurrentUserHasRight('ModifyTicket') );
+% my $user = RT::User->new( $RT::SystemUser );
+% $user->Load('sunnavy');
+% my $ticket = RT::User->new( $user );
+% $ticket->Load(16);
+% $RT::Logger->error( $ticket->CurrentUserHasRight('ModifyTicket') );
<&|/l&>New reminder:</&>
<& SELF:NewReminder, Ticket => $Ticket &>
+% $editable = 1;
% }
+% if ( $editable && $ShowSave ) {
+<div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+% }
<%method NewReminder>
<%args>
$Ticket
@@ -144,7 +158,11 @@ $Ticket
$Index
</%args>
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
-<td class="entry"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %> /></td>
+<td class="entry"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
+% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+disabled="disabled"
+% }
+/></td>
<td class="label"><&|/l&>Subject</&>:</td>
<td class="entry" colspan="3"><input type="text" size="50" name="Reminder-Subject-<% $Reminder->id %>" value="<% $Reminder->Subject %>" /></td>
</tr>
@@ -165,9 +183,11 @@ $Index
% my $dueobj = $Reminder->DueObj;
% my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0;
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
-% if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-<td class="collection-as-table"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %> /></td>
+<td class="collection-as-table"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
+% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+disabled="disabled"
% }
+/></td>
<td class="collection-as-table"><% $Reminder->Subject %></td>
<td class="collection-as-table"><% $overdue ? '<span class="overdue">' : '' |n %><% $dueobj->AgeAsString || loc('Not set') %><% $overdue ? '</span>' : '' |n %></td>
<td class="collection-as-table"><& /Elements/ShowUser, User => $Reminder->OwnerObj &></td>
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 31f55af..8753909 100755
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -77,9 +77,6 @@
<table><tr><td>
<form action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" name="UpdateReminders" id="UpdateReminders" method="post">
<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
-% if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
- <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
-% }
</form>
</td></tr></table>
</&>
diff --git a/share/html/Ticket/Reminders.html b/share/html/Ticket/Reminders.html
index 32fd9b9..7207a03 100755
--- a/share/html/Ticket/Reminders.html
+++ b/share/html/Ticket/Reminders.html
@@ -57,7 +57,7 @@
class=>'ticket-info-reminders'
&>
-<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 1, Edit => 1 &>
+<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 1, Edit => 1, ShowSave => 0 &>
</&>
<& /Elements/Submit,
Label => loc('Save Changes') &>
@@ -66,8 +66,6 @@
<%INIT>
my $Ticket = LoadTicket($id);
-Abort( loc("Permission Denied") )
- unless $Ticket->CurrentUserHasRight('ModifyTicket');
my @actions = ProcessTicketReminders( TicketObj => $Ticket, ARGSRef => \%ARGS );
</%INIT>
commit 8b7bb1c1dee7e8683dd68d0aba81554db62ee8f0
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 16:38:18 2011 +0800
RT::Ticket will check the rights for us, no need to check here
diff --git a/lib/RT/Reminders.pm b/lib/RT/Reminders.pm
index 6030369..2f72707 100644
--- a/lib/RT/Reminders.pm
+++ b/lib/RT/Reminders.pm
@@ -147,12 +147,6 @@ sub Add {
sub Open {
my $self = shift;
my $reminder = shift;
- return ( 0, $self->loc('Permission Denied') )
- unless $self->CurrentUser->HasRight(
- Right => 'ModifyTicket',
- Object => $reminder,
- );
-
my ( $status, $msg ) = $reminder->SetStatus('open');
$self->TicketObj->_NewTransaction(
Type => 'OpenReminder',
@@ -165,11 +159,6 @@ sub Open {
sub Resolve {
my $self = shift;
my $reminder = shift;
- return ( 0, $self->loc('Permission Denied') )
- unless $self->CurrentUser->HasRight(
- Right => 'ModifyTicket',
- Object => $reminder,
- );
my ( $status, $msg ) = $reminder->SetStatus('resolved');
$self->TicketObj->_NewTransaction(
Type => 'ResolveReminder',
commit 8c69dbb7226df84611a58a9ca3809af3ea48751f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 17:07:52 2011 +0800
always send checkbox's value to make ProcessTicketReminders() happy
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index 3773a9c..1a73fd9 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -158,6 +158,10 @@ $Ticket
$Index
</%args>
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
+% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+<input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
+value=<% $Reminder->Status eq 'resolved' ? 1 : 0 %> />
+% }
<td class="entry"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
disabled="disabled"
@@ -183,6 +187,11 @@ $Index
% my $dueobj = $Reminder->DueObj;
% my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0;
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
+% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+<input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
+value=<% $Reminder->Status eq 'resolved' ? 1 : 0 %> />
+% }
+
<td class="collection-as-table"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
disabled="disabled"
commit 0e81d13c9182a800edf57dd75a15fa5105a0190c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 17:29:46 2011 +0800
each reminder can have multiple result messages
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index a88cb40..92a139f 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1956,41 +1956,71 @@ sub ProcessTicketReminders {
if ( $args->{'update-reminders'} ) {
while ( my $reminder = $reminder_collection->Next ) {
- my ( $status, $msg, $old_subject );
- if ( $reminder->Status ne 'resolved' && $args->{ 'Complete-Reminder-' . $reminder->id } ) {
+ my ( $status, $msg, $old_subject, @subresults );
+ if ( $reminder->Status ne 'resolved'
+ && $args->{ 'Complete-Reminder-' . $reminder->id } )
+ {
( $status, $msg ) = $Ticket->Reminders->Resolve($reminder);
+ push @subresults, $msg;
}
- elsif ( $reminder->Status eq 'resolved' && !$args->{ 'Complete-Reminder-' . $reminder->id } ) {
+ elsif ( $reminder->Status eq 'resolved'
+ && !$args->{ 'Complete-Reminder-' . $reminder->id } )
+ {
( $status, $msg ) = $Ticket->Reminders->Open($reminder);
+ push @subresults, $msg;
}
- if ( exists( $args->{ 'Reminder-Subject-' . $reminder->id } ) && ( $reminder->Subject ne $args->{ 'Reminder-Subject-' . $reminder->id } )) {
+ if (
+ exists( $args->{ 'Reminder-Subject-' . $reminder->id } )
+ && ( $reminder->Subject ne
+ $args->{ 'Reminder-Subject-' . $reminder->id } )
+ )
+ {
$old_subject = $reminder->Subject;
- ( $status, $msg ) = $reminder->SetSubject( $args->{ 'Reminder-Subject-' . $reminder->id } ) ;
+ ( $status, $msg ) =
+ $reminder->SetSubject(
+ $args->{ 'Reminder-Subject-' . $reminder->id } );
+ push @subresults, $msg;
}
- if ( exists( $args->{ 'Reminder-Owner-' . $reminder->id } ) && ( $reminder->Owner != $args->{ 'Reminder-Owner-' . $reminder->id } )) {
- ( $status, $msg ) = $reminder->SetOwner( $args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
+ if (
+ exists( $args->{ 'Reminder-Owner-' . $reminder->id } )
+ && ( $reminder->Owner !=
+ $args->{ 'Reminder-Owner-' . $reminder->id } )
+ )
+ {
+ ( $status, $msg ) =
+ $reminder->SetOwner(
+ $args->{ 'Reminder-Owner-' . $reminder->id }, "Force" );
+ push @subresults, $msg;
}
- if ( exists( $args->{ 'Reminder-Due-' . $reminder->id } ) && $args->{ 'Reminder-Due-' . $reminder->id } ne '' ) {
+ if ( exists( $args->{ 'Reminder-Due-' . $reminder->id } )
+ && $args->{ 'Reminder-Due-' . $reminder->id } ne '' )
+ {
my $DateObj = RT::Date->new( $session{'CurrentUser'} );
- my $due = $args->{ 'Reminder-Due-' . $reminder->id };
+ my $due = $args->{ 'Reminder-Due-' . $reminder->id };
$DateObj->Set(
Format => 'unknown',
Value => $due,
);
- if ( defined $DateObj->Unix && $DateObj->Unix != $reminder->DueObj->Unix ) {
+ if ( defined $DateObj->Unix
+ && $DateObj->Unix != $reminder->DueObj->Unix )
+ {
( $status, $msg ) = $reminder->SetDue( $DateObj->ISO );
}
else {
$msg = loc( "invalid due date: [_1]", $due );
}
+
+ push @subresults, $msg;
}
- push @results,
- loc( "Reminder '[_1]': ", $old_subject || $reminder->Subject ) . $msg
- if $msg;
+
+ push @results, map {
+ loc( "Reminder '[_1]': ", $old_subject || $reminder->Subject )
+ . $_
+ } @subresults;
}
}
commit f906e159139c968a281710b0d23a5abd6736d6de
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 17:36:23 2011 +0800
readonly subject and due if without ModifyTicket permission
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index 1a73fd9..d0699bd 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -116,14 +116,6 @@ my $reminder_collection = $count_reminders->Collection;
% }
% if ( $Ticket->QueueObj->CurrentUserHasRight('CreateTicket') && $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-% $RT::Logger->error( $Ticket->CurrentUser->id );
-% $RT::Logger->error( $Ticket->id );
-% $RT::Logger->error( $Ticket->CurrentUserHasRight('ModifyTicket') );
-% my $user = RT::User->new( $RT::SystemUser );
-% $user->Load('sunnavy');
-% my $ticket = RT::User->new( $user );
-% $ticket->Load(16);
-% $RT::Logger->error( $ticket->CurrentUserHasRight('ModifyTicket') );
<&|/l&>New reminder:</&>
<& SELF:NewReminder, Ticket => $Ticket &>
% $editable = 1;
@@ -168,14 +160,25 @@ disabled="disabled"
% }
/></td>
<td class="label"><&|/l&>Subject</&>:</td>
-<td class="entry" colspan="3"><input type="text" size="50" name="Reminder-Subject-<% $Reminder->id %>" value="<% $Reminder->Subject %>" /></td>
+<td class="entry" colspan="3">
+<input type="text" size="50" name="Reminder-Subject-<% $Reminder->id %>" value="<% $Reminder->Subject %>"
+% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+readonly="readonly"
+% }
+/>
+</td>
</tr>
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
<td class="entry"> </td>
<td class="label"><&|/l&>Owner</&>:</td>
<td class="entry"><& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, QueueObj => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &></td>
<td class="label"><&|/l&>Due</&>:</td>
-<td class="entry"><& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id &> (<% $Reminder->DueObj->AsString %>)</td>
+<td class="entry">
+% if ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
+<& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id &>
+% }
+(<% $Reminder->DueObj->AsString %>)
+</td>
</tr>
</%method>
<%method ShowEntry>
commit 8e1c18f796e760a1090625782eba7a445714ad8a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 19:07:05 2011 +0800
move hidden checkbox input to td to make ui looks better
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index d0699bd..e31ddd0 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -150,11 +150,13 @@ $Ticket
$Index
</%args>
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
+<td class="entry">
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
<input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
value=<% $Reminder->Status eq 'resolved' ? 1 : 0 %> />
% }
-<td class="entry"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
+
+<input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
disabled="disabled"
% }
@@ -190,12 +192,13 @@ $Index
% my $dueobj = $Reminder->DueObj;
% my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0;
<tr class="<% $Index%2 ? 'oddline' : 'evenline' %>">
+
+<td class="collection-as-table">
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
<input name="Complete-Reminder-<% $Reminder->id %>" type="hidden"
value=<% $Reminder->Status eq 'resolved' ? 1 : 0 %> />
% }
-
-<td class="collection-as-table"><input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
+<input type="checkbox" value="1" name="Complete-Reminder-<% $Reminder->id %>" <% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' |n %>
% unless ( $Reminder->CurrentUserHasRight('ModifyTicket') ) {
disabled="disabled"
% }
commit 624f62112c4667b654974da3ed6193e1aa81ef4a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 10 19:07:54 2011 +0800
sync tests for reminders permission update
diff --git a/t/web/reminders-permissions.t b/t/web/reminders-permissions.t
index ed7abc3..46f7d5c 100644
--- a/t/web/reminders-permissions.t
+++ b/t/web/reminders-permissions.t
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use RT::Test tests => 22;
+use RT::Test tests => 19;
my $user_a = RT::Test->load_or_create_user(
Name => 'user_a',
@@ -33,11 +33,10 @@ ok($m->login( user_a => 'password'), 'logged in as user_a');
$m->goto_ticket($ticket->id);
$m->content_lacks('New reminder:', 'can not create a new reminder');
-ok( !$m->find_link(id => 'page-reminders'), 'no like to Reminders page' );
+$m->follow_link_ok({id => 'page-reminders'});
$m->get_ok( $baseurl . '/Ticket/Reminders.html?id=' . $ticket->id );
-$m->title_is("RT Error", 'got rt error');
-$m->warning_like(qr/Permission Denied/, 'got permission denied warning');
-$m->content_contains('Permission Denied', 'got permission denied msg');
+$m->title_is("Reminders for ticket #" . $ticket->id);
+$m->content_lacks('New reminder:', 'can not create a new reminder');
ok(
RT::Test->add_rights(
@@ -55,5 +54,3 @@ $m->content_contains('New reminder:', 'can create a new reminder');
$m->follow_link_ok({id => 'page-reminders'});
$m->title_is("Reminders for ticket #" . $ticket->id);
$m->content_contains('New reminder:', 'can create a new reminder');
-$m->content_lacks('Permission Denied', 'no permission denied msg');
-
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list