Changeset 1913


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

Ticket #849 - Criacao de caixas compartilhadas pelo administrador, commit inicial com as principais mudancas

Location:
trunk
Files:
8 added
11 edited

Legend:

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

    r1516 r1913  
    8989                                        if ($array_acl[acl_add_institutional_accounts] || $array_acl[acl_edit_institutional_accounts] || $array_acl[acl_delete_institutional_accounts]) 
    9090                                                return true; 
     91                                        break; 
     92                                case list_shared_accounts: 
     93                                        if ($array_acl[acl_add_shared_accounts] || $array_acl[acl_edit_shared_accounts] || $array_acl[acl_delete_shared_accounts]) 
     94                                                return true; 
    9195                                        break; 
    9296 
     
    298302                // Last acl:    8.589.934.592 -> edit institutional accounts 
    299303                // Last acl:   17.179.869.184 -> remove institutional accounts 
     304                // Last acl:   34.359.738.368 -> add share accounts 
     305                // Last acl:   68.719.476.736 -> edit share accounts 
     306                // Last acl:  137.438.953.472 -> delete share accounts 
     307                // Last acl:  274.877.906.944 -> edit share accounts acl 
     308                // Last acl:  549.755.813.888 -> edit quota share quote 
     309                // Last acl:  1.099.511.627.776 -> empty share accounts inbox 
     310 
    300311                function make_array_acl($acl) 
    301312                { 
     
    335346                                                                "acl_add_institutional_accounts", 
    336347                                                                "acl_edit_institutional_accounts", 
    337                                                                 "acl_remove_institutional_accounts" 
     348                                                                "acl_remove_institutional_accounts", 
     349                                                                "acl_add_shared_accounts", 
     350                                                                "acl_edit_shared_accounts", 
     351                                                                "acl_delete_shared_accounts", 
     352                                                                "acl_edit_shared_accounts_acl", 
     353                                                                "acl_edit_shared_accounts_quote", 
     354                                                                "acl_empty_shared_accounts_inbox" 
    338355                                                                ); 
    339                          
     356 
    340357                        foreach ($tmp as $index => $right) 
    341358                        { 
  • trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php

    r1523 r1913  
    126126        } 
    127127         
    128         function delete_user($uid) 
     128        function delete_mailbox($uid) 
    129129        { 
    130130                $result['status'] = true; 
     
    137137                { 
    138138                        $result['status'] = false; 
    139                         $result['msg'] = $this->functions->lang('it was not possible to delete users mailbox') . ".\n"; 
     139                        $result['msg'] = $this->functions->lang('it was not possible to delete mailbox') . ".\n"; 
    140140                        $result['msg'] .= $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
    141141                } 
     
    193193                return $result; 
    194194        } 
    195          
     195        function empty_user_inbox($params){ 
     196               if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox')) 
     197                { 
     198                        $result['status'] = false; 
     199                        $result['msg'] = $this->functions->lang('You do not have access to clean an user inbox'); 
     200                        return $result; 
     201                } else return $this->empty_inbox($params); 
     202                 
     203        } 
     204        function empty_shared_account_inbox($params){ 
     205            if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_shared_accounts_inbox')) 
     206                { 
     207                        $result['status'] = false; 
     208                        $result['msg'] = $this->functions->lang('You do not have right to empty an shared account inbox'); 
     209                        return $result; 
     210                } else return $this->empty_inbox($params); 
     211        } 
    196212        function empty_inbox($params) 
    197213        { 
    198214                // Verifica o acesso do gerente 
    199                 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox')) 
    200                 { 
    201                         $result['status'] = false; 
    202                         $result['msg'] = $this->functions->lang('You do not have access to clean an user inbox'); 
    203                         return $result; 
    204                 } 
    205                  
    206                 if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 
     215                if (!($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox') || 
     216                      $this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_shared_accounts_inbox') 
     217                  )) 
     218                { 
     219                        $result['status'] = false; 
     220                        $result['msg'] = $this->functions->lang('You do not have access to clean an inbox'); 
     221                        return $result; 
     222                } 
     223 
     224                if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 
    207225                { 
    208226                        $imap_options = '/tls/novalidate-cert'; 
     
    241259                        { 
    242260                                $result['status'] = false; 
    243                                 $result['msg'] = $this->functions->lang('It was not possible clean the users inbox') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
     261                                $result['msg'] = $this->functions->lang('It was not possible clean the inbox') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
    244262                        } 
    245263                } 
     
    251269                return $result; 
    252270        } 
     271        function getaclfrombox($params) 
     272        { 
     273                $boxacl = $params['uid']; 
     274                 
     275                $return = array();       
     276                 
     277                $mbox_acl = imap_getacl($this->imap, "user" . $this->imapDelimiter . $boxacl); 
     278                 
     279                foreach ($mbox_acl as $user => $acl) 
     280                { 
     281                        if ($user != $boxacl ) 
     282                        { 
     283                                $return[$user] = $acl; 
     284                        } 
     285                } 
     286                return $return; 
     287        } 
     288        function setaclfrombox($user, $acl, $mailbox) 
     289        { 
     290                $serverString = '{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}'; 
     291                $mailboxes_list = imap_getmailboxes($this->imap, $serverString, "user".$this->imapDelimiter.$mailbox.$this->imapDelimiter."*");                 
     292                $result = Array(); 
     293                $result['status'] = true; 
     294                if (is_array($mailboxes_list)) 
     295                { 
     296                        $folder = str_replace($serverString, "", imap_utf7_encode("user".$this->imapDelimiter.$mailbox)); 
     297                        $folder = str_replace("&-", "&", $folder); 
     298 
     299                        if (imap_setacl ($this->imap, $folder, $user, $acl) ) { 
     300                            foreach ($mailboxes_list as $key => $val) 
     301                            { 
     302                                    $folder = str_replace($serverString, "", imap_utf7_encode($val->name)); 
     303                                    $folder = str_replace("&-", "&", $folder); 
     304                                    if (!imap_setacl ($this->imap, $folder, $user, $acl)) 
     305                                    { 
     306                                            $result['status'] = false; 
     307                                            $result['msg']  = $this->functions->lang('Error on function') . ' imap_functions->setaclfrombox: imap_setacl'; 
     308                                            $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . imap_last_error(); 
     309                                            break; 
     310                                    } 
     311                            } 
     312                        } else { 
     313                            $result['status'] = false; 
     314                            $result['msg']  = $this->functions->lang('Error on function') . ' imap_functions->setaclfrombox: imap_setacl'; 
     315                            $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . imap_last_error(); 
     316                            break; 
     317                        } 
     318                } 
     319                return $result; 
     320        } 
     321        function save_shared_account($params){            
     322            //Rename mailbox 
     323            $result = Array(); 
     324            $result['status'] = true; 
     325            if($params['uid'] != $params['old_uid'] ){ 
     326                    $result = $this->rename_mailbox($params['old_uid'], $params['uid']); 
     327                    if(!$result['status']) return $result; 
     328            } 
     329 
     330            //Begin edit Quota 
     331            $quota = $this->get_user_info($params['uid'] ); 
     332 
     333            if ( $quota['mailquota'] != $params['mailquota'] ){ 
     334                    if(!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_shared_accounts_quote') ) 
     335                    { 
     336                                $result['status'] = false; 
     337                                $result['msg'] = $this->functions->lang('You do not have access to edit an shared account inbox quota'); 
     338                                return $result; 
     339                    } else $this->change_user_quota($params['old_uid'], $params['mailquota']); 
     340            } 
     341            //End Edit Quota 
     342  
     343            /* Begin Set ACL */ 
     344            //Old users set in the box 
     345            $owners_acl_old = $this->getaclfrombox($params); 
     346            //new settings 
     347            $owners_acl_new = unserialize($params['owners_acl']); 
     348 
     349            $owners_to_remove = array_diff_assoc($owners_acl_old,$owners_acl_new); 
     350            $owners_to_add = array_diff_assoc($owners_acl_new,$owners_acl_old); 
     351 
     352            //Find modified users 
     353            $tmp_update = array_diff_assoc($owners_acl_old,$owners_to_remove); 
     354            $owners_to_update = Array(); 
     355            foreach($tmp_update  as $user => $acl){ 
     356                if($owners_acl_old[$user] != $acl){ 
     357                    $owners_to_update[$user] = $acl; 
     358                } 
     359            } 
     360             
     361            //Check Modify manage acl 
     362             
     363            if( (count($owners_to_remove) > 0 || count($owners_to_add) > 0 || count($owners_to_update) > 0) && !$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_shared_accounts_acl') ){ 
     364                $result['status'] = false; 
     365                $result['msg'] = $this->functions->lang('You do not have access to edit an shared account inbox acl'); 
     366                return $result; 
     367            } 
     368             
     369            if( is_array($owners_acl_new)){ 
     370                foreach($owners_to_remove as $user => $acl){ 
     371                    $params['user'] = $user; 
     372                    $params['acl'] = "none"; 
     373                    $user = $params['user']; 
     374                    $result = $this->setaclfrombox($user,"none",$params['uid']); 
     375                } 
     376                //add new users 
     377                foreach($owners_to_add as $user => $acl){ 
     378                    $params['user'] = $user; 
     379                    $params['acl'] = $acl; 
     380                    $result = $this->setaclfrombox($user,$acl,$params['uid']); 
     381                } 
     382                //update users 
     383                 foreach($owners_to_update as $user => $acl){ 
     384                    $params['user'] = $user; 
     385                    $params['acl'] = $acl; 
     386                    $result = $this->setaclfrombox($user,$acl,$params['uid']); 
     387                }                
     388            } 
     389            /* End Set Acl */ 
     390            return $result; 
     391        } 
    253392} 
  • trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php

    r1867 r1913  
    4545                $this->manager_contexts = $manager_acl['contexts']; 
    4646        } 
     47 
     48        function create_shared_accounts($params) 
     49                { 
     50                        /* Begin: Access verification */ 
     51                         
     52                        if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'add_shared_accounts')) 
     53                        { 
     54                                $return['status'] = false; 
     55                                $return['msg'] = $this->functions->lang('You do not have right to create shared accounts') . "."; 
     56                                return $return; 
     57                        } 
     58                         
     59                        $access_granted = false; 
     60                        foreach ($this->manager_contexts as $idx=>$manager_context) 
     61                        { 
     62                                if (stristr($params['context'], $manager_context)) 
     63                                { 
     64                                        $access_granted = true; 
     65                                        break; 
     66                                } 
     67                        } 
     68                         
     69                        if (!$access_granted) 
     70                        { 
     71                                $return['status'] = false;                               
     72                                $return['msg'] = $this->functions->lang('You do not have access to this organization') . ".";                                                    
     73                                return $return; 
     74                        }                        
     75                        /* End: Access verification */ 
     76         
     77                                 
     78                        /* Begin: Validation */ 
     79                        if ( (empty($params['cn'])) || (empty($params['mail'])) ) 
     80                        { 
     81                                $result['status'] = false; 
     82                                $result['msg']  = $this->functions->lang('Field mail or name is empty');        return $result; 
     83                        } 
     84         
     85                        if (! eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $params['mail']) ) 
     86                        { 
     87                                $result['status'] = false; 
     88                                $result['msg']  = $this->functions->lang('Field mail is not formed correcty') . '.'; 
     89                                return $result; 
     90                        }                                          
     91                        $dn = "uid=$params[uid]," . $params['context']; 
     92                        $filter = "(mail=".$params['mail'].")"; 
     93                        $justthese = array("cn"); 
     94                        $search = @ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     95                        $entries = @ldap_get_entries($this->ldap,$search); 
     96                        if ($entries['count'] != 0) 
     97                        { 
     98                                $result['status'] = false; 
     99                                $result['msg'] = $this->functions->lang('Field mail already in use'); 
     100                                return $result; 
     101                        } 
     102                        /* End: Validation */ 
     103                                                         
     104                        $info = array(); 
     105                        $info['cn']                                     = $params['cn']; 
     106                        $info['sn']                                     = $params['cn']; 
     107                        $info['uid']                            = $params['uid']; 
     108                        $info['mail']                           = $params['mail']; 
     109                        $info['description'] = utf8_encode($params['description']);                      
     110                        $info['phpgwAccountType']       = 's'; 
     111                        $info['objectClass'][]          = 'inetOrgPerson'; 
     112                        $info['objectClass'][]          = 'phpgwAccount'; 
     113                        $info['objectClass'][]          = 'top'; 
     114                        $info['objectClass'][]          = 'person'; 
     115                        $info['objectClass'][]          = 'qmailUser'; 
     116                        $info['objectClass'][]          = 'organizationalPerson'; 
     117                         
     118                        if ($params['accountStatus'] == 'on') 
     119                        { 
     120                                $info['accountStatus'] = 'active'; 
     121                        } 
     122                        if ($params['phpgwAccountVisible'] == 'on') 
     123                        { 
     124                                $info['phpgwAccountVisible'] = '-1'; 
     125                        } 
     126                         
     127                        /*if (!empty($params['owners'])) 
     128                        { 
     129                                foreach($params['owners'] as $index=>$uidnumber) 
     130                                { 
     131                                        $info['mailForwardingAddress'][] = $this->uidnumber2mail($uidnumber); 
     132                                } 
     133                        }*/ 
     134                        $result = array(); 
     135                        //print_r($info);exit(); 
     136                        if (!@ldap_add ( $this->ldap, $dn, $info )) 
     137                        { 
     138                                $result['status'] = false; 
     139                                $result['msg']  = $this->functions->lang('Error on function') . ' ldap_functions->create_shared_accounts'; 
     140                                $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap); 
     141                        } 
     142                        else{ 
     143                                $result['status'] = true;                                                        
     144                        } 
     145                        return $result; 
     146                } 
    47147         
    48148        /* expressoAdmin: email lists : deve utilizar o ldap Host Master com o usuario e senha do CC*/ 
     
    601701        return $options; 
    602702        } 
    603  
     703        //Busca usuarios de um contexto e ja retorna as options do select; 
     704        function get_available_users2($params) 
     705        { 
     706                $context= $params['context']; 
     707                $justthese = array("cn", "uid"); 
     708                $filter = "(&(phpgwaccounttype=u)(!(phpgwaccountvisible=-1)))"; 
     709 
     710            if ($this->ldap) 
     711            { 
     712                        $sr=ldap_search($this->ldap, $context, $filter, $justthese); 
     713                        $entries = ldap_get_entries($this->ldap, $sr);                   
     714 
     715                        for ($i=0; $i<$entries["count"]; $i++){                          
     716                                        $u_tmp[$entries[$i]["uid"][0]] = $entries[$i]["cn"][0]; 
     717                        } 
     718 
     719                        natcasesort($u_tmp); 
     720 
     721                        $i = 0; 
     722                        $users = array(); 
     723 
     724                        if (count($u_tmp)) 
     725                        { 
     726                                foreach ($u_tmp as $uidnumber => $cn) 
     727                                { 
     728                                        $options .= "<option value=$uidnumber>$cn</option>"; 
     729                                } 
     730                                unset($u_tmp); 
     731                        }                        
     732                return $options; 
     733                } 
     734        } 
    604735        //Busca usuários e listas de um contexto e já retorna as options do select; 
    605736        function get_available_users_and_maillist($params) 
     
    13821513                return $entry[0]['uid'][0]; 
    13831514        } 
     1515         
     1516        function uid2cn($uid) 
     1517        { 
     1518                $justthese = array("cn"); 
     1519                $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=".$uid."))"; 
     1520                $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     1521                $entry = ldap_get_entries($this->ldap, $search); 
     1522                return $entry[0]['cn'][0]; 
     1523        } 
    13841524 
    13851525        function uidnumber2mail($uidnumber) 
     
    21242264        $return['trs'] = $trs_string; 
    21252265        return $return; 
    2126         } 
     2266}        
    21272267         
    21282268        function get_institutional_account_data($params) 
     
    21312271                { 
    21322272                        $return['status'] = false; 
    2133                         $return['msg'] = $this->functions->lang('You do not have right to list institutional accounts') . "."; 
     2273                        $return['msg'] = $this->functions->lang('You do not have right to edit institutional accounts') . "."; 
    21342274                        return $return; 
    21352275                } 
     
    21802320                return $return; 
    21812321        } 
    2182          
     2322        function get_shared_accounts($params) 
     2323                { 
     2324                if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'list_shared_accounts')) 
     2325                { 
     2326                        $return['status'] = false; 
     2327                        $return['msg'] = $this->functions->lang('You do not have right to list shared accounts') . "."; 
     2328                        return $return; 
     2329                } 
     2330 
     2331                $input = $params['input']; 
     2332                $justthese = array("cn", "mail", "uid"); 
     2333                $trs = array(); 
     2334                                 
     2335                foreach ($this->manager_contexts as $idx=>$context) 
     2336                { 
     2337                $institutional_accounts = ldap_search($this->ldap, $context, ("(&(phpgwAccountType=s)(|(mail=$input*)(cn=*$input*)))"), $justthese); 
     2338                $entries = ldap_get_entries($this->ldap, $institutional_accounts); 
     2339                 
     2340                        for ($i=0; $i<$entries['count']; $i++) 
     2341                        { 
     2342                                $tr = "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['cn'][0] . "</td><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['mail'][0] . "</td><td align='center' onClick=delete_shared_accounts('".$entries[$i]['uid'][0]."')><img HEIGHT='16' WIDTH='16' src=./expressoAdmin1_2/templates/default/images/delete.png></td></tr>"; 
     2343                                $trs[$tr] = $entries[$i]['cn'][0]; 
     2344                        } 
     2345                } 
     2346         
     2347        $trs_string = ''; 
     2348        if (count($trs)) 
     2349        { 
     2350                natcasesort($trs); 
     2351                foreach ($trs as $tr=>$cn) 
     2352                { 
     2353                        $trs_string .= $tr; 
     2354                } 
     2355        } 
     2356         
     2357        $return['status'] = 'true'; 
     2358        $return['trs'] = $trs_string; 
     2359        return $return; 
     2360        } 
     2361         
     2362        function save_shared_accounts($params) 
     2363        { 
     2364                        /* Begin: Access verification */ 
     2365                        if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'edit_shared_accounts')) 
     2366                        { 
     2367                                $return['status'] = false; 
     2368                                $return['msg'] = $this->functions->lang('You do not have right to edit shared accounts') . "."; 
     2369                                return $return; 
     2370                        } 
     2371                        $access_granted = false; 
     2372                        foreach ($this->manager_contexts as $idx=>$manager_context) 
     2373                        { 
     2374                                if (stristr($params['context'], $manager_context)) 
     2375                                { 
     2376                                        $access_granted = true; 
     2377                                        break; 
     2378                                } 
     2379                        } 
     2380                        if (!$access_granted) 
     2381                        { 
     2382                                $return['status'] = false; 
     2383                                $return['msg'] = $this->functions->lang('You do not have access to this organization') . "."; 
     2384                                return $return; 
     2385                        } 
     2386                        /* End: Access verification */ 
     2387                         
     2388                        /* Begin: Validation */ 
     2389                        if ( (empty($params['cn'])) || (empty($params['mail'])) ) 
     2390                        { 
     2391                                $result['status'] = false; 
     2392                                $result['msg']  = $this->functions->lang('Field mail or name is empty') . '.'; 
     2393                                return $result; 
     2394                        } 
     2395         
     2396                        if (! eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $params['mail']) ) 
     2397                        { 
     2398                                $result['status'] = false; 
     2399                                $result['msg']  = $this->functions->lang('Field mail is not formed correcty') . '.'; 
     2400                                return $result; 
     2401                        }                        
     2402                         
     2403                        $dn = strtolower("uid=$params[uid]," . $params['context']); 
     2404                        $anchor = strtolower($params['anchor']); 
     2405                         
     2406                        $filter = "(mail=".$params['mail'].")"; 
     2407                        $justthese = array("cn"); 
     2408                        $search = @ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     2409                        $entries = @ldap_get_entries($this->ldap,$search); 
     2410                         
     2411                        if ( ($entries['count'] > 1) || (($entries['count'] == 1) && ($entries[0]['dn'] != $anchor)) ) 
     2412                        { 
     2413                                $result['status'] = false; 
     2414                                $result['msg'] = $this->functions->lang('Field mail already in use.'); 
     2415                                return $result; 
     2416                        } 
     2417                        /* End: Validation */ 
     2418 
     2419                        $result = array(); 
     2420                        $result['status'] = true; 
     2421                         
     2422                        if ($anchor != $dn) 
     2423                        { 
     2424                                if (!@ldap_rename($this->ldap, $anchor, "uid=$params[uid]", $params['context'], true)) 
     2425                                { 
     2426                                        $result['status'] = false; 
     2427                                        $result['msg']  = $this->functions->lang('Error on function') . ' ldap_functions->save_shared_accounts: ldap_rename'; 
     2428                                        $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap); 
     2429                                } 
     2430                        } 
     2431                         
     2432                        $info = array(); 
     2433                        $info['cn']                                     = $params['cn']; 
     2434                        $info['sn']                                     = $params['cn']; 
     2435                        $info['uid']                            = $params['uid']; 
     2436                        $info['mail']                           = $params['mail']; 
     2437                         
     2438                        if ($params['accountStatus'] == 'on') 
     2439                                $info['accountStatus'] = 'active'; 
     2440                        else 
     2441                                $info['accountStatus'] = array(); 
     2442                         
     2443                        if ($params['phpgwAccountVisible'] == 'on') 
     2444                                $info['phpgwAccountVisible'] = '-1'; 
     2445                        else 
     2446                                $info['phpgwAccountVisible'] = array(); 
     2447                         
     2448                        if ($params['description'] != '') 
     2449                                $info['description'] = utf8_encode($params['description']); 
     2450                        else 
     2451                                $info['description'] = array(); 
     2452                         
     2453                        if (!@ldap_modify ( $this->ldap, $dn, $info )) 
     2454                        { 
     2455                                $result['status'] = false; 
     2456                                $result['msg']  = $this->functions->lang('Error on function') . ' ldap_functions->save_shared_accounts: ldap_modify'; 
     2457                                $result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap); 
     2458                        } 
     2459                        //print_r($info);echo "Teste $dn".$result['msg'];exit(); 
     2460                        return $result; 
     2461        }        
     2462         
     2463        function get_shared_account_data($params) 
     2464        { 
     2465                if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'edit_shared_accounts')) 
     2466                { 
     2467                        $return['status'] = false; 
     2468                        $return['msg'] = $this->functions->lang('You do not have right to edit an shared accounts') . "."; 
     2469                        return $return; 
     2470                } 
     2471                 
     2472                $uid = $params['uid']; 
     2473                //$justthese = array("accountStatus", "phpgwAccountVisible", "cn", "mail", "mailForwardingAddress", "description"); 
     2474                                 
     2475        $shared_accounts = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], ("(&(phpgwAccountType=s)(uid=$uid))")); 
     2476        $entrie = ldap_get_entries($this->ldap, $shared_accounts); 
     2477                 
     2478                if ($entrie['count'] != 1) 
     2479                { 
     2480                        $return['status'] = 'false'; 
     2481                        $result['msg'] = $this->functions->lang('Problems loading datas') . '.'; 
     2482                } 
     2483                else 
     2484                { 
     2485                        $tmp_user_context = split(",", $entrie[0]['dn']); 
     2486                        $tmp_reverse_user_context = array_reverse($tmp_user_context); 
     2487                        array_pop($tmp_reverse_user_context); 
     2488                        $return['user_context'] = implode(",", array_reverse($tmp_reverse_user_context)); 
     2489                         
     2490                        $return['status'] = 'true'; 
     2491                        $return['accountStatus']                = $entrie[0]['accountstatus'][0]; 
     2492                        $return['phpgwAccountVisible']  = $entrie[0]['phpgwaccountvisible'][0]; 
     2493                        $return['cn']                                   = $entrie[0]['cn'][0]; 
     2494                        $return['mail']                                 = $entrie[0]['mail'][0]; 
     2495                        $return['description']                  = utf8_decode($entrie[0]['description'][0]); 
     2496                         
     2497                } 
     2498                 
     2499                return $return; 
     2500        }                
    21832501        function mailforwardingaddress2uidnumber($mail) 
    21842502        { 
     
    22592577                return $result; 
    22602578        } 
     2579        function delete_shared_account_data($params) 
     2580        { 
     2581                if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'delete_shared_accounts')) 
     2582                { 
     2583                        $return['status'] = false; 
     2584                        $return['msg'] = $this->functions->lang('You do not have right to delete shared accounts') . "."; 
     2585                        return $return; 
     2586                }                 
     2587                $uid = $params['uid']; 
     2588                $return['status'] = true; 
     2589 
     2590                $justthese = array("cn"); 
     2591        $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], "(&(phpgwAccountType=s)(uid=$uid))", $justthese); 
     2592 
     2593        $entrie = ldap_get_entries($this->ldap, $search); 
     2594         
     2595                if ($entrie['count'] > 1) 
     2596                { 
     2597                        $return['status'] = false; 
     2598                        $return['msg']  = $this->functions->lang('More then one uid was found'); 
     2599                        return $return; 
     2600                } 
     2601                if ($entrie['count'] == 0) 
     2602                { 
     2603                        $return['status'] = false; 
     2604                        $return['msg']  = $this->functions->lang('No uid was found'); 
     2605                        return $return; 
     2606                } 
     2607 
     2608                $dn = $entrie[0]['dn']; 
     2609                if (!@ldap_delete($this->ldap, $dn)) 
     2610                { 
     2611                        $return['status'] = false; 
     2612                        $return['msg']  = $this->functions->lang('Error on function') . " ldap_functions->delete_shared_accounts: ldap_delete"; 
     2613                        $return['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap); 
     2614                        return $return; 
     2615                } 
     2616 
     2617                return $return; 
     2618        } 
    22612619} 
    22622620?> 
  • trunk/expressoAdmin1_2/inc/class.manager.inc.php

    r493 r1913  
    5757                                if ($acl !== false) 
    5858                                { 
    59                                         $total_manager_acl += $value; 
     59                                        /* Valmir Andre de Sena - valmir.sena@ati.pe.gov.br 
     60                                        * changed + operation to bcadd, because php plus operation get wrong over 41 bits 
     61                                        */ 
     62                                        $total_manager_acl = bcadd( $total_manager_acl, $value); 
    6063                                } 
    6164                        } 
  • trunk/expressoAdmin1_2/inc/class.user.inc.php

    r1521 r1913  
    10341034                                         
    10351035                                        //IMAP 
    1036                                         $result_imap = $this->imap_functions->delete_user($user_info['uid']); 
     1036                                        $result_imap = $this->imap_functions->delete_mailbox($user_info['uid']); 
    10371037                                        if (!$result_imap['status']) 
    10381038                                        { 
  • trunk/expressoAdmin1_2/index.php

    r593 r1913  
    3737        $var = Array( 
    3838                'lang_user_accounts'    => lang('User Accounts'), 
     39                'lang_shared_accounts'=> lang('Shared Accounts'), 
    3940                'lang_institutional_accounts'=> lang('Institutional Accounts'), 
    4041                'lang_user_groups'              => lang('User Groups'), 
  • trunk/expressoAdmin1_2/js/jscode/users.js

    r1594 r1913  
    667667                else{ 
    668668                        cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log); 
    669                         alert(get_lang('Emptied ') + data.inbox_size + ' ' + get_lang('MB from user inbox')); 
     669                        alert(get_lang('Emptied')+' '+ data.inbox_size + ' ' + get_lang('MB from user inbox')); 
    670670                        document.getElementById('mailquota_used').value = data.mailquota_used; 
    671671                } 
    672672        } 
    673         cExecute ('$this.imap_functions.empty_inbox&uid='+uid, handler_empty_inbox); 
     673        cExecute ('$this.imap_functions.empty_user_inbox&uid='+uid, handler_empty_inbox); 
    674674} 
    675675 
  • trunk/expressoAdmin1_2/templates/default/index.tpl

    r493 r1913  
    1616                        <a href="../index.php?menuaction=expressoAdmin1_2.institutional_accounts.index">{lang_institutional_accounts}</a> 
    1717                </td> 
    18         </tr>  
     18        </tr> 
     19<tr> 
     20                <td width="1%" align="center"> 
     21                        <img src='./templates/default/images/mail_share.png'> 
     22                </td> 
     23                <td> 
     24                        <a href="../index.php?menuaction=expressoAdmin1_2.uishared_accounts.index">{lang_shared_accounts}</a> 
     25                </td> 
     26        </tr>   
    1927        <tr> 
    2028                <td width="1%" align="center"> 
  • trunk/expressoAdmin1_2/templates/default/managers_form.tpl

    r493 r1913  
    105105                                                        <td>{lang_view_user}:</td> 
    106106                                                        <td><input type="checkbox" name="acl_view_users" value="33554432" {acl_view_users}></td> 
    107                                                         <td>{lang_add_institutional_accounts}:</td> 
     107                                                        <td>{lang_add_shared_accounts}:</td> 
     108                                                        <td><input type="checkbox" name="acl_add_shared_accounts" value="34359738368" {acl_add_shared_accounts}></td> 
     109                                                        <td>{lang_add_institutional_accounts}:</td> 
    108110                                                        <td><input type="checkbox" name="acl_add_institutional_accounts" value="4294967296" {acl_add_institutional_accounts}></td> 
    109111                                                </tr> 
     
    111113                                                        <td>{lang_edit_users_picture}:</td> 
    112114                                                        <td><input type="checkbox" name="acl_edit_users_picture" value="536870912" {acl_edit_users_picture}></td> 
     115                                                        <td>{lang_edit_shared_accounts}:</td> 
     116                                                        <td><input type="checkbox" name="acl_edit_shared_accounts" value="68719476736" {acl_edit_shared_accounts}></td> 
    113117                                                        <td>{lang_edit_institutional_accounts}:</td> 
    114118                                                        <td><input type="checkbox" name="acl_edit_institutional_accounts" value="8589934592" {acl_edit_institutional_accounts}></td> 
     119 
    115120                                                </tr> 
    116121                                                <tr bgcolor="{color_font2}" align='right'> 
    117122                                                        <td>{lang_edit_users_phonenumber}:</td> 
    118123                                                        <td><input type="checkbox" name="acl_edit_users_phonenumber" value="2147483648" {acl_edit_users_phonenumber}></td> 
     124                                                        <td>{lang_delete_shared_accounts}:</td> 
     125                                                        <td><input type="checkbox" name="acl_delete_shared_accounts" value="137438953472" {acl_delete_shared_accounts}></td> 
    119126                                                        <td>{lang_remove_institutional_accounts}:</td> 
    120127                                                        <td><input type="checkbox" name="acl_remove_institutional_accounts" value="17179869184" {acl_remove_institutional_accounts}></td> 
     
    123130                                                        <td>{lang_change_users_password}:</td> 
    124131                                                        <td><input type="checkbox" name="acl_change_users_password" value="128" {acl_change_users_password}></td> 
     132                                                        <td>{lang_edit_shared_accounts_acl}:</td> 
     133                                                        <td><input type="checkbox" name="acl_edit_shared_accounts_acl" value="274877906944" {acl_edit_shared_accounts_acl}></td> 
    125134                                                </tr> 
    126135                                                <tr bgcolor="{color_font2}" align='right'> 
    127136                                                        <td>{lang_change_users_quote}:</td> 
    128137                                                        <td><input type="checkbox" name="acl_change_users_quote" value="262144" {acl_change_users_quote}></td> 
     138                                                        <td>{lang_edit_shared_accounts_quote}:</td> 
     139                                                        <td><input type="checkbox" name="acl_edit_shared_accounts_quote" value="549755813888" {acl_edit_shared_accounts_quote}></td> 
    129140                                                </tr> 
    130141                                                <tr bgcolor="{color_font1}" align='right'> 
    131142                                                        <td>{lang_set_default_users_password}:</td> 
    132143                                                        <td><input type="checkbox" name="acl_set_user_default_password" value="524288" {acl_set_user_default_password}></td> 
     144                                                        <td>{lang_empty_shared_accounts_inbox}:</td> 
     145                                                        <td><input type="checkbox" name="acl_empty_shared_accounts_inbox" value="1099511627776" {acl_empty_shared_accounts_inbox}></td> 
    133146                                                </tr> 
    134147                                                <tr bgcolor="{color_font2}" align='right'> 
  • trunk/expressoMail1_2/js/sharemailbox.js

    r1912 r1913  
    6060                                Element('em_input_writeAcl').checked = true; 
    6161                        } 
    62                         if (data[user].indexOf('p',0) >= 0) 
    63                         { 
    64                                 Element('em_input_saveAcl').checked = true; 
    65                         } 
     62                         
    6663                        if (data[user] != "false" && data[user].indexOf('a',0) >= 0) 
    6764                        { 
     
    106103                if (Element('em_input_writeAcl').checked) { 
    107104                        acl += 'wi';                     
    108                 } 
    109                  
     105                }                
    110106                if (Element('em_input_sendAcl').checked){ 
    111107                        acl += 'a';                      
    112                 } else {  
    113                         Element('em_input_saveAcl').disabled = true; 
    114                         Element('em_input_saveAcl').checked = false; 
    115                 } 
    116                  
     108                } 
    117109                if (Element('em_input_sendAcl').checked && Element('em_input_writeAcl').checked){ 
    118110                        Element('em_input_saveAcl').disabled = false;                            
Note: See TracChangeset for help on using the changeset viewer.