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

RevLine 
[6019]1<?php
2
[6149]3class LoginResource extends ExpressoAdapter {
[6148]4
5        private function getUserProfile(){
[6664]6                if($this->getExpressoVersion() != "2.2") {
7                        $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id'];
8                }
[6148]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'],
[6239]15                                'contactApps'           => $this->getUserApps()
[6148]16                );
17        }
18       
[6019]19        public function post($request){
20                // to Receive POST Params (use $this->params)
[6061]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);
[6019]29                }
30                else
31                {
[6165]32                        Errors::runException($GLOBALS['phpgw']->session->cd_reason);
[6019]33                }
[6061]34                return $this->getResponse();
[6019]35        }       
36
37}
Note: See TracBrowser for help on using the repository browser.