本文整理汇总了PHP中Ldap::getNextGroupGid方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getNextGroupGid方法的具体用法?PHP Ldap::getNextGroupGid怎么用?PHP Ldap::getNextGroupGid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ldap
的用法示例。
在下文中一共展示了Ldap::getNextGroupGid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserGroup
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
}
if (function_exists("ldap_connect")) {
if ($_GET["action"] == 'testgroup') {
// Creation objet
$object = new UserGroup($db);
$object->initAsSpecimen();
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if (in_array('posixGroup', $info['objectclass'])) {
$info['gidNumber'] = $ldap->getNextGroupGid();
}
$result1 = $ldap->delete($dn);
// To be sure to delete existing records
$result2 = $ldap->add($dn, $info, $user);
// Now the test
$result3 = $ldap->delete($dn);
// Clean what we did
if ($result2 > 0) {
print img_picto('', 'info') . ' ';
print '<font class="ok">' . $langs->trans("LDAPSynchroOK") . '</font><br>';
} else {
print img_picto('', 'error') . ' ';
print '<font class="error">' . $langs->trans("LDAPSynchroKOMayBePermissions");
print ': ' . $ldap->error;
print '</font><br>';
示例2: Ldap
//.........这里部分代码省略.........
$olddn = '';
}
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$result = $ldap->update($dn, $info, $user, $olddn);
if ($result < 0) {
$this->error = "ErrorLDAP" . " " . $ldap->error;
}
return $result;
}
} elseif ($action == 'USER_ENABLEDISABLE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} elseif ($action == 'USER_DELETE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$result = $ldap->delete($dn, $info, $user);
if ($result < 0) {
$this->error = "ErrorLDAP" . " " . $ldap->error;
}
return $result;
}
} elseif ($action == 'GROUP_CREATE') {
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if (in_array('posixGroup', $info['objectclass'])) {
$info['gidNumber'] = $ldap->getNextGroupGid();
}
$result = $ldap->add($dn, $info, $user);
if ($result < 0) {
$this->error = "ErrorLDAP" . " " . $ldap->error;
}
return $result;
}
} elseif ($action == 'GROUP_MODIFY') {
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
$oldinfo = $object->oldcopy->_load_ldap_info();
$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
// Verify if entry exist
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
$search = "(" . $object->oldcopy->_load_ldap_dn($oldinfo, 2) . ")";
$records = $ldap->search($container, $search);
if (sizeof($records) && $records['count'] == 0) {
$olddn = '';
}
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$result = $ldap->update($dn, $info, $user, $olddn);
if ($result < 0) {
$this->error = "ErrorLDAP" . " " . $ldap->error;
}
return $result;
}
} elseif ($action == 'GROUP_DELETE') {
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
示例3: runTrigger
//.........这里部分代码省略.........
$ldap->connect_bind();
// Must edit $object->newgroupid
$usergroup = new UserGroup($this->db);
if ($object->oldgroupid > 0) {
$usergroup->fetch($object->oldgroupid);
$oldinfo = $usergroup->_load_ldap_info();
$olddn = $usergroup->_load_ldap_dn($oldinfo);
// Verify if entry exist
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
$search = "(" . $usergroup->_load_ldap_dn($oldinfo, 2) . ")";
$records = $ldap->search($container, $search);
if (count($records) && $records['count'] == 0) {
$olddn = '';
}
$info = $usergroup->_load_ldap_info();
// Contains all members, included the new one (insert already done before trigger call)
$dn = $usergroup->_load_ldap_dn($info);
$result = $ldap->update($dn, $info, $user, $olddn);
if ($result < 0) {
$this->error = "ErrorLDAP " . $ldap->error;
}
}
return $result;
}
} elseif ($action == 'GROUP_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if (in_array('posixGroup', $info['objectclass'])) {
$info['gidNumber'] = $ldap->getNextGroupGid();
}
$result = $ldap->add($dn, $info, $user);
if ($result < 0) {
$this->error = "ErrorLDAP " . $ldap->error;
}
return $result;
}
} elseif ($action == 'GROUP_MODIFY') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
$ldap = new Ldap();
$ldap->connect_bind();
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
dol_syslog("Trigger " . $action . " was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
$object->oldcopy = dol_clone($object);
}
$oldinfo = $object->oldcopy->_load_ldap_info();
$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
// Verify if entry exist
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
$search = "(" . $object->oldcopy->_load_ldap_dn($oldinfo, 2) . ")";
$records = $ldap->search($container, $search);
if (count($records) && $records['count'] == 0) {
$olddn = '';
}
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$result = $ldap->update($dn, $info, $user, $olddn);
if ($result < 0) {
$this->error = "ErrorLDAP " . $ldap->error;
}
return $result;