diff options
-rw-r--r-- | ipalib/plugins/sudocmd.py | 9 | ||||
-rw-r--r-- | ipalib/plugins/sudorule.py | 6 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_sudocmd_plugin.py | 18 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_sudocmdgroup_plugin.py | 10 |
4 files changed, 24 insertions, 19 deletions
diff --git a/ipalib/plugins/sudocmd.py b/ipalib/plugins/sudocmd.py index a7ccd325d..1fef17217 100644 --- a/ipalib/plugins/sudocmd.py +++ b/ipalib/plugins/sudocmd.py @@ -51,20 +51,19 @@ class sudocmd(LDAPObject): object_class = ['ipaobject', 'ipasudocmd'] # object_class_config = 'ipahostobjectclasses' search_attributes = [ - 'cn', 'description', + 'sudocmd', 'description', ] default_attributes = [ - 'cn', 'description', + 'sudocmd', 'description', ] uuid_attribute = 'ipauniqueid' label = _('SudoCmds') takes_params = ( - Str('cn', + Str('sudocmd', cli_name='command', label=_('Sudo Command'), primary_key=True, - #normalizer=lambda value: value.lower(), ), Str('description?', cli_name='desc', @@ -82,7 +81,7 @@ class sudocmd(LDAPObject): except errors.NotFound: try: (dn, entry_attrs) = self.backend.find_entry_by_attr( - 'cn', keys[-1], self.object_class, [''], + 'sudocmd', keys[-1], self.object_class, [''], self.container_dn ) except errors.NotFound: diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py index 0bdf982e2..df0ae5c4d 100644 --- a/ipalib/plugins/sudorule.py +++ b/ipalib/plugins/sudorule.py @@ -58,6 +58,12 @@ class sudorule(LDAPObject): cli_name='desc', label=_('Description'), ), + StrEnum('cmdcategory?', + cli_name='cmdcat', + label=_('Command category'), + doc=_('Command category the rule applies to'), + values=(u'all', ), + ), Str('memberuser_user?', label=_('Users'), flags=['no_create', 'no_update', 'no_search'], diff --git a/tests/test_xmlrpc/test_sudocmd_plugin.py b/tests/test_xmlrpc/test_sudocmd_plugin.py index 31457c24d..dd70b2411 100644 --- a/tests/test_xmlrpc/test_sudocmd_plugin.py +++ b/tests/test_xmlrpc/test_sudocmd_plugin.py @@ -69,9 +69,9 @@ class test_sudocmd(Declarative): value=sudocmd1, summary=u'Added sudo command "%s"' % sudocmd1, result=dict( - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), - cn=[sudocmd1], + sudocmd=[sudocmd1], description=[u'Test sudo command 1'], objectclass=objectclasses.sudocmd, ipauniqueid=[fuzzy_uuid], @@ -98,9 +98,9 @@ class test_sudocmd(Declarative): value=sudocmd1, summary=None, result=dict( - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), - cn=[sudocmd1], + sudocmd=[sudocmd1], description=[u'Test sudo command 1'], ), ), @@ -116,9 +116,9 @@ class test_sudocmd(Declarative): summary=u'1 sudo command matched', result=[ dict( - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), - cn=[sudocmd1], + sudocmd=[sudocmd1], description=[u'Test sudo command 1'], ), ], @@ -134,7 +134,7 @@ class test_sudocmd(Declarative): value=sudocmd1, summary=u'Modified sudo command "%s"' % sudocmd1, result=dict( - cn=[sudocmd1], + sudocmd=[sudocmd1], description=[u'Updated sudo command 1'], ), ), @@ -148,9 +148,9 @@ class test_sudocmd(Declarative): value=sudocmd1, summary=None, result=dict( - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), - cn=[sudocmd1], + sudocmd=[sudocmd1], description=[u'Updated sudo command 1'], ), ), diff --git a/tests/test_xmlrpc/test_sudocmdgroup_plugin.py b/tests/test_xmlrpc/test_sudocmdgroup_plugin.py index ec2164c49..a6b4ab2a2 100644 --- a/tests/test_xmlrpc/test_sudocmdgroup_plugin.py +++ b/tests/test_xmlrpc/test_sudocmdgroup_plugin.py @@ -42,16 +42,16 @@ class test_sudocmdgroup(Declarative): dict( desc='Create %r' % sudocmd1, command=( - 'sudocmd_add', [], dict(cn=sudocmd1,) + 'sudocmd_add', [], dict(sudocmd=sudocmd1,) ), expected=dict( value=sudocmd1, summary=u'Added sudo command "%s"' % sudocmd1, result=dict( objectclass=objectclasses.sudocmd, - cn=[u'/usr/bin/sudotestcmd1'], + sudocmd=[u'/usr/bin/sudotestcmd1'], ipauniqueid=[fuzzy_uuid], - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), ), ), @@ -65,8 +65,8 @@ class test_sudocmdgroup(Declarative): value=sudocmd1, summary=None, result=dict( - cn=[sudocmd1], - dn=u'cn=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, + sudocmd=[sudocmd1], + dn=u'sudocmd=%s,cn=sudocmds,cn=accounts,%s' % (sudocmd1, api.env.basedn), ), ), |