[Rt-commit] rtir branch, 2.5-trunk, updated. 70eeabf41260879eecb30aea83a9c96912d3db29
Ruslan Zakirov
ruz at bestpractical.com
Fri Oct 9 19:50:37 EDT 2009
The branch, 2.5-trunk has been updated
via 70eeabf41260879eecb30aea83a9c96912d3db29 (commit)
via 9392149145f2f72c2a052b6aabcfc53047a9c17d (commit)
from a00fcd5e600d8f7d12a25b5ba05ee2350dcd1276 (commit)
Summary of changes:
html/RTIR/ShowUser | 25 +++++++++++++++++--------
lib/RT/IR.pm | 28 ++++++++++++++++++----------
2 files changed, 35 insertions(+), 18 deletions(-)
- Log -----------------------------------------------------------------
commit 9392149145f2f72c2a052b6aabcfc53047a9c17d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Oct 10 03:48:04 2009 +0400
don't show modify links if we can not modify
diff --git a/html/RTIR/ShowUser b/html/RTIR/ShowUser
index c1c89ec..8c068d6 100644
--- a/html/RTIR/ShowUser
+++ b/html/RTIR/ShowUser
@@ -1,21 +1,30 @@
<span id="showuser-<%$User->id%>">
-% my $url = $RT::WebPath."/RTIR/EditUsername?page=1&id=".$User->id;
+% my $url = RT->Config->Get('WebPath') ."/RTIR/EditUsername?page=1&id=". $User->id;
<& /Elements/ShowUser, User => $User &>
-% if ( $session{'CurrentUser'}->HasRight(Right => 'AdminUsers', Object => $RT::System) ) {
-[<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$User->id%>"
- onClick="ahah('<%$url|n%>', 'showuser-<%$User->id|n %>'); return false;"
+% if ( $can_modify ) {
+% my $modify_url = $can_see_admin? RT->Config->Get('WebPath') .'/Admin/Users/Modify.html?id='. $User->id : '#';
+[<a href="<% $modify_url %>"
+ onClick="ahah('<% $url |n%>', 'showuser-<%$User->id|n %>'); return false;"
><&|/l&>Edit</&></a>]
-
% }
-% $m->abort if ($ARGS{'page'});
+% $m->abort if $page;
</span>
<%args>
$id => undef
+$Name => undef
+$page => undef
</%args>
<%init>
my $User = RT::User->new($session{'CurrentUser'});
$User->Load($id);
-if ($ARGS{'Name'}) {
- $User->SetRealName($ARGS{'Name'});
+if ( $Name ) {
+ $User->SetRealName( $Name );
}
+
+my $can_modify = $session{'CurrentUser'}->HasRight(
+ Right => 'AdminUsers', Object => $RT::System,
+);
+my $can_see_admin = $session{'CurrentUser'}->HasRight(
+ Right => 'ShowConfigTab', Object => $RT::System,
+);
</%init>
commit 70eeabf41260879eecb30aea83a9c96912d3db29
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Oct 10 03:49:10 2009 +0400
HasConstituency check
don't wrap functions if we have no constituency
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 6ec3569..9cddd77 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -277,6 +277,14 @@ sub CustomFields {
return wantarray? @list : $list[0];
} }
+{ my $cache;
+sub HasConstituency {
+ return $cache if defined $cache;
+
+ my $self = shift;
+ return $cache = $self->CustomFields('Constituency');
+} }
+
sub DefaultConstituency {
my $queue = shift;
my $name = $queue->Name;
@@ -461,7 +469,8 @@ wrap 'RT::ObjectCustomFieldValue::LargeContent',
};
-{ # ACL checks for multiple constituencies
+if ( RT::IR->HasConstituency ) {
+ # ACL checks for multiple constituencies
require RT::Interface::Web::Handler;
# flush constituency cache on each request
@@ -518,7 +527,8 @@ wrap 'RT::ObjectCustomFieldValue::LargeContent',
}
-{ # Queue {Comment,Correspond}Address for multiple constituencies
+if ( RT::IR->HasConstituency ) {
+ # Queue {Comment,Correspond}Address for multiple constituencies
require RT::Ticket;
wrap 'RT::Ticket::QueueObj', pre => sub {
@@ -552,13 +562,11 @@ wrap 'RT::ObjectCustomFieldValue::LargeContent',
};
+ require RT::Queue;
+ package RT::Queue;
- {
- require RT::Queue;
- package RT::Queue;
-
- sub CorrespondAddress { GetQueueAttribute(shift, 'CorrespondAddress') }
- sub CommentAddress { GetQueueAttribute(shift, 'CommentAddress') }
+ sub CorrespondAddress { GetQueueAttribute(shift, 'CorrespondAddress') }
+ sub CommentAddress { GetQueueAttribute(shift, 'CommentAddress') }
sub GetQueueAttribute {
my $queue = shift;
@@ -587,10 +595,10 @@ wrap 'RT::ObjectCustomFieldValue::LargeContent',
return $queue->_Value($attr);
}
}
-}
-{ # Set Constituency on Create
+if ( RT::IR->HasConstituency ) {
+ # Set Constituency on Create
require RT::Ticket;
wrap 'RT::Ticket::Create', pre => sub {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list