source: sandbox/webservice/api/rest/core/LoginResource.php @ 7930

Revision 7930, 1.2 KB checked in by alexandrecorreia, 11 years ago (diff)

Ticket #2507 - Retorno do uidnumber e uid para o portal da SEED

Line 
1<?php
2
3class LoginResource extends ExpressoAdapter {
4
5        private function getUserProfile(){
6                if($this->getExpressoVersion() != "2.2") {
7                        $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id'];
8                }
9       
10                return array(
11                                'contactID'                     => $GLOBALS['phpgw_info']['user']['account_dn'],
12                                'contactMails'          => array($GLOBALS['phpgw_info']['user']['email']),
13                                'contactPhones'         => array($GLOBALS['phpgw_info']['user']['telephonenumber']),
14                                'contactFullName'       => $GLOBALS['phpgw_info']['user']['fullname'],
15                                'contactLID'                    => $GLOBALS['phpgw_info']['user']['account_lid'],
16                                'contactUIDNumber'              => $GLOBALS['phpgw_info']['user']['account_id'],
17                                'contactApps'           => $this->getUserApps()
18                );
19        }
20       
21        public function post($request){
22                // to Receive POST Params (use $this->params)
23                parent::post($request);
24                if($sessionid = $GLOBALS['phpgw']->session->create($this->getParam('user'), $this->getParam('password')))
25                {
26                        $result = array(
27                                'auth'                  => $sessionid.":".$GLOBALS['phpgw']->session->kp3,
28                                'profile'               => array($this->getUserProfile())
29                        );
30                        $this->setResult($result);
31                }
32                else
33                {
34                        Errors::runException($GLOBALS['phpgw']->session->cd_reason);
35                }
36                return $this->getResponse();
37        }       
38
39}
Note: See TracBrowser for help on using the repository browser.