Changeset 6477 for trunk


Ignore:
Timestamp:
06/13/12 14:12:51 (12 years ago)
Author:
leticiabohnert
Message:

Ticket #2851 - Alterado para aparecer cargo e vinculo no org. quando usuário possui permissão.

Location:
trunk/workflow
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/class.so_userinterface.inc.php

    r5242 r6477  
    1313         */ 
    1414        var $db; 
    15  
     15        /** 
     16         * @var bool True se o usuário for administrador do expresso. 
     17         * @access private 
     18         */ 
     19        private $isAdmin; 
     20 
     21        /** 
     22         * @var int ID do usuário logado no Expresso 
     23         * @access private 
     24         */ 
     25        private $userID; 
     26 
     27        /** 
     28         * @var object Link para a ACL do Workflow. 
     29         * @access private 
     30         */ 
     31        private $acl; 
     32         
     33        /** 
     34         * @var bool indicando se o usuário possui ou não acesso aos dados restritos. 
     35         * @access private 
     36         */ 
     37        private $authorized; 
     38         
    1639        /** 
    1740         * Constructor 
     
    2144        function so_userinterface() 
    2245        { 
     46                $this->authorized= false; 
     47                $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 
     48                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
     49                $this->acl = Factory::getInstance('workflow_acl'); 
    2350                $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2451                $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 
     
    218245 
    219246                return $output; 
     247        }        
     248 
     249        /** 
     250         * Checa se o usuário possui permissão para visualizar informações restritas. 
     251         * @param int $organizationID O ID da organização do Orgranograma. 
     252         * @return void 
     253         * @access public 
     254         */ 
     255        public function _checkAccess($organizationID = null) 
     256        { 
     257                /* the user is an administrator */ 
     258                if ($this->isAdmin) 
     259                        $this->$authorized=true; 
     260 
     261                if (!is_numeric($organizationID)) 
     262                        $this->authorized = false; 
     263                else 
     264                        $this->authorized = $this->acl->checkUserAccessToResource('ORG', $this->userID, (int) $organizationID, 1); 
     265                 
    220266        } 
    221267 
     
    232278                $areaID = (int) $areaID; 
    233279 
     280                require_once dirname(__FILE__) . '/local/classes/class.wf_orgchart.php'; 
     281                $orgchart = new wf_orgchart(); 
     282                 
    234283                /* gather some info from the area */ 
    235284                $areaInfo = $this->db->query('SELECT COALESCE(a.titular_funcionario_id, -1) AS titular_funcionario_id, COALESCE(s.funcionario_id, -1) AS substituto_funcionario_id FROM area a LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) WHERE (a.organizacao_id = ?) AND (a.area_id = ?)', array($organizationID, $areaID))->GetArray(-1); 
     
    252301                        for ($j = 0; $j < $result->_numOfFields; $j++) 
    253302                                unset($employees[$i][$j]); 
    254  
     303                         
    255304                        $employees[$i]['cn'] = ''; 
    256305                        $employees[$i]['telephoneNumber'] = ''; 
     
    268317                                $employees[$i]['removed'] = is_null($entry['last_update']); 
    269318                        } 
     319                         
     320                        /*busca o cargo do funcionario*/ 
     321                        $employeeInfo = $orgchart->getEmployee($employees[$i]['funcionario_id']); 
     322 
     323                        $cargo = ''; 
     324 
     325                        if ($this->authorized && !empty($employeeInfo['cargo_id'])) 
     326                        { 
     327                                $jobTitleInfo = $orgchart->getJobTitle($employeeInfo['cargo_id']); 
     328                                $cargo = $jobTitleInfo['descricao']; 
     329                        } 
     330                        $employees[$i]['cargo'] = utf8_encode($cargo);   
     331                         
     332                        /*busca o vínculo do funcionario*/ 
     333                        $vinculo = ''; 
     334                        if ($this->authorized && !empty($employeeInfo['funcionario_categoria_id'])) 
     335                        { 
     336                                $categoryInfo = $orgchart->getEmployeeCategory($employeeInfo['funcionario_categoria_id']); 
     337                                $vinculo=$categoryInfo['descricao']; 
     338                        }                        
     339                        $employees[$i]['vinculo'] = utf8_encode($vinculo); 
    270340 
    271341                        /* count the number of employees in each category */ 
     
    274344                                $categoriesCount[$categoryID]++; 
    275345                        else 
    276                                 $categoriesCount[$categoryID] = 1; 
     346                                $categoriesCount[$categoryID] = 1;                                       
    277347                } 
    278348                $usedCategories = array_keys($categoriesCount); 
  • trunk/workflow/inc/class.ui_userinterface.inc.php

    r3167 r6477  
    170170                } 
    171171 
     172                //Verifica a permissão do usuário 
     173                $so->_checkAccess($organizationID); 
     174 
    172175                /* make the array flat (for a simpler handling) */ 
    173176                $flatAreas = array(); 
     
    184187                        } 
    185188                        unset($currentArea['children']); 
    186  
     189                         
    187190                        $employees = $so->getAreaEmployees($currentArea['area_id'], $organizationID); 
    188191                        if (is_array($employees)) 
  • trunk/workflow/js/adminaccess/main.js

    r3255 r6477  
    3434permissionListORG[0]['name'] = "Administrar Organograma"; 
    3535permissionListORG[0]['value'] = 0; 
    36 permissionListORG[1]['name'] = "Visualizar Telefones Pessoais"; 
     36permissionListORG[1]['name'] = "Visualizar Informações Restritas"; 
    3737permissionListORG[1]['value'] = 1; 
    3838 
Note: See TracChangeset for help on using the changeset viewer.