Changeset 6239


Ignore:
Timestamp:
05/18/12 17:18:41 (12 years ago)
Author:
niltonneto
Message:

Ticket #2507 - Implementado mapeamento dos modulos do Expresso via arquivo ".ini"

Location:
sandbox/webservice/api
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/webservice/api/rest/core/LoginResource.php

    r6165 r6239  
    44 
    55        private function getUserProfile(){ 
    6                 $user_id = $GLOBALS['phpgw_info']['user']['account_id']['acl']; 
    7                 $acl = CreateObject('phpgwapi.acl'); 
    8                 $apps = $acl->get_user_applications($user_id); 
    9                 $contactApps = array(); 
    10                 foreach($apps as $app => $isEnabled){ 
    11                         if($isEnabled) 
    12                                 $contactApps[] = $app; 
    13                 } 
    146         
    157                return array( 
     
    1810                                'contactPhones'         => array($GLOBALS['phpgw_info']['user']['telephonenumber']), 
    1911                                'contactFullName'       => $GLOBALS['phpgw_info']['user']['fullname'], 
    20                                 'contactApps'           => $contactApps 
     12                                'contactApps'           => $this->getUserApps() 
    2113                ); 
     14        } 
     15         
     16        private function getUserApps(){ 
     17                // Load Granted Apps for Web Service 
     18                $config = parse_ini_file( __DIR__ . '/../../config/user.ini',true); 
     19                $apps   = $config['Applications.mapping']; 
     20         
     21                // Load Granted Apps for User 
     22                $contactApps = array(); 
     23                $acl    = CreateObject('phpgwapi.acl'); 
     24                $user_id = $GLOBALS['phpgw_info']['user']['account_id']['acl']; 
     25                foreach($acl->get_user_applications($user_id) as $app => $value){ 
     26                        $enabledApp = array_search($app, $apps); 
     27                        if($enabledApp !== FALSE) 
     28                                $contactApps[] = $enabledApp; 
     29                } 
     30         
     31                return $contactApps; 
    2232        } 
    2333         
Note: See TracChangeset for help on using the changeset viewer.