Ignore:
Timestamp:
01/04/10 11:25:23 (15 years ago)
Author:
valmir.sena
Message:

Ticket #858 - Alterar o comportamento do envio de mensagens por um usuário de uma conta compartilhada

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.ldap_functions.inc.php

    r1740 r1912  
    689689        function getSharedUsersFrom($params){ 
    690690                $filter = ''; 
    691                 $i = 0; 
     691                $i = 0;          
     692                //Added to save if must save sent messages in shared folder 
     693                $acl_save_sent_in_shared = array(); 
     694                 
    692695                if($params['uids']) { 
    693696                        $uids = explode(";",$params['uids']); 
    694                         $this->imap = new imap_functions(); 
     697                        $this->imap = new imap_functions();                      
    695698                        foreach($uids as $index => $uid){ 
    696699                                $params = array(); 
     700                                //Added to save if user has create permission  
     701                                $acl_create_message = array(); 
    697702                                $acl = $this->imap->getacltouser($uid); 
    698                                 if(preg_match("/a/",$acl)) 
    699                                         $filter .= "(uid=$uid)"; 
    700                         } 
    701                 } 
    702  
     703                                if ( preg_match("/a/",$acl )){                           
     704                                        $filter .= "(uid=$uid)";                                         
     705                                        if ( preg_match("/p/",$acl )){                           
     706                                                $acl_save_sent_in_shared[ $i ] =$uid; 
     707                                                $i++; 
     708                                        }                                        
     709                                }                                                        
     710                        }                        
     711                } 
     712                 
    703713                $this->ldapRootConnect(false); 
    704714                if ($this->ds) { 
    705                         $justthese = array("cn","mail"); 
     715                        $justthese = array("cn","mail","uid"); 
    706716                        if($filter) { 
    707                                 $filter="(&(phpgwAccountType=u)(|$filter))"; 
     717                                $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=s))(|$filter))"; 
    708718                                $sr             =       ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 
    709719                                ldap_sort($this->ds,$sr,"cn"); 
    710720                                $info   =       ldap_get_entries($this->ds, $sr); 
    711                                 for ($i = 0;$i < $info["count"]; $i++) 
     721                                $var = print_r($acl_save_sent_in_shared, true);                          
     722                                for ($i = 0;$i < $info["count"]; $i++){ 
    712723                                        $info[$i]['cn'][0] = utf8_decode($info[$i]['cn'][0]); 
    713                         } 
     724                                        //verify if user has permission to save sent messages in a shared folder 
     725                                        if ( in_array( $info[$i]['uid'][0],$acl_save_sent_in_shared) ){                                          
     726                                                $info[$i]['save_shared'][0] = 'y'; 
     727                                        } else $info[$i]['save_shared'][0] = 'n'; 
     728                                } 
     729                        } 
     730                 
    714731                        $info['myname'] = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 
    715732 
     
    728745                                for ($j = 0;$j < $result["count"]; $j++){ 
    729746                                        $info[$i]['cn'][0] = utf8_decode($result[$j]['cn'][0]); 
    730                                         $info[$i++]['mail'][0] = $result[$j]['mail'][0]; 
     747                                        $info[$i]['mail'][0] = $result[$j]['mail'][0]; 
     748                                        $info[$i]['save_shared'][0] = 'n'; 
     749                                        $info[$i++]['uid'][0] = $result[$j]['uid'][0];                                   
    731750                                } 
    732751                        } 
    733752 
    734753                        $_SESSION['phpgw_info']['expressomail']['user']['shared_mailboxes'] = $info; 
    735  
     754                         
    736755                        return $info; 
    737756                } 
Note: See TracChangeset for help on using the changeset viewer.