Changeset 7769


Ignore:
Timestamp:
01/18/13 16:47:21 (11 years ago)
Author:
cristiano
Message:

Ticket #2948 - Log criacao, exclusao e modificacao de contas compartilhadas e institucionais

Location:
trunk/expressoAdmin1_2/inc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/inc/class.db_functions.inc.php

    r7673 r7769  
    625625                $sql = "INSERT INTO phpgw_expressoadmin_log (date, manager, action, userinfo) " 
    626626                . "VALUES('now','" . $_SESSION['phpgw_info']['expresso']['user']['account_lid'] . "','" . strtolower($action) . "','" . strtolower($about) . "')"; 
    627                  
    628627                if (!$this->db->query($sql)) 
    629628                { 
  • trunk/expressoAdmin1_2/inc/class.functions.inc.php

    r7681 r7769  
    3939                        $this->current_config = $c->config_data; 
    4040                } 
     41 
     42        function write_log($action, $about) 
     43        { 
     44            return $this->db_functions->write_log($action, $about); 
     45        } 
    4146                 
    4247                // Account and type of access. Return: Have access ? (true/false) 
  • trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php

    r7552 r7769  
    321321                            $result['msg']  = $this->functions->lang('Error on function') . ' imap_functions->setaclfrombox: imap_setacl'; 
    322322                            $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . imap_last_error(); 
    323                             break; 
     323//                            break; 
    324324                        } 
    325325                } 
     
    384384                                return $result; 
    385385            } 
     386 
     387            if(count($owners_to_remove) > 0) 
     388            { 
     389                foreach($owners_to_remove as $user => $acl) 
     390                { 
     391                    $this->functions->write_log("User removed from the shared account",'USER: '.$user.' - SHARED ACCOUNT: '.$params['uid']); 
     392                } 
     393            } 
     394            if(count($owners_to_add) > 0) 
     395            { 
     396                foreach($owners_to_add as $user => $acl) 
     397                { 
     398                    $this->functions->write_log("User added from the shared account",'USER: '.$user.' - SHARED ACCOUNT: '.$params['uid']); 
     399                } 
     400            } 
     401 
    386402            //file_put_contents("/tmp/saida", "old ".print_r($owners_acl_old, true)."remove ".print_r($owners_to_remove, true)."add ".print_r($owners_to_add, true)."update ".print_r($owners_to_update, true)); 
    387403            if( is_array($owners_acl_new)){ 
     
    442458            require_once('class.ldap_functions.inc.php'); 
    443459 
    444             if( !$ldap ) 
    445             { 
     460//          if( !$ldap ) 
     461//          { 
    446462                $ldap = new ldap_functions(); 
    447             } 
     463//          } 
    448464 
    449465            $to = $ldap->uid2mailforwardingaddress( $user ); 
     
    468484            $keys = array_keys( $tpls ); 
    469485 
    470             if( !array_diff_key( $tpl, array_keys( $keys ) ) ) 
     486            if( !array_diff_key( $tpls, array_keys( $keys ) ) ) 
    471487            { 
    472488                $newTpls = array(); 
  • trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php

    r7681 r7769  
    242242                } 
    243243 
     244        $institutional_accounts = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], ('('.substr($params['anchor'], 0 , strpos($params['anchor'],','))).')'); 
     245        $old  = ldap_get_entries($this->ldap, $institutional_accounts); 
     246        $oldOwners = array(); 
     247 
     248 
     249        foreach($old[0]['mailforwardingaddress'] as $mailP) 
     250        { 
     251            $tmp = $this->mailforwardingaddress2uidnumber($mailP); 
     252            $oldOwners[$tmp['uidnumber']] = true; 
     253        } 
     254 
     255        if (!empty($params['owners'])) 
     256        { 
     257            foreach($params['owners'] as $index => $uidnumber) 
     258            { 
     259                if(array_key_exists($uidnumber, $oldOwners)) 
     260                    unset( $oldOwners[$uidnumber] ); 
     261                else 
     262                    $this->functions->write_log("User added from the institutional account",'USER: '.$uidnumber.' - SHARED ACCOUNT: '.$params['anchor']); 
     263            } 
     264        } 
     265 
     266        if(count($oldOwners) > 0) 
     267            foreach($oldOwners as $i=>$v ) 
     268            { 
     269                $this->functions->write_log("User removed from the institutional account",'USER: '.$i.' - SHARED ACCOUNT: '.$params['anchor']); 
     270            } 
     271 
     272 
     273 
    244274                $uid = 'institutional_account_' . $params['mail']; 
    245275                $dn = strtolower("uid=$uid," . $params['context']); 
     
    295325                if (!empty($params['owners'])) 
    296326                { 
    297                         foreach($params['owners'] as $index=>$uidnumber) 
     327                        foreach($params['owners'] as $index => $uidnumber) 
    298328                        { 
    299329                                $mailForwardingAddress = $this->uidnumber2mail($uidnumber); 
     
    311341                        $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap); 
    312342                } 
     343 
     344 
     345        $this->functions->write_log('Update institutional account','Old DN:'.$params['anchor'].' New DN '.$dn); 
    313346 
    314347                return $result; 
     
    28522885                        return $return; 
    28532886                } 
    2854                  
     2887 
     2888        $this->db_functions->write_log('Removed institutional account',$dn); 
     2889 
    28552890                return $return; 
    28562891        } 
  • trunk/expressoAdmin1_2/inc/class.shared_accounts.inc.php

    r7655 r7769  
    5050                                   $result &= $this->db_functions->save_calendar_acls($this->ldap_functions->uid2uidnumber($user),$acl,$owner); 
    5151                                } 
     52                $this->db_functions->write_log('Create Shared account',$params['uid']); 
     53                        } 
    5254 
    53                         }                
     55 
    5456                        return $return; 
    5557                } 
     
    6264                        $result = $this->ldap_functions->save_shared_accounts($params); 
    6365 
    64  
    65                         if( $result['status']){ 
    66                             $result = $this->imap_functions->save_shared_account($params);                             
    67  
     66            if( $result['status']){ 
     67                            $result = $this->imap_functions->save_shared_account($params); 
    6868                            $owners_calendar_acl_new = unserialize($params['owners_calendar_acl']); 
    6969 
     
    7272                              $this->db_functions->save_calendar_acls($this->ldap_functions->uid2uidnumber($user),$acl,$owner); 
    7373                            } 
     74 
     75                            $this->db_functions->write_log('Update Shared account','Old UID:'.$params['old_uid'].' New UID '.$params['uid']); 
    7476                        } 
    7577 
     
    161163                function delete($params){ 
    162164                    $result = $this->ldap_functions->delete_shared_account_data($params); 
    163                     if( $result['status'] ) $result = $this->imap_functions->delete_mailbox($params['uid']); 
     165                    if( $result['status'] ) 
     166                    { 
     167                        $result = $this->imap_functions->delete_mailbox($params['uid']); 
     168                        $this->db_functions->write_log('Removed Shared account',$params['uid']); 
     169                    } 
    164170                    return $result; 
    165171                } 
Note: See TracChangeset for help on using the changeset viewer.