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

Revision 7812, 1.1 KB checked in by alexandrecorreia, 11 years ago (diff)

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

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                                'contactApps'           => $this->getUserApps()
16                );
17        }
18       
19        public function post($request){
20                // to Receive POST Params (use $this->params)
21                parent::post($request);
22                if($sessionid = $GLOBALS['phpgw']->session->create($this->getParam('user'), $this->getParam('password')))
23                {
24                        $result = array(
25                                'auth'                  => $sessionid.":".$GLOBALS['phpgw']->session->kp3,
26                                'profile'               => array($this->getUserProfile())
27                        );
28                        $this->setResult($result);
29                }
30                else
31                {
32                        Errors::runException($GLOBALS['phpgw']->session->cd_reason);
33                }
34                return $this->getResponse();
35        }       
36
37}
Note: See TracBrowser for help on using the repository browser.