[Rt-commit] rt branch, 4.2/self-service-autocomplete, created. rt-4.1.6-30-g4b36b66

Thomas Sibley trs at bestpractical.com
Thu Feb 14 23:08:20 EST 2013


The branch, 4.2/self-service-autocomplete has been created
        at  4b36b66ba1699d3cf2bde4ed657e5dc677d80437 (commit)

- Log -----------------------------------------------------------------
commit 1e99bd2474a39cb2c9524b66adeaf62b066f677e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Feb 14 19:39:57 2013 -0800

    User and custom field autocompletion for Self Service
    
    Tiny shims simply redispatch to the normal autocomplete endpoints,
    letting us easily control which endpoints are available.
    
    The Users endpoint is safe for unprivileged access since it is designed
    with that in mind and protected via the $AllowUserAutocompleteForUnprivileged
    option.  This commit resolves [rt3 #16946].
    
    The CustomFieldValues endpoint is also safe for unprivileged as it
    strictly follows granted ACLs and context objects.
    
    To simply the endpoint decision in JS, I added WebHomePath to the
    javascript config data, mimicking the same value available to column
    maps since 159e206.

diff --git a/share/html/Elements/EditCustomFieldAutocomplete b/share/html/Elements/EditCustomFieldAutocomplete
index f37ee1e..ff642d6 100644
--- a/share/html/Elements/EditCustomFieldAutocomplete
+++ b/share/html/Elements/EditCustomFieldAutocomplete
@@ -52,7 +52,7 @@
 var id = <% "$name-Values" |n,j%>;
 id = id.replace(/:/g,'\\:');
 jQuery('#'+id).autocomplete( {
-    source: RT.Config.WebPath + "/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% "$name-Values" |n,u,j%>,
+    source: RT.Config.WebHomePath + "/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% "$name-Values" |n,u,j%>,
     focus: function () {
         // prevent value inserted on focus
         return false;
@@ -76,7 +76,7 @@ jQuery('#'+id).autocomplete( {
 var id = <% "$name-Value" |n,j%>;
 id = id.replace(/:/g,'\\:');
 jQuery('#'+id).autocomplete( {
-    source: RT.Config.WebPath + "/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% "$name-Value" |n,u,j%>
+    source: RT.Config.WebHomePath + "/Helpers/Autocomplete/CustomFieldValues?"+<% $Context |n,j %>+<% "$name-Value" |n,u,j%>
 }
 );
 % }
diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index 9e3143c..9fe0f99 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -57,6 +57,9 @@ if ($session{CurrentUser} and $session{CurrentUser}->id) {
 
     $CurrentUser->{Privileged} = $session{CurrentUser}->Privileged
         ? JSON::true : JSON::false;
+
+    $Config->{WebHomePath} = RT->Config->Get("WebPath")
+        . !$session{CurrentUser}->Privileged ? "/SelfService" : "";
 }
 
 $m->callback(
diff --git a/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues b/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues
new file mode 100644
index 0000000..a9a94e9
--- /dev/null
+++ b/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues
@@ -0,0 +1 @@
+% $m->comp('/Helpers/Autocomplete/CustomFieldValues', %ARGS);
diff --git a/share/html/SelfService/Helpers/Autocomplete/Users b/share/html/SelfService/Helpers/Autocomplete/Users
new file mode 100644
index 0000000..d92fc75
--- /dev/null
+++ b/share/html/SelfService/Helpers/Autocomplete/Users
@@ -0,0 +1 @@
+% $m->comp('/Helpers/Autocomplete/Users', %ARGS);
diff --git a/share/static/js/userautocomplete.js b/share/static/js/userautocomplete.js
index ef9988f..de7d6a0 100644
--- a/share/static/js/userautocomplete.js
+++ b/share/static/js/userautocomplete.js
@@ -23,7 +23,7 @@ jQuery(function() {
             continue;
 
         var options = {
-            source: RT.Config.WebPath + "/Helpers/Autocomplete/Users"
+            source: RT.Config.WebHomePath + "/Helpers/Autocomplete/Users"
         };
 
         var queryargs = [];

commit 4b36b66ba1699d3cf2bde4ed657e5dc677d80437
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Feb 14 20:07:51 2013 -0800

    License tag the two new self service autocomplete endpoints

diff --git a/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues b/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues
index a9a94e9..0d41574 100644
--- a/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues
+++ b/share/html/SelfService/Helpers/Autocomplete/CustomFieldValues
@@ -1 +1,48 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
 % $m->comp('/Helpers/Autocomplete/CustomFieldValues', %ARGS);
diff --git a/share/html/SelfService/Helpers/Autocomplete/Users b/share/html/SelfService/Helpers/Autocomplete/Users
index d92fc75..b58fdd9 100644
--- a/share/html/SelfService/Helpers/Autocomplete/Users
+++ b/share/html/SelfService/Helpers/Autocomplete/Users
@@ -1 +1,48 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
 % $m->comp('/Helpers/Autocomplete/Users', %ARGS);

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


More information about the Rt-commit mailing list