Ignore:
Timestamp:
02/07/13 17:08:23 (11 years ago)
Author:
alexandrecorreia
Message:

Ticket #2507 - Fazendo a busca somente pelo lid ( literal id = uid )

Location:
sandbox/webservice/api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/webservice/api/adapters/AdminAdapter.php

    r7873 r7875  
    112112        } 
    113113 
     114        protected function listUsersLiteral($params) 
     115        { 
     116                $list = $this->listUsers($params); 
     117 
     118                foreach( $list as $key => $users ) 
     119                { 
     120                        if( strtolower(trim($params)) === strtolower(trim($users['account_lid']))) 
     121                        { 
     122                                return $list[$key]; 
     123                        } 
     124                } 
     125 
     126                return false; 
     127        } 
     128 
    114129        protected function listUsers($params) 
    115130        { 
     
    118133                $acl = $adminListUser->read_acl($GLOBALS['phpgw']->accounts->data['account_lid']); 
    119134 
    120                 $search = trim(preg_replace("/[^a-z_0-9_-_._@]/", "", $params)); 
     135                $search = trim(preg_replace("/[^a-z_0-9_-_._@\\s]/", "", $params)); 
    121136 
    122137                $accounts = $adminListUser->get_list( 'accounts', $search, $acl['contexts'] ); 
  • sandbox/webservice/api/rest/admin/GetUsersResource.php

    r7866 r7875  
    2020                        $uidUser        = $this->getParam('accountUidNumber'); 
    2121                        $searchUser = $this->getParam('accountSearchUser'); 
    22  
     22                        $searchUserLiteral= $this->getParam('accountSearchUserLID'); 
     23                                                                                                  
    2324                        //Validate Fields 
    2425                        $uidUser = str_replace("*","",$uidUser); 
     
    2728                        $searchUser = str_replace("*","", $searchUser); 
    2829                        $searchUser = str_replace("%","", $searchUser); 
     30 
     31                        $searchUserLiteral = str_replace("*","", $searchUserLiteral); 
     32                        $searchUserLiteral = str_replace("%","", $searchUserLiteral); 
    2933 
    3034                        if( trim($uidUser) != "" && isset($uidUser) ) 
     
    6771                                if( $this->validatePermission($permission) ) 
    6872                                { 
    69                                         $list = $this->listUsers( $searchUser ); 
    70                                          
    7173                                        // Return list 
    7274                                        $return = array(); 
    7375 
    74                                         foreach( $list as $key => $users ) 
     76                                        if( trim($searchUser) != "" && isset($searchUser) ) 
    7577                                        { 
    76                                                 $return[$key]['accountId']              = $users['account_id']; 
    77                                                 $return[$key]['accountLid']             = $users['account_lid']; 
    78                                                 $return[$key]['accountCn']              = $users['account_cn']; 
    79                                                 $return[$key]['accountMail']    = $users['account_mail']; 
     78                                                $list = $this->listUsers( $searchUser ); 
     79 
     80                                                foreach( $list as $key => $users ) 
     81                                                { 
     82                                                        $return[$key]['accountId']              = $users['account_id']; 
     83                                                        $return[$key]['accountLid']             = $users['account_lid']; 
     84                                                        $return[$key]['accountCn']              = $users['account_cn']; 
     85                                                        $return[$key]['accountMail']    = $users['account_mail']; 
     86                                                } 
     87                                        } 
     88                                        else 
     89                                        { 
     90                                                $list = $this->listUsersLiteral($searchUserLiteral); 
     91                                                 
     92                                                $return = $list; 
    8093                                        } 
    8194 
    82                                         if( count($list) > 0 ) 
     95                                        if( count($return) > 0 ) 
    8396                                        { 
    8497                                                $this->setResult( array( "users" => $return ) ); 
Note: See TracChangeset for help on using the changeset viewer.