2016.3.0 新版功能.
This is an alternative to the ldap
interface provided by the
ldapmod
execution module.
depends: |
|
---|
salt.modules.ldap3.
LDAPError
(message, cause=None)¶Base class of all LDAP exceptions raised by backends.
This is only used for errors encountered while interacting with the LDAP server; usage errors (e.g., invalid backend name) will have a different type.
变量: | cause -- backend exception object, if applicable |
---|
salt.modules.ldap3.
add
(connect_spec, dn, attributes)¶Add an entry to an LDAP database.
参数: |
|
---|---|
返回: |
|
salt.modules.ldap3.
change
(connect_spec, dn, before, after)¶Modify an entry in an LDAP database.
This does the same thing as modify()
, but with a simpler
interface. Instead of taking a list of directives, it takes a
before and after view of an entry, determines the differences
between the two, computes the directives, and executes them.
Any attribute value present in before
but missing in after
is deleted. Any attribute value present in after
but missing
in before
is added. Any attribute value in the database that
is not mentioned in either before
or after
is not altered.
Any attribute value that is present in both before
and
after
is ignored, regardless of whether that attribute value
exists in the database.
参数: |
|
---|---|
返回: |
|
salt.modules.ldap3.
connect
(connect_spec=None)¶Connect and optionally bind to an LDAP server.
参数: | connect_spec -- This can be an LDAP connection object returned by a previous
call to
|
---|---|
返回: | an object representing an LDAP connection that can be used as
the connect_spec argument to any of the functions in this
module (to avoid the overhead of making and terminating
multiple connections).This object should be used as a context manager. It is safe
to nest |
salt.modules.ldap3.
delete
(connect_spec, dn)¶Delete an entry from an LDAP database.
参数: |
|
---|---|
返回: |
|
salt.modules.ldap3.
modify
(connect_spec, dn, directives)¶Modify an entry in an LDAP database.
参数: |
|
---|---|
返回: |
|
salt.modules.ldap3.
search
(connect_spec, base, scope='subtree', filterstr='(objectClass=*)', attrlist=None, attrsonly=0)¶Search an LDAP database.
参数: |
|
---|---|
返回: | a dict of results. The dict is empty if there are no results. The dict maps each returned entry's distinguished name to a dict that maps each of the matching attribute names to a list of its values. |
CLI example:
salt '*' ldap3.search "{
'url': 'ldaps://ldap.example.com/',
'bind': {
'method': 'simple',
'dn': 'cn=admin,dc=example,dc=com',
'password': 'secret',
},
}" "base='dc=example,dc=com'"