Changeset 33 for trunk/expressoAdmin1_2/inc
- Timestamp:
- 06/21/07 08:32:34 (17 years ago)
- Location:
- trunk/expressoAdmin1_2/inc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r32 r33 428 428 */ 429 429 430 function get_organizations($context, $selected='' )430 function get_organizations($context, $selected='', $referral=false, $show_invisible_ou=true) 431 431 { 432 432 $s = CreateObject('phpgwapi.sector_search_ldap'); 433 $sectors_info = $s->get_organizations($context, $selected, false, true);433 $sectors_info = $s->get_organizations($context, $selected, $referral, $show_invisible_ou); 434 434 return $sectors_info; 435 435 } 436 436 437 function get_sectors($selected='', $referral=false, $show_invisible_ou=true) 438 { 439 $s = CreateObject('phpgwapi.sector_search_ldap'); 440 $sectors_info = $s->get_sectors($selected, $referral, $show_invisible_ou); 441 return $sectors_info; 442 } 443 437 444 /* 438 445 function get_sectors($context, $selected='') -
trunk/expressoAdmin1_2/inc/class.group.inc.php
r23 r33 93 93 { 94 94 $group_info['objectClass'][] = 'sambaGroupMapping'; 95 $group_info['sambaSID'] = $ this->current_config['expressoAdmin_sambaSID'] . '-' . (($id * 2) + 1001);95 $group_info['sambaSID'] = $params['sambadomain'] . '-' . (($id * 2) + 1001); 96 96 $group_info['sambaGroupType'] = '2'; 97 97 } … … 167 167 168 168 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 169 // REPLACE SAMBASID OF SAMBA 170 if ( ($this->current_config['expressoAdmin_samba_support'] == 'true') && ($diff['sambadomain']) ) 171 { 172 $ldap_mod_replace['sambaSID'] = $new_values['sambadomain'] . '-' . ((2 * $new_values['uidnumber'])+1001); 173 $this->db_functions->write_log("Alterado dominio samba do grupo $dn para " . $new_values['sambadomain'],'',$dn,'',''); 174 } 175 176 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 169 177 // REPLACE DESCRIPTION 170 178 if ($new_values['description'] != $old_values['description']) 171 179 { 172 180 $ldap_mod_replace['description'] = $new_values['description']; 181 $this->db_functions->write_log("Modificado descrição do grupo $dn",'',$dn,'',''); 182 } 183 184 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 185 // CALL LDAP_REPLACE FUNCTION 186 if (count($ldap_mod_replace)) 187 { 173 188 $result = $this->ldap_functions->replace_user_attributes($dn, $ldap_mod_replace); 174 189 if (!$result['status']) … … 177 192 $return['msg'] .= $result['msg']; 178 193 } 179 else 180 $this->db_functions->write_log("Modificado descrição do grupo $dn",'',$dn,'',''); 181 } 194 } 182 195 183 196 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 213 226 $ldap_add['objectClass'][] = 'sambaGroupMapping'; 214 227 $ldap_add['sambagrouptype'] = '2'; 215 $ldap_add['sambasid'] = $ this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $new_values['gidnumber'])+1001);228 $ldap_add['sambasid'] = $new_values['sambadomain'] . '-' . ((2 * $new_values['gidnumber'])+1001); 216 229 217 230 $result = $this->ldap_functions->add_user_attributes($dn, $ldap_add); … … 225 238 } 226 239 } 227 240 228 241 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 229 242 // ADD ATTRIBUTES -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r32 r33 371 371 372 372 $entries = ldap_get_entries($this->ldap, $groups_list); 373 return $entries; 373 374 $options = ''; 375 for ($i=0; $i<$entries['count']; $i++) 376 { 377 $options .= "<option value=" . $entries[$i]['gidnumber'][0] . ">" . $entries[$i]['cn'][0] . "</option>"; 378 } 379 380 return $options; 374 381 } 375 382 … … 382 389 383 390 $entries = ldap_get_entries($this->ldap, $maillists); 384 return $entries; 391 392 $options = ''; 393 for ($i=0; $i<$entries['count']; $i++) 394 { 395 $options .= "<option value=" . $entries[$i]['uidnumber'][0] . ">" . $entries[$i]['uid'][0] . " (" . $entries[$i]['mail'][0] . ")" . "</option>"; 396 } 397 return $options; 385 398 } 386 399 … … 744 757 if ($entry[0]['objectclass'][$i] == 'sambaGroupMapping') 745 758 $result['sambaGroup'] = true; 759 760 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 761 array_pop($a_tmp); 762 $result['sambasid'] = implode("-", $a_tmp); 746 763 } 747 764 … … 1161 1178 return $return; 1162 1179 } 1163 1180 /* 1164 1181 function rename_departmentnumber($old_dp, $new_dp) 1165 1182 { … … 1177 1194 $ldap_mod_replace['departmentnumber'] = $new_dp; 1178 1195 @ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace); 1179 / *if (!@ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace))1180 {1181 $return['status'] = false;1182 $return['msg'] .= 'Erro em ldap_funcitons->rename_departmentnumber: ' . ldap_error($this->ldap);1183 }*/1196 //if (!@ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace)) 1197 //{ 1198 // $return['status'] = false; 1199 // $return['msg'] .= 'Erro em ldap_funcitons->rename_departmentnumber: ' . ldap_error($this->ldap); 1200 //} 1184 1201 } 1202 return $return; 1203 } 1204 */ 1205 /* 1206 function get_sambadomains($context) 1207 { 1208 $return['status'] = true; 1209 $return['sambaDomains'] = array(); 1210 1211 $justthese = array("sambaSID","sambaDomainName"); 1212 $filter="(objectClass=sambaDomain)"; 1213 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1214 $entry = ldap_get_entries($this->ldap, $search); 1215 1216 for ($i=0; $i<$entry['count']; $i++) 1217 { 1218 $return['sambaDomains'][$i]['samba_domain_sid'] = $entry[$i]['sambasid'][0]; 1219 $return['sambaDomains'][$i]['samba_domain_name'] = $entry[$i]['sambadomainname'][0]; 1220 $return['sambaDomains'][$i]['samba_domain_dn'] = $entry[$i]['dn']; 1221 } 1222 1223 return $return; 1224 } 1225 */ 1226 function exist_sambadomains($context, $sambaDomainName) 1227 { 1228 $justthese = array("dn"); 1229 $filter="(&(objectClass=sambaDomain)(sambaDomainName=$sambaDomainName))"; 1230 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1231 $entry = ldap_get_entries($this->ldap, $search); 1232 1233 if ($entry['count']) 1234 return true; 1235 else 1236 return false; 1237 } 1238 1239 // Primeiro nilvel de organização. 1240 function exist_sambadomains_in_context($params) 1241 { 1242 $dn = $GLOBALS['phpgw_info']['server']['ldap_context']; 1243 $array_dn = ldap_explode_dn ( $dn, 0 ); 1244 1245 $context = $params['context']; 1246 $array_context = ldap_explode_dn ( $context, 0 ); 1247 1248 // Pego o setor no caso do contexto ser um sub-setor. 1249 if (($array_dn['count']+1) < ($array_context['count'])) 1250 { 1251 // inverto o array_dn para poder retirar o count 1252 $array_dn_reverse = array_reverse ( $array_dn, false ); 1253 1254 //retiro o count 1255 array_pop($array_dn_reverse); 1256 1257 //incluo o setor no dn 1258 array_push ( $array_dn_reverse, $array_context[ $array_context['count'] - 1 - $array_dn['count']]); 1259 1260 // Volto a ordem natural 1261 $array_dn = array_reverse ( $array_dn_reverse, false ); 1262 1263 // Implodo 1264 $context = implode ( ",", $array_dn ); 1265 } 1266 1267 $justthese = array("dn","sambaDomainName"); 1268 $filter="(objectClass=sambaDomain)"; 1269 $search = ldap_list($this->ldap, $context, $filter, $justthese); 1270 $entry = ldap_get_entries($this->ldap, $search); 1271 1272 for ($i=0; $i<$entry['count']; $i++) 1273 { 1274 $return['sambaDomains'][$i] = $entry[$i]['sambadomainname'][0]; 1275 } 1276 1277 if ($entry['count']) 1278 $return['status'] = true; 1279 else 1280 $return['status'] = false; 1281 1185 1282 return $return; 1186 1283 } -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r32 r33 178 178 function add_users() 179 179 { 180 $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); 181 //$GLOBALS['phpgw']->js->set_onload('get_sectors(document.forms[0].context.value);'); 180 $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); 182 181 $GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);'); 183 182 $GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);'); 184 183 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 184 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');'); 185 185 186 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 186 187 $tmp = $this->functions->read_acl($manager_lid); … … 220 221 foreach ($a_sambadomains as $a_sambadomain) 221 222 { 222 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 223 // So mostra os sambaDomainName do contexto do manager 224 if ($this->ldap_functions->exist_sambadomains($manager_context, $a_sambadomain['samba_domain_name'])) 225 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 223 226 } 224 227 } … … 234 237 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), 235 238 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 239 'disabled_access_button'=> 'disabled', 236 240 237 241 // First ABA -
trunk/expressoAdmin1_2/inc/class.uidomains.inc.php
r27 r33 78 78 else 79 79 { 80 81 80 foreach($sambadomains_info as $domains) 82 81 { … … 119 118 120 119 // Pega combo das organizações e seleciona, caso seja um post, o setor que o usuario selecionou. 121 $organizations = $this->functions->get_ organizations($manager_context, $_POST['context']);122 120 $organizations = $this->functions->get_sectors($_POST['context'], false, false); 121 123 122 unset($GLOBALS['phpgw_info']['flags']['noheader']); 124 123 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); -
trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
r24 r33 23 23 var $group; 24 24 var $functions; 25 var $ldap_functions; 26 var $db_functions; 25 27 26 28 function uigroups() … … 29 31 $this->nextmatchs = createobject('phpgwapi.nextmatchs'); 30 32 $this->functions = CreateObject('expressoAdmin1_2.functions'); 33 $this->ldap_functions = CreateObject('expressoAdmin1_2.ldap_functions'); 34 $this->db_functions = CreateObject('expressoAdmin1_2.db_functions'); 31 35 32 36 $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); … … 167 171 { 168 172 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 169 173 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 174 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_group\');'); 175 170 176 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 171 177 $acl = $this->functions->read_acl($account_lid); … … 193 199 // Chama funcao para criar lista de aplicativos disponiveis. 194 200 $apps = $this->functions->make_list_app($account_lid, $manager_context, ''); 201 202 // Cria combo de dominio samba 203 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 204 { 205 $a_sambadomains = $this->db_functions->get_sambadomains_list(); 206 $sambadomainname_options = ''; 207 if (count($a_sambadomains)) 208 { 209 foreach ($a_sambadomains as $a_sambadomain) 210 { 211 // So mostra os sambaDomainName do contexto do manager 212 if ($this->ldap_functions->exist_sambadomains($manager_context, $a_sambadomain['samba_domain_name'])) 213 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 214 } 215 } 216 } 195 217 196 218 // Seta variaveis utilizadas pelo tpl. … … 201 223 'cn' => '', 202 224 'restrictionsOnGroup' => $this->current_config['expressoAdmin_restrictionsOnGroup'], 225 'type' => 'create_group', 203 226 'ldap_context' => $GLOBALS['phpgw_info']['server']['ldap_context'], 204 227 'lang_back' => lang('Back'), … … 212 235 'lang_all_users' => lang('Select users from all sub-organizations'), 213 236 'apps' => $apps, 214 'use_attrs_samba_checked' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? 'CHECKED' : '', 237 //'use_attrs_samba_checked' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? 'CHECKED' : '', 238 'use_attrs_samba_checked' => '', 239 'disabled_samba' => 'disabled', 240 'display_samba_options' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : '"display:none"', 241 'sambadomainname_options' => $sambadomainname_options, 215 242 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.list_groups'), 216 243 'combo_manager_org' => $combo_manager_org, … … 283 310 // Chama funcao para criar lista de aplicativos disponiveis. 284 311 $apps = $this->functions->make_list_app($account_lid, $manager_context, $group_info['apps']); 312 313 // Cria combo de dominios do samba 314 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 315 { 316 $a_sambadomains = $this->db_functions->get_sambadomains_list(); 317 $sambadomainname_options = ''; 318 if (count($a_sambadomains)) 319 { 320 foreach ($a_sambadomains as $a_sambadomain) 321 { 322 if ($a_sambadomain['samba_domain_sid'] == $group_info['sambasid']) 323 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "' SELECTED>" . $a_sambadomain['samba_domain_name'] . "</option>"; 324 else 325 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 326 } 327 } 328 } 285 329 286 330 // Seta variaveis utilizadas pelo tpl. … … 306 350 'apps' => $apps, 307 351 'use_attrs_samba_checked' => $group_info['sambaGroup'] ? 'CHECKED' : '', 352 'disabled_samba' => $group_info['sambaGroup'] ? '' : 'disabled', 353 'sambadomainname_options' => $sambadomainname_options, 308 354 'phpgwaccountvisible_checked' => $group_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', 309 355 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.list_groups'), -
trunk/expressoAdmin1_2/inc/class.uisectors.inc.php
r32 r33 191 191 'lang_context' => lang('Context'), 192 192 'lang_sector_name' => lang('Sector name'), 193 'lang_ visible' => lang('Visible'),193 'lang_occult_ou' => lang('Occult Sector'), 194 194 'error_messages' => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 195 195 ); -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r32 r33 119 119 $user_info['loginShell'] = '/bin/bash'; 120 120 121 //$user_info['sambaSID'] = $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $id)+1000);122 //$user_info['sambaPrimaryGroupSID'] = $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $user_info['gidNumber'])+1001);123 121 $user_info['sambaSID'] = $params['sambadomain'] . '-' . ((2 * $id)+1000); 124 122 $user_info['sambaPrimaryGroupSID'] = $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001);
Note: See TracChangeset
for help on using the changeset viewer.