summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-09-17 13:04:49 +0200
committerTomas Babej <tbabej@redhat.com>2014-09-22 12:00:06 +0200
commit0632c5fe5859e272e6a02984935a487eaace64f6 (patch)
tree34b66801fe9cc9544ff2905dc3515201051cc164
parent95deccd7a8b1f2129f6987a5a3a9e6ed57168442 (diff)
downloadfreeipa-0632c5fe5859e272e6a02984935a487eaace64f6.zip
freeipa-0632c5fe5859e272e6a02984935a487eaace64f6.tar.gz
freeipa-0632c5fe5859e272e6a02984935a487eaace64f6.tar.xz
idviews: Add ipaOriginalUid
-rw-r--r--ACI.txt2
-rw-r--r--API.txt9
-rw-r--r--install/share/71idviews.ldif3
-rw-r--r--ipalib/plugins/idviews.py31
4 files changed, 38 insertions, 7 deletions
diff --git a/ACI.txt b/ACI.txt
index 30ca95a..81f7b6a 100644
--- a/ACI.txt
+++ b/ACI.txt
@@ -121,7 +121,7 @@ aci: (targetfilter = "(objectclass=ipahostgroup)")(version 3.0;acl "permission:S
dn: cn=views,cn=accounts,dc=ipa,dc=example
aci: (targetattr = "cn || createtimestamp || description || entryusn || gidnumber || ipaanchoruuid || modifytimestamp || objectclass")(targetfilter = "(|(objectclass=ipaGroupOverride)(objectclass=ipaOverrideAnchor))")(version 3.0;acl "permission:System: Read Group ID Overrides";allow (compare,read,search) userdn = "ldap:///all";)
dn: cn=views,cn=accounts,dc=ipa,dc=example
-aci: (targetattr = "createtimestamp || description || entryusn || homedirectory || ipaanchoruuid || modifytimestamp || objectclass || uid || uidnumber")(targetfilter = "(|(objectclass=ipaOverrideAnchor)(objectclass=ipaUserOverride))")(version 3.0;acl "permission:System: Read User ID Overrides";allow (compare,read,search) userdn = "ldap:///all";)
+aci: (targetattr = "createtimestamp || description || entryusn || homedirectory || ipaanchoruuid || ipaoriginaluid || modifytimestamp || objectclass || uid || uidnumber")(targetfilter = "(|(objectclass=ipaOverrideAnchor)(objectclass=ipaUserOverride))")(version 3.0;acl "permission:System: Read User ID Overrides";allow (compare,read,search) userdn = "ldap:///all";)
dn: cn=ranges,cn=etc,dc=ipa,dc=example
aci: (targetattr = "cn || createtimestamp || entryusn || ipabaseid || ipabaserid || ipaidrangesize || ipanttrusteddomainsid || iparangetype || ipasecondarybaserid || modifytimestamp || objectclass")(targetfilter = "(objectclass=ipaidrange)")(version 3.0;acl "permission:System: Read ID Ranges";allow (compare,read,search) userdn = "ldap:///all";)
dn: cn=views,cn=accounts,dc=ipa,dc=example
diff --git a/API.txt b/API.txt
index 09464db..5b7fc9a 100644
--- a/API.txt
+++ b/API.txt
@@ -2104,13 +2104,14 @@ output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDA
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
output: PrimaryKey('value', None, None)
command: idoverrideuser_add
-args: 2,9,3
+args: 2,10,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('description', attribute=True, cli_name='desc', multivalue=False, required=True)
option: Str('homedirectory', attribute=True, cli_name='homedir', multivalue=False, required=False)
+option: Str('ipaoriginaluid', attribute=True, cli_name='ipaoriginaluid', 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)
@@ -2129,13 +2130,14 @@ output: Output('result', <type 'dict'>, None)
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
output: ListOfPrimaryKeys('value', None, None)
command: idoverrideuser_find
-args: 2,11,4
+args: 2,12,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('description', attribute=True, autofill=False, cli_name='desc', 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: Str('ipaoriginaluid', attribute=True, autofill=False, cli_name='ipaoriginaluid', 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)
@@ -2148,7 +2150,7 @@ output: ListOfEntries('result', (<type 'list'>, <type 'tuple'>), Gettext('A list
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
output: Output('truncated', <type 'bool'>, None)
command: idoverrideuser_mod
-args: 2,12,3
+args: 2,13,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')
@@ -2156,6 +2158,7 @@ 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: Str('homedirectory', attribute=True, autofill=False, cli_name='homedir', multivalue=False, required=False)
+option: Str('ipaoriginaluid', attribute=True, autofill=False, cli_name='ipaoriginaluid', 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)
diff --git a/install/share/71idviews.ldif b/install/share/71idviews.ldif
index c146be3..3f8df2e 100644
--- a/install/share/71idviews.ldif
+++ b/install/share/71idviews.ldif
@@ -1,6 +1,7 @@
dn: cn=schema
attributeTypes: (2.16.840.1.113730.3.8.11.62 NAME 'ipaAnchorUUID' DESC 'Unique Anchor Identifier' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'IPA v4')
+attributeTypes: (2.16.840.1.113730.3.8.11.63 NAME 'ipaOriginalUid' DESC 'Original UID of overriden user' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'IPA v4')
objectClasses: (2.16.840.1.113730.3.8.12.29 NAME 'ipaIDView' SUP nsContainer STRUCTURAL MAY ( description ) X-ORIGIN 'IPA v4' )
objectClasses: (2.16.840.1.113730.3.8.12.30 NAME 'ipaOverrideAnchor' SUP top STRUCTURAL MUST ( ipaAnchorUUID ) MAY ( description ) X-ORIGIN 'IPA v4' )
-objectClasses: (2.16.840.1.113730.3.8.12.31 NAME 'ipaUserOverride' DESC 'Override for User Attributes' SUP ipaOverrideAnchor STRUCTURAL MAY ( uid $ uidNumber $ gidNumber $ homeDirectory $ loginShell $ gecos ) X-ORIGIN 'IPA v4' )
+objectClasses: (2.16.840.1.113730.3.8.12.31 NAME 'ipaUserOverride' DESC 'Override for User Attributes' SUP ipaOverrideAnchor STRUCTURAL MAY ( uid $ uidNumber $ gidNumber $ homeDirectory $ loginShell $ gecos $ ipaOriginalUid ) X-ORIGIN 'IPA v4' )
objectClasses: (2.16.840.1.113730.3.8.12.32 NAME 'ipaGroupOverride' DESC 'Override for Group Attributes' SUP ipaOverrideAnchor STRUCTURAL MAY ( gidNumber $ cn ) X-ORIGIN 'IPA v4' )
diff --git a/ipalib/plugins/idviews.py b/ipalib/plugins/idviews.py
index 173e70c..dbb6b22 100644
--- a/ipalib/plugins/idviews.py
+++ b/ipalib/plugins/idviews.py
@@ -585,14 +585,14 @@ class idoverrideuser(baseidoverride):
'ipapermright': {'read', 'search', 'compare'},
'ipapermdefaultattr': {
'objectClass', 'ipaAnchorUUID', 'uidNumber', 'description',
- 'homeDirectory', 'uid',
+ 'homeDirectory', 'uid', 'ipaOriginalUid',
},
},
}
object_class = baseidoverride.object_class + ['ipaUserOverride']
default_attributes = baseidoverride.default_attributes + [
- 'homeDirectory', 'uidNumber', 'uid',
+ 'homeDirectory', 'uidNumber', 'uid', 'ipaOriginalUid',
]
takes_params = baseidoverride.takes_params + (
@@ -614,10 +614,20 @@ class idoverrideuser(baseidoverride):
cli_name='homedir',
label=_('Home directory'),
),
+ Str('ipaoriginaluid?',
+ flags=['no_option', 'no_output']
+ ),
)
override_object = 'user'
+ def update_original_uid_reference(self, entry_attrs):
+ anchor = entry_attrs.single_value.get('ipaanchoruuid')
+ original_uid = resolve_anchor_to_object_name(self.backend,
+ self.override_object,
+ anchor)
+ entry_attrs['ipaOriginalUid'] = original_uid
+
@register()
class idoverridegroup(baseidoverride):
@@ -671,6 +681,14 @@ class idoverrideuser_add(baseidoverride_add):
__doc__ = _('Add a new User ID override.')
msg_summary = _('Added User ID override "%(value)s"')
+ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
+ dn = super(idoverrideuser_add, self).pre_callback(ldap, dn,
+ entry_attrs, attrs_list, *keys, **options)
+
+ # Update the ipaOriginalUid
+ self.obj.update_original_uid_reference(entry_attrs)
+ return dn
+
@register()
class idoverrideuser_del(baseidoverride_del):
@@ -683,6 +701,15 @@ class idoverrideuser_mod(baseidoverride_mod):
__doc__ = _('Modify an User ID override.')
msg_summary = _('Modified an User ID override "%(value)s"')
+ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
+ dn = super(idoverrideuser_mod, self).pre_callback(ldap, dn,
+ entry_attrs, attrs_list, *keys, **options)
+
+ # Update the ipaOriginalUid
+ self.obj.set_anchoruuid_from_dn(dn, entry_attrs)
+ self.obj.update_original_uid_reference(entry_attrs)
+ return dn
+
@register()
class idoverrideuser_find(baseidoverride_find):