index f413ecb62a8be8f3b0953dce4f1815322cd1da1a..7a3a5bfd3bb4d2d79a26451dbb77ccb2e260a521 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
if (!isset($this->current['GROUPS'])){
$this->current['GROUPS']= "ou=groups";
}
+
+ /* Remove possibly added ',' from end of group and people ou */
+ $this->current['GROUPS'] = preg_replace("/,*$/","",$this->current['GROUPS']);
+ $this->current['PEOPLE'] = preg_replace("/,*$/","",$this->current['PEOPLE']);
+
if (!isset($this->current['WINSTATIONS'])){
$this->current['WINSTATIONS']= "ou=winstations,ou=systems";
}
$this->current['PASSWORD']= $referral['PASSWORD'];
}
+ /* Possibly load kerberos style */
+ if (isset($this->current['KRBSASL'])){
+ if (preg_match('/^(yes|true)$/i', $this->current['KRBSASL'])){
+ $this->current['KRBSASL']= "sasl";
+ } else {
+ $this->current['KRBSASL']= "kerberos";
+ }
+ } else {
+ $this->current['KRBSASL']= "kerberos";
+ }
+
/* Load server informations */
$this->load_servers();
}
/* Get asterisk servers */
$ldap->cd ($this->current['BASE']);
$ldap->search ("(objectClass=goFonServer)");
+ $this->data['SERVERS']['FON']= array();
if ($ldap->count()){
- $attrs= $ldap->fetch();
- $this->data['SERVERS']['FON']= array(
- 'SERVER' => $attrs['cn'][0],
- 'LOGIN' => $attrs['goFonAdmin'][0],
- 'PASSWORD' => $attrs['goFonPassword'][0],
- 'DB' => "gophone",
- 'SIP_TABLE' => "sip_users",
- 'EXT_TABLE' => "extensions",
- 'VOICE_TABLE' => "voicemail_users",
- 'QUEUE_TABLE' => "queues",
- 'QUEUE_MEMBER_TABLE' => "queue_members");
+ while ($attrs= $ldap->fetch()){
+
+ /* Add 0 entry for development */
+ if(count($this->data['SERVERS']['FON']) == 0){
+ $this->data['SERVERS']['FON'][0]= array(
+ 'DN' => $attrs['dn'],
+ 'SERVER' => $attrs['cn'][0],
+ 'LOGIN' => $attrs['goFonAdmin'][0],
+ 'PASSWORD' => $attrs['goFonPassword'][0],
+ 'DB' => "gophone",
+ 'SIP_TABLE' => "sip_users",
+ 'EXT_TABLE' => "extensions",
+ 'VOICE_TABLE' => "voicemail_users",
+ 'QUEUE_TABLE' => "queues",
+ 'QUEUE_MEMBER_TABLE' => "queue_members");
+ }
+
+ /* Add entry with 'dn' as index */
+ $this->data['SERVERS']['FON'][$attrs['dn']]= array(
+ 'DN' => $attrs['dn'],
+ 'SERVER' => $attrs['cn'][0],
+ 'LOGIN' => $attrs['goFonAdmin'][0],
+ 'PASSWORD' => $attrs['goFonPassword'][0],
+ 'DB' => "gophone",
+ 'SIP_TABLE' => "sip_users",
+ 'EXT_TABLE' => "extensions",
+ 'VOICE_TABLE' => "voicemail_users",
+ 'QUEUE_TABLE' => "queues",
+ 'QUEUE_MEMBER_TABLE' => "queue_members");
+ }
}
/* Get glpi servers */
function getShareList($listboxEntry = false)
{
$ldap= $this->get_ldap_link();
- $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
+
+ /* Set tag attribute if we've tagging activated */
+ $tag= "";
+ $ui= get_userinfo();
+ if ($ui->gosaUnitTag != "" && isset($this->current['STRICT_UNITS']) &&
+ preg_match('/TRUE/i', $this->current['STRICT_UNITS'])){
+ $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+ }
+
+ $a_res = $ldap->search("(&(objectClass=goShareServer)$tag(objectClass=goServer))",array("goExportEntry","cn"));
$return= array();
while($entry = $ldap->fetch($a_res)){
if(isset($entry['goExportEntry']['count'])){