mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
idviews: Create basic idview plugin structure
Part of: https://fedorahosted.org/freeipa/ticket/3979 Reviewed-By: Petr Viktorin <pviktori@redhat.com> Reviewed-By: Petr Vobornik <pvoborni@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
committed by
Martin Kosek
parent
f48a7bb730
commit
b65b74890b
140
API.txt
140
API.txt
@@ -2032,6 +2032,86 @@ command: i18n_messages
|
||||
args: 0,1,1
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('texts', <type 'dict'>, None)
|
||||
command: idoverride_add
|
||||
args: 2,11,3
|
||||
arg: Str('idviewcn', cli_name='idview', multivalue=False, primary_key=True, query=True, required=True)
|
||||
arg: Str('ipaanchoruuid', attribute=True, cli_name='anchor', multivalue=False, primary_key=True, required=True)
|
||||
option: Str('addattr*', cli_name='addattr', exclude='webui')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('cn', attribute=True, cli_name='group_name', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', required=False)
|
||||
option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
|
||||
option: Int('gidnumber', attribute=True, cli_name='gid', minvalue=1, multivalue=False, required=False)
|
||||
option: Str('homedirectory', attribute=True, cli_name='homedir', multivalue=False, required=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Str('setattr*', cli_name='setattr', exclude='webui')
|
||||
option: Str('uid', attribute=True, cli_name='login', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', required=False)
|
||||
option: Int('uidnumber', attribute=True, cli_name='uid', minvalue=1, multivalue=False, required=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idoverride_del
|
||||
args: 2,2,3
|
||||
arg: Str('idviewcn', cli_name='idview', multivalue=False, primary_key=True, query=True, required=True)
|
||||
arg: Str('ipaanchoruuid', attribute=True, cli_name='anchor', multivalue=True, primary_key=True, query=True, required=True)
|
||||
option: Flag('continue', autofill=True, cli_name='continue', default=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('result', <type 'dict'>, None)
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: ListOfPrimaryKeys('value', None, None)
|
||||
command: idoverride_find
|
||||
args: 2,13,4
|
||||
arg: Str('idviewcn', cli_name='idview', multivalue=False, primary_key=True, query=True, required=True)
|
||||
arg: Str('criteria?', noextrawhitespace=False)
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('cn', attribute=True, autofill=False, cli_name='group_name', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', query=True, required=False)
|
||||
option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, query=True, required=False)
|
||||
option: Int('gidnumber', attribute=True, autofill=False, cli_name='gid', minvalue=1, multivalue=False, query=True, required=False)
|
||||
option: Str('homedirectory', attribute=True, autofill=False, cli_name='homedir', multivalue=False, query=True, required=False)
|
||||
option: Str('ipaanchoruuid', attribute=True, autofill=False, cli_name='anchor', multivalue=False, primary_key=True, query=True, required=False)
|
||||
option: Flag('pkey_only?', autofill=True, default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Int('sizelimit?', autofill=False, minvalue=0)
|
||||
option: Int('timelimit?', autofill=False, minvalue=0)
|
||||
option: Str('uid', attribute=True, autofill=False, cli_name='login', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', query=True, required=False)
|
||||
option: Int('uidnumber', attribute=True, autofill=False, cli_name='uid', minvalue=1, multivalue=False, query=True, required=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('count', <type 'int'>, None)
|
||||
output: ListOfEntries('result', (<type 'list'>, <type 'tuple'>), Gettext('A list of LDAP entries', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: Output('truncated', <type 'bool'>, None)
|
||||
command: idoverride_mod
|
||||
args: 2,14,3
|
||||
arg: Str('idviewcn', cli_name='idview', multivalue=False, primary_key=True, query=True, required=True)
|
||||
arg: Str('ipaanchoruuid', attribute=True, cli_name='anchor', multivalue=False, primary_key=True, query=True, required=True)
|
||||
option: Str('addattr*', cli_name='addattr', exclude='webui')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('cn', attribute=True, autofill=False, cli_name='group_name', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', required=False)
|
||||
option: Str('delattr*', cli_name='delattr', exclude='webui')
|
||||
option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, required=False)
|
||||
option: Int('gidnumber', attribute=True, autofill=False, cli_name='gid', minvalue=1, multivalue=False, required=False)
|
||||
option: Str('homedirectory', attribute=True, autofill=False, cli_name='homedir', multivalue=False, required=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Str('rename', cli_name='rename', multivalue=False, primary_key=True, required=False)
|
||||
option: Flag('rights', autofill=True, default=False)
|
||||
option: Str('setattr*', cli_name='setattr', exclude='webui')
|
||||
option: Str('uid', attribute=True, autofill=False, cli_name='login', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', required=False)
|
||||
option: Int('uidnumber', attribute=True, autofill=False, cli_name='uid', minvalue=1, multivalue=False, required=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idoverride_show
|
||||
args: 2,4,3
|
||||
arg: Str('idviewcn', cli_name='idview', multivalue=False, primary_key=True, query=True, required=True)
|
||||
arg: Str('ipaanchoruuid', attribute=True, cli_name='anchor', multivalue=False, primary_key=True, query=True, required=True)
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Flag('rights', autofill=True, default=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idrange_add
|
||||
args: 1,12,3
|
||||
arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, required=True)
|
||||
@@ -2107,6 +2187,66 @@ option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idview_add
|
||||
args: 1,6,3
|
||||
arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, required=True)
|
||||
option: Str('addattr*', cli_name='addattr', exclude='webui')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Str('setattr*', cli_name='setattr', exclude='webui')
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idview_del
|
||||
args: 1,2,3
|
||||
arg: Str('cn', attribute=True, cli_name='name', multivalue=True, primary_key=True, query=True, required=True)
|
||||
option: Flag('continue', autofill=True, cli_name='continue', default=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('result', <type 'dict'>, None)
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: ListOfPrimaryKeys('value', None, None)
|
||||
command: idview_find
|
||||
args: 1,8,4
|
||||
arg: Str('criteria?', noextrawhitespace=False)
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('cn', attribute=True, autofill=False, cli_name='name', multivalue=False, primary_key=True, query=True, required=False)
|
||||
option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, query=True, required=False)
|
||||
option: Flag('pkey_only?', autofill=True, default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Int('sizelimit?', autofill=False, minvalue=0)
|
||||
option: Int('timelimit?', autofill=False, minvalue=0)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Output('count', <type 'int'>, None)
|
||||
output: ListOfEntries('result', (<type 'list'>, <type 'tuple'>), Gettext('A list of LDAP entries', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: Output('truncated', <type 'bool'>, None)
|
||||
command: idview_mod
|
||||
args: 1,9,3
|
||||
arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, query=True, required=True)
|
||||
option: Str('addattr*', cli_name='addattr', exclude='webui')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('delattr*', cli_name='delattr', exclude='webui')
|
||||
option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, required=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Str('rename', cli_name='rename', multivalue=False, primary_key=True, required=False)
|
||||
option: Flag('rights', autofill=True, default=False)
|
||||
option: Str('setattr*', cli_name='setattr', exclude='webui')
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: idview_show
|
||||
args: 1,4,3
|
||||
arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, query=True, required=True)
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Flag('rights', autofill=True, default=False)
|
||||
option: Str('version?', exclude='webui')
|
||||
output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: json_metadata
|
||||
args: 2,4,3
|
||||
arg: Str('objname?')
|
||||
|
||||
191
ipalib/plugins/idviews.py
Normal file
191
ipalib/plugins/idviews.py
Normal file
@@ -0,0 +1,191 @@
|
||||
# Authors:
|
||||
# Alexander Bokovoy <abokovoy@redhat.com>
|
||||
# Tomas Babej <tbabej@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2014 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from ipalib.plugins.baseldap import (LDAPObject, LDAPCreate,
|
||||
LDAPDelete, LDAPUpdate, LDAPSearch,
|
||||
LDAPRetrieve)
|
||||
from ipalib import api, Str, Int, _, ngettext
|
||||
from ipalib.plugable import Registry
|
||||
|
||||
|
||||
__doc__ = _("""
|
||||
ID views
|
||||
Manage ID views
|
||||
IPA allows to override certain properties of users and groups per each host.
|
||||
This functionality is primarily used to allow migration from older systems or
|
||||
other Identity Management solutions.
|
||||
""")
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
@register()
|
||||
class idview(LDAPObject):
|
||||
"""
|
||||
ID view object.
|
||||
"""
|
||||
|
||||
container_dn = api.env.container_views
|
||||
object_name = _('ID view')
|
||||
object_name_plural = _('ID views')
|
||||
object_class = ['ipaIDView', 'top']
|
||||
default_attributes = ['cn', 'description']
|
||||
rdn_is_primary_key = True
|
||||
|
||||
label = _('ID views')
|
||||
label_singular = _('ID view')
|
||||
|
||||
takes_params = (
|
||||
Str('cn',
|
||||
cli_name='name',
|
||||
label=_('ID View Name'),
|
||||
primary_key=True,
|
||||
),
|
||||
Str('description?',
|
||||
cli_name='desc',
|
||||
label=_('Description'),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@register()
|
||||
class idview_add(LDAPCreate):
|
||||
__doc__ = _('Add a new ID View.')
|
||||
msg_summary = _('Added ID view "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idview_del(LDAPDelete):
|
||||
__doc__ = _('Delete an ID view.')
|
||||
msg_summary = _('Deleted ID view "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idview_mod(LDAPUpdate):
|
||||
__doc__ = _('Modify an ID view.')
|
||||
msg_summary = _('Modified an ID view "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idview_find(LDAPSearch):
|
||||
__doc__ = _('Search for an ID view.')
|
||||
msg_summary = ngettext('%(count)d ID view matched',
|
||||
'%(count)d ID views matched', 0)
|
||||
|
||||
|
||||
@register()
|
||||
class idview_show(LDAPRetrieve):
|
||||
__doc__ = _('Display information about an ID view.')
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride(LDAPObject):
|
||||
"""
|
||||
ID override object.
|
||||
"""
|
||||
|
||||
parent_object = 'idview'
|
||||
container_dn = api.env.container_views
|
||||
|
||||
object_name = _('ID override')
|
||||
object_name_plural = _('ID overrides')
|
||||
object_class = ['ipaOverrideAnchor', 'top']
|
||||
default_attributes = [
|
||||
'cn', 'description', 'ipaAnchorUUID', 'gidNumber',
|
||||
'homeDirectory', 'uidNumber', 'uid',
|
||||
]
|
||||
|
||||
label = _('ID overrides')
|
||||
label_singular = _('ID override')
|
||||
rdn_is_primary_key = True
|
||||
|
||||
takes_params = (
|
||||
Str('ipaanchoruuid',
|
||||
cli_name='anchor',
|
||||
primary_key=True,
|
||||
label=_('Anchor to override'),
|
||||
),
|
||||
Str('description',
|
||||
cli_name='desc',
|
||||
label=_('Description'),
|
||||
),
|
||||
Str('cn?',
|
||||
pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$',
|
||||
pattern_errmsg='may only include letters, numbers, _, -, . and $',
|
||||
maxlength=255,
|
||||
cli_name='group_name',
|
||||
label=_('Group name'),
|
||||
normalizer=lambda value: value.lower(),
|
||||
),
|
||||
Int('gidnumber?',
|
||||
cli_name='gid',
|
||||
label=_('GID'),
|
||||
doc=_('Group ID Number'),
|
||||
minvalue=1,
|
||||
),
|
||||
Str('uid?',
|
||||
pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$',
|
||||
pattern_errmsg='may only include letters, numbers, _, -, . and $',
|
||||
maxlength=255,
|
||||
cli_name='login',
|
||||
label=_('User login'),
|
||||
normalizer=lambda value: value.lower(),
|
||||
),
|
||||
Int('uidnumber?',
|
||||
cli_name='uid',
|
||||
label=_('UID'),
|
||||
doc=_('User ID Number'),
|
||||
minvalue=1,
|
||||
),
|
||||
Str('homedirectory?',
|
||||
cli_name='homedir',
|
||||
label=_('Home directory'),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride_add(LDAPCreate):
|
||||
__doc__ = _('Add a new ID override.')
|
||||
msg_summary = _('Added ID override "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride_del(LDAPDelete):
|
||||
__doc__ = _('Delete an ID override.')
|
||||
msg_summary = _('Deleted ID override "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride_mod(LDAPUpdate):
|
||||
__doc__ = _('Modify an ID override.')
|
||||
msg_summary = _('Modified an ID override "%(value)s"')
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride_find(LDAPSearch):
|
||||
__doc__ = _('Search for an ID override.')
|
||||
msg_summary = ngettext('%(count)d ID override matched',
|
||||
'%(count)d ID overrides matched', 0)
|
||||
|
||||
|
||||
@register()
|
||||
class idoverride_show(LDAPRetrieve):
|
||||
__doc__ = _('Display information about an ID override.')
|
||||
Reference in New Issue
Block a user