[Rt-commit] rt branch, 4.2/owner-display, created. rt-4.1.6-384-ge48b942

Alex Vandiver alexmv at bestpractical.com
Fri Mar 22 18:09:29 EDT 2013


The branch, 4.2/owner-display has been created
        at  e48b94252c0bb4ab55587515cf695c0300b72d03 (commit)

- Log -----------------------------------------------------------------
commit dad34f3b62ecea49f6cc434778f2970c2b56e7d2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Mar 22 13:52:01 2013 -0700

    Move more logic into INIT block

diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index 17e6ac6..cd09964 100644
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -49,10 +49,6 @@
 %if ($DefaultValue) {
 <option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel |n%></option>
 %}
-% $Default = 0 unless defined $Default && $Default =~ /^\d+$/;
-% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $_->Format]} grep { $_->id != RT->Nobody->id } @users;
-% my $nobody = [RT->Nobody, RT->Nobody->Format(CurrentUser => $session{CurrentUser})];
-% unshift @formatednames, $nobody;
 %foreach my $UserRef ( @formatednames)  {
 %my $User = $UserRef->[0];
 <option <% ( $User->Id == $Default) ? qq[ selected="selected"] : '' |n %>
@@ -85,8 +81,16 @@ if ($Default && $Default != RT->Nobody->id && !$user_uniq_hash{$Default}) {
     $user_uniq_hash{$Default} = RT::User->new($session{CurrentUser});
     $user_uniq_hash{$Default}->Load($Default);
 }
+$Default = 0 unless defined $Default && $Default =~ /^\d+$/;
+
+my @formatednames = sort {lc $a->[1] cmp lc $b->[1]}
+                     map {[$_, $_->Format]}
+                    grep { $_->id != RT->Nobody->id }
+                  values %user_uniq_hash;
+
+unshift @formatednames,
+    [RT->Nobody, RT->Nobody->Format(CurrentUser => $session{CurrentUser})];
 
-my @users = values %user_uniq_hash;
 </%INIT>
 
 <%ARGS>

commit 3056568f2fb6cbb84fbb2cf33a1e973d72f87893
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Mar 22 14:13:40 2013 -0700

    Automatically switch to autocompleter on too many Owners
    
    This avoids the server- and client-side slowdown associated with
    generating and rendering overly large drop-downs.  The most common cause
    of this is granting OwnTicket to the Everyone group.

diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index cd09964..d47cf4f 100644
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -77,6 +77,14 @@ foreach my $object (@$Objects) {
         $user_uniq_hash{ $User->Id() } = $User;
     }
 }
+
+if (keys(%user_uniq_hash) > 50 ) {
+    my $desc = $Objects->[0]->RecordType." ".$Objects->[0]->id;
+    RT->Logger->notice("More than 50 possible Owners found for $desc; switching to autocompleter");
+    $m->comp("/Elements/SelectOwnerAutocomplete", %ARGS);
+    return;
+}
+
 if ($Default && $Default != RT->Nobody->id && !$user_uniq_hash{$Default}) {
     $user_uniq_hash{$Default} = RT::User->new($session{CurrentUser});
     $user_uniq_hash{$Default}->Load($Default);

commit e48b94252c0bb4ab55587515cf695c0300b72d03
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Mar 22 14:18:43 2013 -0700

    Only display privileged users in Owner drop-downs
    
    Configurations in which unprivileged users are expected to own tickets
    are vanishingly small or non-existant; however, it is a common
    misconfiguration to grant Everyone the OwnTicket right.
    
    Limit entries in the Owner dropdown to only privileged users.
    Configurations which require unprivileged users be able to own tickets
    may use the autocompleter.

diff --git a/docs/UPGRADING-4.2 b/docs/UPGRADING-4.2
index 9257929..81723c4 100644
--- a/docs/UPGRADING-4.2
+++ b/docs/UPGRADING-4.2
@@ -76,3 +76,10 @@ UPGRADING FROM RT 4.0.0 and greater
   using this in an rt-crontool cronjob or had used a
   Googleish_Local.pm to add features, you will need to convert to
   using RT::Search::Simple instead.
+
+* The Owner drop-down now only includes privileged users (no matter if
+  unprivileged users have been granted the OwnTicket right) because
+  configurations which have unprivileged Owners are exceedingly rare,
+  and granting Everyone the OwnTicket right is a common cause of
+  performance problems.  Unprivileged Owners (if they exist) may still
+  be set using the Autocompleter.
diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index d47cf4f..4f3db02 100644
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -67,6 +67,7 @@ my $isSU = $session{CurrentUser}
     ->HasRight( Right => 'SuperUser', Object => $RT::System );
 foreach my $object (@$Objects) {
     my $Users = RT::Users->new( $session{CurrentUser} );
+    $Users->LimitToPrivileged;
     $Users->WhoHaveRight(
         Right               => 'OwnTicket',
         Object              => $object,

-----------------------------------------------------------------------


More information about the Rt-commit mailing list