source: sandbox/webservice/api/rest/admin/SearchUserResource.php @ 7810

Revision 7810, 949 bytes checked in by alexandrecorreia, 11 years ago (diff)

Ticket #2507 - Criado os resources para o módulo Expresso-Admin

  • Property svn:executable set to *
Line 
1<?php
2
3class SearchUserResource extends AdminAdapter
4{
5
6        public function post($request)
7        {
8                // to Receive POST Params (use $this->params)
9                parent::post($request);
10
11                if( $this->isLoggedIn() )
12                {
13                        //Permission
14                        $permission = array();
15                        $permission['action'] = 'list_users';
16                        $permission['apps'] = $this->getUserApps();
17
18                        //Load Conf Admin
19                        $this->loadConfAdmin();
20
21                        if( $this->validatePermission($permission) )   
22                        {       
23                                $searchUser = $this->getParam('account_search_user');
24
25                                if( trim($searchUser) == "" && isset($searchUser) )     
26                                        Errors::runException( "ADMIN_SEARCH_USER_EMPTY" );
27
28                                $list = $this->listUsers( $searchUser );
29
30                                if( count($list) > 0 )
31                                {
32                                        $this->setResult( array( "result" => $list ) );
33                                }
34                                else
35                                {
36                                        Errors::runException( "ADMIN_USERS_NOT_FOUND" );               
37                                }
38                        }
39                        else
40                        {
41                                Errors::runException( "ACCESS_NOT_PERMITTED" );
42                        }                       
43
44                }
45
46                return $this->getResponse();
47        }
48}
49
50?>
Note: See TracBrowser for help on using the repository browser.