[Rt-commit] rt branch, 4.2/rest-search-refactor, updated. rt-4.0.1-244-geec3a13

? sunnavy sunnavy at bestpractical.com
Wed Jun 13 01:00:15 EDT 2012


The branch, 4.2/rest-search-refactor has been updated
       via  eec3a130dad800a2c5a42bf5f862f5450d3b84ce (commit)
       via  749f765de06bdbf318ffd0d57902973a0f9d475c (commit)
      from  600c03742937f8c91dafa0541c78bb1f2a643401 (commit)

Summary of changes:
 share/html/REST/1.0/Forms/group/default |    2 +-
 share/html/REST/1.0/Forms/queue/default |    2 +-
 share/html/REST/1.0/search/dhandler     |   28 +++++++++++++++++++++++-----
 3 files changed, 25 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 749f765de06bdbf318ffd0d57902973a0f9d475c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 13 08:41:32 2012 +0800

    REST: show Disabled column for queues/groups

diff --git a/share/html/REST/1.0/Forms/group/default b/share/html/REST/1.0/Forms/group/default
index 29c6d18..fd54a3e 100644
--- a/share/html/REST/1.0/Forms/group/default
+++ b/share/html/REST/1.0/Forms/group/default
@@ -59,7 +59,7 @@ my ($c, $o, $k, $e) = ("", [], {}, 0);
 my %data = %$changes;
 my $group = RT::Group->new($session{CurrentUser});
 
-my @fields = qw(Name Description);
+my @fields = qw(Name Description Disabled);
 if ( $fields && %$fields ) {
     @fields = grep { exists $fields->{ lc $_ } } @fields;
 }
diff --git a/share/html/REST/1.0/Forms/queue/default b/share/html/REST/1.0/Forms/queue/default
index 487b972..44e760e 100755
--- a/share/html/REST/1.0/Forms/queue/default
+++ b/share/html/REST/1.0/Forms/queue/default
@@ -60,7 +60,7 @@ my %data = %$changes;
 my $queue = RT::Queue->new($session{CurrentUser});
 
 my @fields =
-  qw(Name Description CorrespondAddress CommentAddress InitialPriority FinalPriority DefaultDueIn);
+  qw(Name Description CorrespondAddress CommentAddress InitialPriority FinalPriority DefaultDueIn Disabled);
 if ( $fields && %$fields ) {
     @fields = grep { exists $fields->{ lc $_ } } @fields;
 }

commit eec3a130dad800a2c5a42bf5f862f5450d3b84ce
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 13 09:41:37 2012 +0800

    REST: handle Disabled column search for queues/groups/users

diff --git a/share/html/REST/1.0/search/dhandler b/share/html/REST/1.0/search/dhandler
index 492b963..d9498cf 100755
--- a/share/html/REST/1.0/search/dhandler
+++ b/share/html/REST/1.0/search/dhandler
@@ -144,12 +144,28 @@ if ( $type =~ /^(ticket|queue|user|group)$/i ) {
 
 
             if ( $field && $op && defined $value ) {
+                if ( $field eq 'Disabled' ) {
+                    if ($value) {
+                        $objects->FindAllRows;
+                        if ( $type eq 'queue' ) {
 
-                $objects->Limit(
-                    FIELD    => $field,
-                    OPERATOR => uc $op,
-                    VALUE    => $value
-                );
+                            # special case for queue that
+                            # Disabled could be 2(___Approvals)
+                            $objects->Limit(
+                                FIELD    => $field,
+                                OPERATOR => uc $op,
+                                VALUE    => $value
+                            );
+                        }
+                    }
+                }
+                else {
+                    $objects->Limit(
+                        FIELD    => $field,
+                        OPERATOR => uc $op,
+                        VALUE    => $value
+                    );
+                }
             }
             else {
                 $output = "Invalid query specification: $query";
@@ -250,11 +266,13 @@ my %search_whitelist = (
           keys %{ $RT::Record::_TABLE_ATTR->{'RT::Queue'} }
     },
     user => {
+        disabled => 1,
         map { lc $_ => 1 }
           grep { $RT::Record::_TABLE_ATTR->{'RT::User'}{$_}{read} }
           keys %{ $RT::Record::_TABLE_ATTR->{'RT::User'} }
     },
     group => {
+        disabled => 1,
         map { lc $_ => 1 }
           grep { $RT::Record::_TABLE_ATTR->{'RT::Group'}{$_}{read} }
           keys %{ $RT::Record::_TABLE_ATTR->{'RT::Group'} }

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


More information about the Rt-commit mailing list