本文整理汇总了PHP中Ldap::addGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::addGroup方法的具体用法?PHP Ldap::addGroup怎么用?PHP Ldap::addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ldap
的用法示例。
在下文中一共展示了Ldap::addGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: base64_encode
Ldap::deleteGroup($connection, 'Rogues', "ou=StarWars,{$dc}");
Ldap::deleteGroup($connection, 'StarWars', $dc);
Ldap::addGroup($connection, 'StarWars', $dc);
$chewbaccaDN = Ldap::add($connection, 'chewbacca', '{MD5}' . base64_encode(pack('H*', md5('aaawwwwrrrkk'))), "ou=StarWars,{$dc}", 'Chewbacca', 'Chewbacca', array('givenName' => 'Chewbacca', 'displayName' => 'Chewbacca the Wokiee', 'ou' => array('StarWars', 'Rogues', 'RebelAlliance'), 'mail' => array('chewbacca@millenniumfalcon.net')));
$hanSoloDN = Ldap::add($connection, 'han.solo', '{MD5}' . base64_encode(pack('H*', md5('leiaishot'))), "ou=StarWars,{$dc}", 'Solo', 'Han Solo', array('givenName' => 'Han', 'displayName' => 'He who shot first', 'ou' => array('StarWars', 'Rogues', 'RebelAlliance'), 'mail' => array('han.solo@millenniumfalcon.net')));
$princessLeiaDN = Ldap::add($connection, 'leia', '{MD5}' . base64_encode(pack('H*', md5('bunhead'))), "ou=StarWars,{$dc}", 'Organa', 'Leia Organa', array('givenName' => 'Leia', 'displayName' => 'Princess Leia', 'ou' => array('StarWars', 'RebelAlliance'), 'mail' => array('leia@rebelalliance.org')));
$darthVaderDN = Ldap::add($connection, 'darth.vader', '{MD5}' . base64_encode(pack('H*', md5('whosyourdaddy'))), "ou=StarWars,{$dc}", 'Skywalker', 'Anakin Skywalker', array('givenName' => 'Anakin', 'displayName' => 'Darth Vader', 'ou' => array('StarWars', 'GalacticEmpire', 'Sith'), 'mail' => array('vader@empire.com')));
$jabbaTheHuttDN = Ldap::add($connection, 'jabba.thehutt', '{MD5}' . base64_encode(pack('H*', md5('wishihadlegs'))), "ou=StarWars,{$dc}", 'Hutt', 'Jabba Hutt', array('givenName' => 'Jabba', 'displayName' => 'Jabba the Hutt', 'ou' => array('Hutts'), 'mail' => array('jabba@hutt.com')));
$obiWanDN = Ldap::add($connection, 'obi.wan', '{MD5}' . base64_encode(pack('H*', md5('thesearenotthedroids'))), "ou=StarWars,{$dc}", 'Kenobi', 'Obi Wan Kenobi', array('givenName' => 'Obi Wan', 'displayName' => 'Obi Wan Kenobi', 'ou' => array('StarWars', 'RebelAlliance', 'Jedi'), 'seeAlso' => array("ou=StarWars,{$dc}", "ou=RebelAlliance,ou=StarWars,{$dc}", "ou=Jedi,ou=RebelAlliance,ou=StarWars,{$dc}"), 'mail' => array('obi.wan@jedi.org')));
$bobaFettDN = Ldap::add($connection, 'boba.fett', '{MD5}' . base64_encode(pack('H*', md5('ihatesarlacs'))), "ou=StarWars,{$dc}", 'Fett', 'Boba Fett', array('givenName' => 'Boba', 'displayName' => 'Boba Fett', 'ou' => array('StarWars', 'Rogues'), 'seeAlso' => array("ou=StarWars,{$dc}", "ou=Rogues,ou=StarWars,{$dc}"), 'mail' => array('boba.fett@bountyhunter.com')));
$yodaDN = Ldap::add($connection, 'yoda', '{MD5}' . base64_encode(pack('H*', md5('dagobah4eva'))), "ou=StarWars,{$dc}", 'Yoda', 'Yoda', array('givenName' => 'Yoda', 'displayName' => 'Yoda', 'ou' => array('StarWars', 'RebelAlliance', 'Jedi'), 'seeAlso' => array("ou=StarWars,{$dc}", "ou=RebelAlliance,ou=StarWars,{$dc}", "ou=Jedi,ou=RebelAlliance,ou=StarWars,{$dc}"), 'mail' => array('yoda@jedi.org')));
Ldap::addGroup($connection, 'RebelAlliance', "ou=StarWars,{$dc}", array('seeAlso' => array($princessLeiaDN, $chewbaccaDN, $hanSoloDN, $obiWanDN, $yodaDN)));
Ldap::addGroup($connection, 'Rogues', "ou=StarWars,{$dc}", array('seeAlso' => array($chewbaccaDN, $hanSoloDN)));
Ldap::addGroup($connection, 'GalacticEmpire', "ou=StarWars,{$dc}", array('seeAlso' => array($darthVaderDN)));
Ldap::addGroup($connection, 'Sith', "ou=GalacticEmpire,ou=StarWars,{$dc}", array('seeAlso' => array($darthVaderDN)));
Ldap::addGroup($connection, 'Jedi', "ou=RebelAlliance,ou=StarWars,{$dc}", array('seeAlso' => array($obiWanDN, $yodaDN)));
// This dumps all the LDAP data
// Ldap::fetchAll( $connection, $dc );
Ldap::close($connection);
/**
* Support for LDAP functions connect, add, delete and get_entries.
*/
class Ldap
{
/**
* Connects to an LDAP server specified by $uri, with admin $user and $password.
*
* Returns a resource which can be used in LDAP functions like add, delete, search.
*
* @param string $uri Uri for LDAP, such as 'ldap://example.com'
* @param string $format Format for an entry, like 'cn=%s,dc=example,dc=com'. %s is a literal placeholder for username
示例2: crypt
* Setup the test accounts on the ldap server.
*
* Assumes the username entries are 'uid'.
*
*/
$dc = "dc=ezctest,dc=ez,dc=no";
$host = "ezctest.ez.no";
$connection = Ldap::connect("ldap://{$host}", "cn=%s,{$dc}", 'admin', 'wee123');
Ldap::delete($connection, 'john.doe', $dc);
Ldap::delete($connection, 'jan.modaal', $dc);
Ldap::delete($connection, 'zhang.san', $dc);
Ldap::delete($connection, 'johnny.doe', "ou=Users,{$dc}");
Ldap::delete($connection, 'hans.mustermann', $dc);
Ldap::delete($connection, 'Ruşinică Piţigoi', $dc);
Ldap::deleteGroup($connection, 'Users', $dc);
Ldap::addGroup($connection, 'Users', $dc);
Ldap::add($connection, 'john.doe', '{CRYPT}' . crypt('foobar'), $dc);
Ldap::add($connection, 'jan.modaal', '{SHA}' . base64_encode(pack('H*', sha1('qwerty'))), $dc);
Ldap::add($connection, 'zhang.san', '{MD5}' . base64_encode(pack('H*', md5('asdfgh'))), $dc);
Ldap::add($connection, 'johnny.doe', '{MD5}' . base64_encode(pack('H*', md5('12345'))), "ou=Users,{$dc}", array('displayName' => 'Johnny Doe', 'ou' => array('Users')));
//Ldap::add( $connection, 'jan.modaal', '{SHA}' . base64_encode( sha1( 'qwerty' ) ), $dc );
//Ldap::add( $connection, 'zhang.san', '{MD5}' . base64_encode( md5( 'asdfgh' ) ), $dc );
Ldap::add($connection, 'hans.mustermann', 'abcdef', $dc);
Ldap::add($connection, 'Ruşinică Piţigoi', '12345', $dc);
Ldap::fetchAll($connection, $dc);
Ldap::close($connection);
/**
* Support for LDAP functions connect, add, delete and get_entries.
*/
class Ldap
{