#
# LDAP modlist generation
#
# Copyright (c) 2015 Red Hat, Inc.
# Author: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
#
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
userPassword=None,
gecos=None,
homeDirectory=None,
loginShell=None,
cn=None,
sn=None):
"""
Generate an RFC2307(bis) user add-modlist for passing to ldap.add*
"""
user = (
[
('objectClass', ['top', 'inetOrgPerson', 'posixAccount']),
('uidNumber', [uidNumber]),
('gidNumber', [gidNumber]),
if userPassword is None
else userPassword]),
if homeDirectory is None
else homeDirectory]),
if loginShell is None
else loginShell]),
]
)
if gecos is not None:
return user
"""
Generate an RFC2307 group add-modlist for passing to ldap.add*.
"""
attr_list = [
('objectClass', ['top', 'posixGroup']),
('gidNumber', [gidNumber])
]
"""
Generate an RFC2307bis group add-modlist for passing to ldap.add*.
"""
attr_list = [
('objectClass', ['top', 'extensibleObject', 'groupOfNames']),
('gidNumber', [gidNumber])
]
member_list = []
for uid in member_uids:
for gid in member_gids:
"""
Generate an RFC2307bis netgroup add-modlist for passing to ldap.add*.
"""
attr_list = [
('objectClass', ['top', 'nisNetgroup'])
]
if triples:
if members:
"""LDAP add-modlist list"""
base_dn=None,
userPassword=None,
gecos=None,
homeDirectory=None,
loginShell=None,
cn=None,
sn=None):
"""Add an RFC2307(bis) user add-modlist."""
base_dn=None):
"""Add an RFC2307 group add-modlist."""
member_uids=[], member_gids=[],
base_dn=None):
"""Add an RFC2307bis group add-modlist."""
"""Add an RFC2307bis netgroup add-modlist."""