Changeset 3887
- Timestamp:
- 03/22/11 10:26:07 (12 years ago)
- Location:
- branches/2.2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/doc-expressolivre/debian/arqs-conf/etc/ldap/schema/phpgwquotacontrolled.schema
r3851 r3887 41 41 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42 42 43 44 attributetype ( 1.3.6.1.4.1.9554.203 45 NAME 'fileManagerQuota' 46 DESC 'Quota total atual da organizaç( em GB )' 47 EQUALITY integerMatch 48 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 49 43 50 # Objectclass definition for phpgwQuotaControlled 44 51 objectclass ( 1.3.6.1.4.1.9554.300 NAME 'phpgwQuotaControlled' SUP top AUXILIARY 45 52 DESC 'Abstraction of objects that has quota' 46 MAY ( usersQuota $ diskQuota ))53 MAY ( usersQuota $ diskQuota $ fileManagerQuota)) 47 54 -
branches/2.2/doc-expressolivre/rhel5-centos5/arqs-conf-rhel5/etc/openldap/schema/phpgwquotacontrolled.schema
r3851 r3887 41 41 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42 42 43 attributetype ( 1.3.6.1.4.1.9554.203 44 NAME 'fileManagerQuota' 45 DESC 'Quota total atual da organizaç( em GB )' 46 EQUALITY integerMatch 47 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 48 43 49 # Objectclass definition for phpgwQuotaControlled 44 50 objectclass ( 1.3.6.1.4.1.9554.300 NAME 'phpgwQuotaControlled' SUP top AUXILIARY 45 51 DESC 'Abstraction of objects that has quota' 46 MAY ( usersQuota $ diskQuota)) 47 52 MAY ( usersQuota $ diskQuota $ fileManagerQuota)) -
branches/2.2/doc-expressolivre/suse/arqs-conf-suse/etc/openldap/schema/phpgwquotacontrolled.schema
r3851 r3887 40 40 EQUALITY integerMatch 41 41 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42 42 43 attributetype ( 1.3.6.1.4.1.9554.203 44 NAME 'fileManagerQuota' 45 DESC 'Quota total atual da organizaç( em GB )' 46 EQUALITY integerMatch 47 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 48 43 49 # Objectclass definition for phpgwQuotaControlled 44 50 objectclass ( 1.3.6.1.4.1.9554.300 NAME 'phpgwQuotaControlled' SUP top AUXILIARY 45 51 DESC 'Abstraction of objects that has quota' 46 MAY ( usersQuota $ diskQuota ))52 MAY ( usersQuota $ diskQuota $ fileManagerQuota)) 47 53 -
branches/2.2/expressoAdmin1_2/inc/class.bosectors.inc.php
r3850 r3887 86 86 } 87 87 88 if( isset($_POST['file_manager_quota']) ) 89 { 90 $controlled_by_quota = true; 91 $sector_info['fileManagerQuota'] = (trim($_POST['file_manager_quota']) != "") ? $_POST['file_manager_quota'] : "0"; 92 } 93 88 94 if($controlled_by_quota) 89 95 $sector_info['objectClass'][] = 'phpgwQuotaControlled'; … … 136 142 137 143 //Modifica o conteúdo das cotas. 138 if( (isset($_POST['disk_quota']) ) && (isset($_POST['users_quota']) ) ) { //se for passado alguma coisa, lógico 144 if( (isset($_POST['disk_quota']) ) 145 || (isset($_POST['users_quota']) ) 146 || (isset($_POST['file_manager_quota']) )) { //se for passado alguma coisa, lógico 139 147 if(!$controlled_by_quota) { 140 148 $ldap_mod_add['objectClass'][] = 'phpgwQuotaControlled'; … … 145 153 $ldap_mod_replace['diskQuota'] = $_POST['disk_quota']; 146 154 $ldap_mod_replace['usersQuota'] = $_POST['users_quota']; 155 $ldap_mod_replace['fileManagerQuota'] = $_POST['file_manager_quota']; 147 156 $this->so->replace_attribute($sector_info[0]['dn'], $ldap_mod_replace); 148 157 } -
branches/2.2/expressoAdmin1_2/inc/class.functions.inc.php
r3549 r3887 683 683 } 684 684 685 //Checa se existe quota em disco para mais um usu ᅵrio no setor... se existir retorna true, senᅵo false.685 //Checa se existe quota em disco para mais um usuário no setor... se existir retorna true, senão false. 686 686 function existe_quota_disco($setor,$quota_novo_usuario) { 687 687 settype($quota_novo_usuario,"float"); 688 $quota_novo_usuario /= 1024; //A quota v ᅵm da interface em megabytes, deve se tornar gigabyte.688 $quota_novo_usuario /= 1024; //A quota vêm da interface em megabytes, deve se tornar gigabyte. 689 689 690 690 $nova_quota = $this->get_actual_disk_usage($setor['dn']) + $quota_novo_usuario; … … 695 695 } 696 696 697 function has_file_disk_quota($home_directory,$quota) { 698 $uid = substr($home_directory,strpos($home_directory,"/home/")+6); 699 $context = $this->get_ou_context_from_uid($uid); 700 701 $sector = $this->get_info($context); 702 $new_quota = $this->get_actual_disk_usage($sector[0]['dn'],'FileManager',$uid) + $quota; 703 if(( $new_quota > $sector[0]['filemanagerquota'][0] ) && ($sector[0]['filemanagerquota'][0] != -1)) { 704 return false; 705 } 706 return true; 707 } 708 709 function get_ou_context_from_uid($uid,$referral = false) { 710 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 711 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 712 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 713 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 714 715 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 716 717 if ($referral) 718 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 1); 719 else 720 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 721 722 ldap_bind($ldap_conn,$dn,$passwd); 723 $filter="(&(objectClass=phpgwAccount)(uid=$uid))"; 724 $search=ldap_search($ldap_conn, $context, $filter); 725 $result = ldap_get_entries($ldap_conn, $search); 726 727 if($result['count']>0){ 728 $dn = $result[0]['dn']; 729 return substr($dn,strpos($dn,$uid.",")+strlen($uid.",")); 730 } 731 else 732 return false; 733 } 734 697 735 // Soma as quotas de todos os usuᅵrios daquele contexto. 698 function get_actual_disk_usage($context ) {736 function get_actual_disk_usage($context,$app='expressoMail',$user=null) { 699 737 $quota_usada=0; 700 738 $contexts = array($context); 701 739 $usuarios = $this->get_list('accounts', '', $contexts); 702 740 703 $imap_functions = new imap_functions(); 704 foreach($usuarios as $usuario) { 705 $temp = $imap_functions->get_user_info($usuario['account_lid']); 706 if($temp['mailquota'] != -1) //Usuᅵrio sem cota nᅵo conta... 707 $quota_usada += ($temp['mailquota'] / 1024); 741 if($app=='expressoMail') { 742 $imap_functions = new imap_functions(); 743 foreach($usuarios as $usuario) { 744 $temp = $imap_functions->get_user_info($usuario['account_lid']); 745 if($temp['mailquota'] != -1) //Usuᅵrio sem cota nᅵo conta... 746 $quota_usada += ($temp['mailquota'] / 1024); 747 } 748 } 749 else if($app=='FileManager'){ //FileManager 750 $uids = ''; 751 foreach($usuarios as $usuario) { 752 if($usuario['account_lid']!=$user) 753 $uids.="'/home/".$usuario['account_lid']."',"; 754 } 755 $uids.="'a'"; //hack the last comma 756 $query = "select 1 as num,sum(quota_size) as quota from phpgw_vfs_quota where directory in ($uids) group by num"; 757 $GLOBALS['phpgw']->db->query($query); 758 if($GLOBALS['phpgw']->db->next_record()) 759 { 760 $result = $GLOBALS['phpgw']->db->row(); 761 $quota_usada = $result["quota"]; 762 } 708 763 } 709 764 return $quota_usada; -
branches/2.2/expressoAdmin1_2/inc/class.uisectors.inc.php
r3359 r3887 196 196 'disk_quota' => $_POST['disk_quota'], 197 197 'users_quota' => $_POST['users_quota'], 198 'file_manager_quota'=> $_POST['file_manager_quota'], 198 199 'manager_org' => $combo_manager_org, 199 200 'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', … … 251 252 $sector_disk_quota = $sector_info[0]['diskquota'][0]; 252 253 $sector_users_quota = $sector_info[0]['usersquota'][0]; 254 $sector_file_manager_quota = $sector_info[0]['filemanagerquota'][0]; 253 255 $sector_associated_domain = $sector_info[0]['associateddomain'][0]; 254 256 $_POST['sector_visible'] = $sector_info[0]['phpgwaccountvisible'][0]; … … 267 269 'disk_quota' => $_POST['disk_quota'] == '' ? $sector_disk_quota : $_POST['disk_quota'], 268 270 'users_quota' => $_POST['users_quota'] == '' ? $sector_users_quota : $_POST['users_quota'], 271 'file_manager_quota'=> $_POST['file_manager_quota'] == '' ? $sector_file_manager_quota : $_POST['file_manager_quota'], 269 272 'lang_add' => lang('Add'), 270 273 'disable' => 'disabled', -
branches/2.2/expressoAdmin1_2/templates/default/sectors_form.tpl
r1991 r3887 49 49 </td> 50 50 </tr> 51 <tr> 52 <td> 53 {lang_file_manager_quota}: 54 </td> 55 <td> 56 <input type="text" autocomplete="off" name="file_manager_quota" value={file_manager_quota}> 57 </td> 58 </tr> 51 59 {close_comment_cotas} 52 60 <tr> -
branches/2.2/filemanager/inc/class.uiconfig.inc.php
r3875 r3887 480 480 $size = ($_POST['val']) * 1; 481 481 482 $eAdminDbFunctions = CreateObject('expressoAdmin1_2.db_functions'); 483 if($eAdminDbFunctions->use_cota_control()) { 484 $eAdminFunctions = CreateObject('expressoAdmin1_2.functions'); 485 486 if(!$eAdminFunctions->has_file_disk_quota($name,$size)){ 487 echo lang("not enough quota"); 488 return; 489 } 490 491 } 492 482 493 /* See if quota exists or not */ 483 494 $query = "SELECT count(directory) FROM phpgw_vfs_quota WHERE directory = '".$name."' LIMIT 1";
Note: See TracChangeset
for help on using the changeset viewer.