summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/aci.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-01-16 11:14:59 +0100
committerMartin Kosek <mkosek@redhat.com>2012-01-16 20:08:13 +0100
commit7f6c9ac04c751063c932109855cf02c26a50a6ee (patch)
tree1524985a358628bd0ce9abc357458ce35da5a490 /ipalib/plugins/aci.py
parentf7753bf55cf713b93f1c12d0fc6dde7f804dd975 (diff)
downloadfreeipa-7f6c9ac04c751063c932109855cf02c26a50a6ee.tar.gz
freeipa-7f6c9ac04c751063c932109855cf02c26a50a6ee.tar.xz
freeipa-7f6c9ac04c751063c932109855cf02c26a50a6ee.zip
Add missing --pkey-only option for selfservice and delegation
pkey-only functionality has to be implemented separately for these modules as they are based on crud.Search instead of standard LDAPSearch. Delegation moduled was also fixed to support new format of ACI's memberof attribute introduced in patch "Display the value of memberOf ACIs in permission plugin." https://fedorahosted.org/freeipa/ticket/2092
Diffstat (limited to 'ipalib/plugins/aci.py')
-rw-r--r--ipalib/plugins/aci.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py
index 8a10efccb..e4ef2ef17 100644
--- a/ipalib/plugins/aci.py
+++ b/ipalib/plugins/aci.py
@@ -126,6 +126,7 @@ from ipalib.aci import ACI
from ipalib.dn import DN
from ipalib import output
from ipalib import _, ngettext
+from ipalib.plugins.baseldap import gen_pkey_only_option
if api.env.in_server and api.env.context in ['lite', 'server']:
from ldap import explode_dn
from ipapython.ipa_log_manager import *
@@ -297,7 +298,7 @@ def _make_aci(ldap, current, aciname, kw):
return a
-def _aci_to_kw(ldap, a, test=False):
+def _aci_to_kw(ldap, a, test=False, pkey_only=False):
"""Convert an ACI into its equivalent keywords.
This is used for the modify operation so we can merge the
@@ -306,6 +307,8 @@ def _aci_to_kw(ldap, a, test=False):
"""
kw = {}
kw['aciprefix'], kw['aciname'] = _parse_aci_name(a.name)
+ if pkey_only:
+ return kw
kw['permissions'] = tuple(a.permissions)
if 'targetattr' in a.target:
kw['attrs'] = list(a.target['targetattr']['expression'])
@@ -682,7 +685,8 @@ class aci_find(crud.Search):
NO_CLI = True
msg_summary = ngettext('%(count)d ACI matched', '%(count)d ACIs matched', 0)
- takes_options = (_prefix_option.clone_rename("aciprefix?", required=False),)
+ takes_options = (_prefix_option.clone_rename("aciprefix?", required=False),
+ gen_pkey_only_option("name"),)
def execute(self, term, **kw):
ldap = self.api.Backend.ldap2
@@ -837,7 +841,8 @@ class aci_find(crud.Search):
if kw.get('raw', False):
aci = dict(aci=unicode(result))
else:
- aci = _aci_to_kw(ldap, result)
+ aci = _aci_to_kw(ldap, result,
+ pkey_only=kw.get('pkey_only', False))
acis.append(aci)
return dict(