• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ldap_add函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ldap_add函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_add函数的具体用法?PHP ldap_add怎么用?PHP ldap_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ldap_add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addUser

 /**
  * Add a set of authentication credentials.
  *
  * @param string $accountName  The user sAMAccountName to find.
  * @param array $credentials   The credentials to be set.
  *
  * @throws Horde_Auth_Exception
  */
 public function addUser($accountName, $credentials)
 {
     /* Connect to the MSAD server. */
     $this->_connect();
     if (isset($credentials['ldap'])) {
         $dn = $credentials['ldap']['dn'];
     } else {
         $basedn = isset($credentials['basedn']) ? $credentials['basedn'] : $this->_params['basedn'];
         /* Set a default CN */
         $dn = 'cn=' . $accountName . ',' . $basedn;
         $entry['cn'] = $accountName;
         $entry['samaccountname'] = $accountName;
         $entry['objectclass'][0] = "top";
         $entry['objectclass'][1] = "person";
         $entry['objectclass'][2] = "organizationalPerson";
         $entry['objectclass'][3] = "user";
         $entry['description'] = isset($credentials['description']) ? $credentials['description'] : 'New horde user';
         if ($this->_params['ssl']) {
             $entry["AccountDisabled"] = false;
         }
         $entry['userPassword'] = Horde_Auth::getCryptedPassword($credentials['password'], '', $this->_params['encryption'], false);
         if (isset($this->_params['binddn'])) {
             $entry['manager'] = $this->_params['binddn'];
         }
     }
     $success = @ldap_add($this->_ds, $dn, $entry);
     if (!$success) {
         throw new Horde_Auth_Exception(sprintf(__CLASS__ . ': Unable to add user "%s". This is what the server said: ', $accountName) . ldap_error($this->_ds));
     }
     @ldap_close($this->_ds);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:39,代码来源:Msad.php


示例2: process

 function process()
 {
     print_r($this->input);
     if (ldap_add($this->ds, $this->rdn, $this->input)) {
         return true;
     }
 }
开发者ID:josephecmu,项目名称:whois,代码行数:7,代码来源:ProcessLdapAdd.php


示例3: add

 /**
  * lastname (sn) is required for the "inetOrgPerson" schema
  */
 public function add(Users_Model_User $user)
 {
     $dn = 'cn=' . $user->username . ',' . $this->_ldapConfig->baseDn;
     $info = array('cn' => $user->username, 'givenName' => $user->firstname, 'sn' => $user->lastname, 'mail' => $user->email, 'userPassword' => $this->_hashPassword($user->password), 'objectclass' => 'inetOrgPerson');
     if (!@ldap_add($this->_dp, $dn, $info) && ldap_error($this->_dp) != 'Success') {
         throw new Exception('Could not add record to LDAP server: ' . ldap_error($this->_dp));
     }
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:11,代码来源:Ldap.php


示例4: prepareLDAPServer

 protected function prepareLDAPServer()
 {
     $this->nodes = array($this->createDn('ou=Node,') => array("objectClass" => "organizationalUnit", "ou" => "Node", "postalCode" => "1234"), $this->createDn('ou=Test1,ou=Node,') => array("objectClass" => "organizationalUnit", "ou" => "Test1"), $this->createDn('ou=Test2,ou=Node,') => array("objectClass" => "organizationalUnit", "ou" => "Test2"), $this->createDn('ou=Test1,') => array("objectClass" => "organizationalUnit", "ou" => "Test1", "l" => "e"), $this->createDn('ou=Test2,') => array("objectClass" => "organizationalUnit", "ou" => "Test2", "l" => "d"), $this->createDn('ou=Test3,') => array("objectClass" => "organizationalUnit", "ou" => "Test3", "l" => "c"), $this->createDn('ou=Test4,') => array("objectClass" => "organizationalUnit", "ou" => "Test4", "l" => "b"), $this->createDn('ou=Test5,') => array("objectClass" => "organizationalUnit", "ou" => "Test5", "l" => "a"));
     $ldap = $this->ldap->getResource();
     foreach ($this->nodes as $dn => $entry) {
         ldap_add($ldap, $dn, $entry);
     }
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:8,代码来源:AbstractOnlineTestCase.php


示例5: add

 /**
  * {@inheritdoc}
  */
 public function add(Entry $entry)
 {
     $con = $this->connection->getResource();
     if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
         throw new LdapException(sprintf('Could not add entry "%s": %s', $entry->getDn(), ldap_error($con)));
     }
     return $this;
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:11,代码来源:EntryManager.php


示例6: addGroup

function addGroup($ds, $info)
{
    // On ajoute le nouveau groupe
    $r = ldap_add($ds, "cn=" . $info['cn'] . ",ou=groups,dc=rBOX,dc=lan", $info);
    // On affiche un message d'erreur si l'utilisateur n'a pas pu être ajouté
    if (!$r) {
        echo '<p class="center red">Le groupe n\'a pas pu être ajouté. Nous vous prions de nous excuser pour le désagrément.</p>';
        exit;
    }
}
开发者ID:hillfias,项目名称:LDAPWebApp,代码行数:10,代码来源:addGroup.php


示例7: create

 public function create($attrs)
 {
     if (!isset($attrs['uid'])) {
         return false;
     }
     $entry = array_merge(['objectclass' => $this->objectclass], $attrs);
     try {
         return ldap_add($this->ds, "dc=" . $attrs['uid'] . "," . $this->dn, $entry);
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:k1m0ch1,项目名称:egor,代码行数:12,代码来源:Ldap.php


示例8: AssistedLDAPAdd

function AssistedLDAPAdd($ldapc, $newdn, $in)
{
    // Use these variables that are outside the function
    global $app_theme;
    // Add the new entry
    $r_add = ldap_add($ldapc, $newdn, $in);
    // Let's see if you could make it
    if (!$r_add) {
        echo '<div class="error">' . _("An error has ocurred trying to insert entries on the LDAP database: ") . ldap_error($ldapc) . '.<br /><br /><a href="javascript:history.back(1);">' . _("Back") . '</a></div>';
        include "../themes/{$app_theme}/footer.php";
        die;
    }
    return $r_add;
}
开发者ID:awasthi,项目名称:aguilas,代码行数:14,代码来源:Functions.inc.php


示例9: ldapCreateUser

 /**
  * Create LDAP User
  * @param $userDn
  * @param $newUserInfo
  * @return mixed
  */
 public function ldapCreateUser($userDn, $newUserInfo)
 {
     // Initialiazing ldap connection
     $ldapInitialisation = $this->ldapInit();
     $issue = null;
     if ($ldapInitialisation) {
         // Creating user
         ErrorHandler::start(E_WARNING);
         $issue = ldap_add($this->ldapLinkIdentifier, $userDn, $newUserInfo);
         ErrorHandler::stop();
         // Closing ldap connection
         ldap_close($this->ldapLinkIdentifier);
     }
     return $issue;
 }
开发者ID:spirit-dev,项目名称:dbox-user,代码行数:21,代码来源:LdapDriver.php


示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_prepareLdapServer();
     $this->_orgDn = $this->_createDn('ou=OrgTest,');
     $this->_newDn = $this->_createDn('ou=NewTest,');
     $this->_orgSubTreeDn = $this->_createDn('ou=OrgSubtree,');
     $this->_newSubTreeDn = $this->_createDn('ou=NewSubtree,');
     $this->_targetSubTreeDn = $this->_createDn('ou=Target,');
     $this->_nodes = array($this->_orgDn => array("objectClass" => "organizationalUnit", "ou" => "OrgTest"), $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "OrgSubtree"), 'ou=Subtree1,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree1"), 'ou=Subtree11,ou=Subtree1,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree11"), 'ou=Subtree12,ou=Subtree1,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree12"), 'ou=Subtree13,ou=Subtree1,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree13"), 'ou=Subtree2,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree2"), 'ou=Subtree3,' . $this->_orgSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Subtree3"), $this->_targetSubTreeDn => array("objectClass" => "organizationalUnit", "ou" => "Target"));
     $ldap = $this->_getLdap()->getResource();
     foreach ($this->_nodes as $dn => $entry) {
         ldap_add($ldap, $dn, $entry);
     }
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:15,代码来源:CopyRenameTest.php


示例11: addUser

function addUser($ds, $info, $infoGroupes)
{
    // On ajoute le nouvel utilisateur
    $r = ldap_add($ds, "cn=" . $info["cn"] . ",ou=users,dc=rBOX,dc=lan", $info);
    // On affiche un message d'erreur si l'utilisateur n'a pas pu être ajouté
    if (!$r) {
        echo '<p class="center red">L\'utilisateur n\'a pas pu être ajouté. Nous vous prions de nous excuser pour le désagrément.</p>';
        exit;
    }
    $entry['memberUid'] = $info["cn"];
    $res = add2Group($ds, $entry, $infoGroupes);
    $res2 = add2OtherGroup($ds, $entry, $infoGroupes);
    if (!$res or !$res2) {
        return false;
    }
    return true;
}
开发者ID:hillfias,项目名称:LDAPWebApp,代码行数:17,代码来源:addUser.php


示例12: saveNewUser

 public function saveNewUser($user)
 {
     if (!is_object($user) || !$user instanceof jAuthUserLDAP) {
         throw new jException('jelix~auth.ldap.object.user.unknown');
     }
     if (!($user->login != '')) {
         throw new jException('jelix~auth.ldap.user.login.unset');
     }
     $entries = $this->getAttributesLDAP($user);
     $connect = $this->_bindLdapUser();
     if ($connect === false) {
         return false;
     }
     $result = ldap_add($connect, $this->_buildUserDn($user->login), $entries);
     ldap_close($connect);
     return $result;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:17,代码来源:ldap.auth.php


示例13: saveNewUser

 public function saveNewUser($user)
 {
     if (!is_object($user) || !$user instanceof jAuthUserLDAP) {
         throw new jException('jelix~auth.ldap.object.user.unknown');
     }
     if (!($user->login != '')) {
         throw new jException('jelix~auth.ldap.user.login.unset');
     }
     $entries = $this->getAttributesLDAP($user);
     $connect = $this->_getLinkId();
     $result = false;
     if ($connect) {
         if (ldap_bind($connect, $this->_params['ldapUser'], $this->_params['ldapPassword'])) {
             $result = ldap_add($connect, $this->_buildUserDn($user->login), $entries);
         }
         ldap_close($connect);
     }
     return $result;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:19,代码来源:ldap.auth.php


示例14: saveNewUser

 public function saveNewUser($user)
 {
     if (!is_object($user) || !$user instanceof jAuthUserLDAP) {
         throw new jException('jelix~auth.ldap.object.user.unknown');
     }
     if (!($user->login != '')) {
         throw new jException('jelix~auth.ldap.user.login.unset');
     }
     $entries = $this->getAttributesLDAP($user);
     $connect = ldap_connect($this->_params['hostname'], $this->_params['port']);
     $result = false;
     if ($connect) {
         ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
         ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
         if (ldap_bind($connect, $this->_params['ldapUser'], $this->_params['ldapPassword'])) {
             $result = ldap_add($connect, 'cn=' . $user->login . ',' . $this->_params['searchBaseDN'], $entries);
         }
         ldap_close($connect);
     }
     return $result;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:21,代码来源:ldap.auth.php


示例15: registerNewUser

function registerNewUser($username, $password, $firstname, $lastname, $email, $phone, $groups)
{
    $info = array();
    $info["uid"] = $username;
    $info["userPassword"] = $password;
    $info["givenName"] = $firstname;
    $info["sn"] = $lastname;
    $info["cn"] = $firstname . $lastname;
    $info["mail"] = $email;
    $info["telephoneNumber"] = $phone;
    $info["objectClass"][0] = "top";
    $info["objectClass"][1] = "person";
    $info["objectClass"][2] = "organizationalPerson";
    $info["objectClass"][3] = "inetorgperson";
    $info["objectClass"][4] = "posixAccount";
    $info["objectClass"][5] = "inetuser";
    if (ldap_add($connection, $DN, $info) == false) {
        return false;
    }
    foreach ($groups as $group) {
        addUserToGroup($username, $group);
    }
    return true;
}
开发者ID:audunel,项目名称:anthropos,代码行数:24,代码来源:user.functions.inc.php


示例16: createLdapEntry

 /**
 * create ldap entry.
 *
 * @param array $attributes should follow the structure of ldap_add functions
 *   entry array: http://us.php.net/manual/en/function.ldap-add.php
      $attributes["attribute1"] = "value";
      $attributes["attribute2"][0] = "value1";
      $attributes["attribute2"][1] = "value2";
 * @return boolean result
 */
 public function createLdapEntry($attributes, $dn = NULL)
 {
     if (!$this->connection) {
         $this->connect();
         $this->bind();
     }
     if (isset($attributes['dn'])) {
         $dn = $attributes['dn'];
         unset($attributes['dn']);
     } elseif (!$dn) {
         return FALSE;
     }
     $result = @ldap_add($this->connection, $dn, $attributes);
     if (!$result) {
         $error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
         $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
         debug(t($error, $tokens));
         watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
     }
     return $result;
 }
开发者ID:tierce,项目名称:ppbe,代码行数:31,代码来源:LdapServer.class.php


示例17: ldap_connect_and_bind

<?php

require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
@ldap_add($link, "badDN dc=my-domain,dc=com", array("objectClass" => array("top", "dcObject", "organization"), "dc" => "my-domain", "o" => "my-domain"));
var_dump(ldap_errno($link));
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:ldap_errno_basic.php


示例18: create

 /**
  * Create a user
  * 
  * If you specify a password here, this can only be performed over SSL
  * 
  * @param array $attributes The attributes to set to the user account
  * @return bool
  */
 public function create($attributes)
 {
     // Check for compulsory fields
     if (!array_key_exists("username", $attributes)) {
         return "Missing compulsory field [username]";
     }
     if (!array_key_exists("firstname", $attributes)) {
         return "Missing compulsory field [firstname]";
     }
     if (!array_key_exists("surname", $attributes)) {
         return "Missing compulsory field [surname]";
     }
     if (!array_key_exists("email", $attributes)) {
         return "Missing compulsory field [email]";
     }
     if (!array_key_exists("container", $attributes)) {
         return "Missing compulsory field [container]";
     }
     if (!is_array($attributes["container"])) {
         return "Container attribute must be an array.";
     }
     if (array_key_exists("password", $attributes) && (!$this->adldap->getUseSSL() && !$this->adldap->getUseTLS())) {
         throw new adLDAPException('SSL must be configured on your webserver and enabled in the class to set passwords.');
     }
     if (!array_key_exists("display_name", $attributes)) {
         $attributes["display_name"] = $attributes["firstname"] . " " . $attributes["surname"];
     }
     // Translate the schema
     $add = $this->adldap->adldap_schema($attributes);
     // Additional stuff only used for adding accounts
     $add["cn"][0] = $attributes["display_name"];
     $add["samaccountname"][0] = $attributes["username"];
     $add["objectclass"][0] = "top";
     $add["objectclass"][1] = "person";
     $add["objectclass"][2] = "organizationalPerson";
     $add["objectclass"][3] = "user";
     //person?
     //$add["name"][0]=$attributes["firstname"]." ".$attributes["surname"];
     // Set the account control attribute
     $control_options = array("NORMAL_ACCOUNT");
     if (!$attributes["enabled"]) {
         $control_options[] = "ACCOUNTDISABLE";
     }
     $add["userAccountControl"][0] = $this->accountControl($control_options);
     // Determine the container
     $attributes["container"] = array_reverse($attributes["container"]);
     $container = "OU=" . implode(", OU=", $attributes["container"]);
     // Add the entry
     $result = @ldap_add($this->adldap->getLdapConnection(), "CN=" . $add["cn"][0] . ", " . $container . "," . $this->adldap->getBaseDn(), $add);
     if ($result != true) {
         return false;
     }
     return true;
 }
开发者ID:wernerflamme,项目名称:dokuwiki,代码行数:62,代码来源:adLDAPUsers.php


示例19: array

	$entry = array();
	$entry['objectClass']     = array( 'top', 'person', 'organizationalPerson', 'inetOrgPerson', 'hCard' );
	$entry['cn']              = array( 'Stephen Weber' ); // Common Name
	$entry['sn']              = array( 'Weber' ); // Surname/Family Name
	$entry['gn']              = array( 'Stephen' ); // Given Name
	$entry['displayName']     = array( 'singpolyma' ); // Nickname
//	$entry['title']           = array( '' ); // Job role
	$entry['mail']            = array( '[email protected]' ); // Email
	$entry['labeledURI']      = array( 'http://singpolyma.net' );
	$entry['mobile']          = array( '+16503957464' ); // Mobile number
	// $entry['telephoneNumber'] = array( '+14156916235' ); // Phone number
// 	$entry['postalAddress']   = array( '1408 California St, #301
// San Francisco, CA' ); // Mailing address, preformatted (homePostalAddress)
// 	$entry['postalCode']      = array( '94109' ); // ZIP
	
	if ( !ldap_add( $ldap, $dn, $entry ) ) {
		echo ldap_error( $ldap );
	} else {
		echo 'Successfully added entry';
	}
	
	ldap_close( $ldap );
}

/*
Add these from hCard/vCard
additionalName
personalTitle
honorificSuffix
bday
tz
开发者ID:singpolyma,项目名称:hCard-LDAP-Service,代码行数:31,代码来源:connect.php


示例20: test_enrol_ldap

 public function test_enrol_ldap()
 {
     global $CFG, $DB;
     if (!extension_loaded('ldap')) {
         $this->markTestSkipped('LDAP extension is not loaded.');
     }
     $this->resetAfterTest();
     require_once $CFG->dirroot . '/enrol/ldap/lib.php';
     require_once $CFG->libdir . '/ldaplib.php';
     if (!defined('TEST_ENROL_LDAP_HOST_URL') or !defined('TEST_ENROL_LDAP_BIND_DN') or !defined('TEST_ENROL_LDAP_BIND_PW') or !defined('TEST_ENROL_LDAP_DOMAIN')) {
         $this->markTestSkipped('External LDAP test server not configured.');
     }
     // Make sure we can connect the server.
     $debuginfo = '';
     if (!($connection = ldap_connect_moodle(TEST_ENROL_LDAP_HOST_URL, 3, 'rfc2307', TEST_ENROL_LDAP_BIND_DN, TEST_ENROL_LDAP_BIND_PW, LDAP_DEREF_NEVER, $debuginfo, false))) {
         $this->markTestSkipped('Can not connect to LDAP test server: ' . $debuginfo);
     }
     $this->enable_plugin();
     // Create new empty test container.
     $topdn = 'dc=moodletest,' . TEST_ENROL_LDAP_DOMAIN;
     $this->recursive_delete($connection, TEST_ENROL_LDAP_DOMAIN, 'dc=moodletest');
     $o = array();
     $o['objectClass'] = array('dcObject', 'organizationalUnit');
     $o['dc'] = 'moodletest';
     $o['ou'] = 'MOODLETEST';
     if (!ldap_add($connection, 'dc=moodletest,' . TEST_ENROL_LDAP_DOMAIN, $o)) {
         $this->markTestSkipped('Can not create test LDAP container.');
     }
     // Configure enrol plugin.
     /** @var enrol_ldap_plugin $enrol */
     $enrol = enrol_get_plugin('ldap');
     $enrol->set_config('host_url', TEST_ENROL_LDAP_HOST_URL);
     $enrol->set_config('start_tls', 0);
     $enrol->set_config('ldap_version', 3);
     $enrol->set_config('ldapencoding', 'utf-8');
     $enrol->set_config('page_size', '2');
     $enrol->set_config('bind_dn', TEST_ENROL_LDAP_BIND_DN);
     $enrol->set_config('bind_pw', TEST_ENROL_LDAP_BIND_PW);
     $enrol->set_config('course_search_sub', 0);
     $enrol->set_config('memberattribute_isdn', 0);
     $enrol->set_config('user_contexts', '');
     $enrol->set_config('user_search_sub', 0);
     $enrol->set_config('user_type', 'rfc2307');
     $enrol->set_config('opt_deref', LDAP_DEREF_NEVER);
     $enrol->set_config('objectclass', '(objectClass=posixGroup)');
     $enrol->set_config('course_idnumber', 'cn');
     $enrol->set_config('course_shortname', 'cn');
     $enrol->set_config('course_fullname', 'cn');
     $enrol->set_config('course_summary', '');
     $enrol->set_config('ignorehiddencourses', 0);
     $enrol->set_config('nested_groups', 0);
     $enrol->set_config('autocreate', 0);
     $enrol->set_config('unenrolaction', ENROL_EXT_REMOVED_KEEP);
     $roles = get_all_roles();
     foreach ($roles as $role) {
         $enrol->set_config('contexts_role' . $role->id, '');
         $enrol->set_config('memberattribute_role' . $role->id, '');
     }
     // Create group for teacher enrolments.
     $teacherrole = $DB->get_record('role', array('shortname' => 'teacher'));
     $this->assertNotEmpty($teacherrole);
     $o = array();
     $o['objectClass'] = array('organizationalUnit');
     $o['ou'] = 'teachers';
     ldap_add($connection, 'ou=teachers,' . $topdn, $o);
     $enrol->set_config('contexts_role' . $teacherrole->id, 'ou=teachers,' . $topdn);
     $enrol->set_config('memberattribute_role' . $teacherrole->id, 'memberuid');
     // Create group for student enrolments.
     $studentrole = $DB->get_record('role', array('shortname' => 'student'));
     $this->assertNotEmpty($studentrole);
     $o = array();
     $o['objectClass'] = array('organizationalUnit');
     $o['ou'] = 'students';
     ldap_add($connection, 'ou=students,' . $topdn, $o);
     $enrol->set_config('contexts_role' . $studentrole->id, 'ou=students,' . $topdn);
     $enrol->set_config('memberattribute_role' . $studentrole->id, 'memberuid');
     // Create some users and courses.
     $user1 = $this->getDataGenerator()->create_user(array('idnumber' => 'user1', 'username' => 'user1'));
     $user2 = $this->getDataGenerator()->create_user(array('idnumber' => 'user2', 'username' => 'user2'));
     $user3 = $this->getDataGenerator()->create_user(array('idnumber' => 'user3', 'username' => 'user3'));
     $user4 = $this->getDataGenerator()->create_user(array('idnumber' => 'user4', 'username' => 'user4'));
     $user5 = $this->getDataGenerator()->create_user(array('idnumber' => 'user5', 'username' => 'user5'));
     $user6 = $this->getDataGenerator()->create_user(array('idnumber' => 'user6', 'username' => 'user6'));
     $course1 = $this->getDataGenerator()->create_course(array('idnumber' => 'course1', 'shortname' => 'course1'));
     $course2 = $this->getDataGenerator()->create_course(array('idnumber' => 'course2', 'shortname' => 'course2'));
     $course3 = $this->getDataGenerator()->create_course(array('idnumber' => 'course3', 'shortname' => 'course3'));
     // Set up some ldap data.
     $o = array();
     $o['objectClass'] = array('posixGroup');
     $o['cn'] = 'course1';
     $o['gidNumber'] = '1';
     $o['memberUid'] = array('user1', 'user2', 'user3', 'userx');
     ldap_add($connection, 'cn=' . $o['cn'] . ',ou=students,' . $topdn, $o);
     $o = array();
     $o['objectClass'] = array('posixGroup');
     $o['cn'] = 'course1';
     $o['gidNumber'] = '2';
     $o['memberUid'] = array('user5');
     ldap_add($connection, 'cn=' . $o['cn'] . ',ou=teachers,' . $topdn, $o);
     $o = array();
//.........这里部分代码省略.........
开发者ID:pzhu2004,项目名称:moodle,代码行数:101,代码来源:ldap_test.php



注:本文中的ldap_add函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ldap_addslashes函数代码示例发布时间:2022-05-15
下一篇:
PHP lcm_query函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap