From 52a09cedc7e7c5e4bbf085455999a223c4ea084f Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Aug 27 2020 13:24:48 +0000 Subject: Issue 51228 - Fix lock/unlock wording and lib389 use of methods Descriptions: Clean up lib389 idm-account methods to presicely locate CoS objects. Also, fix AccountPolicyEntry super() function. Fix wording in user input requests while doing lock/unlock. https://pagure.io/389-ds-base/issue/51228 Reviewed by: mreynolds (Thanks!) --- diff --git a/src/lib389/lib389/cli_idm/account.py b/src/lib389/lib389/cli_idm/account.py index 960eb8e..3e9f37e 100644 --- a/src/lib389/lib389/cli_idm/account.py +++ b/src/lib389/lib389/cli_idm/account.py @@ -96,7 +96,7 @@ def subtree_status(inst, basedn, log, args): def lock(inst, basedn, log, args): - dn = _get_dn_arg(args.dn, msg="Enter dn to check") + dn = _get_dn_arg(args.dn, msg="Enter dn to lock") accounts = Accounts(inst, basedn) acct = accounts.get(dn=dn) acct.lock() @@ -104,7 +104,7 @@ def lock(inst, basedn, log, args): def unlock(inst, basedn, log, args): - dn = _get_dn_arg(args.dn, msg="Enter dn to check") + dn = _get_dn_arg(args.dn, msg="Enter dn to unlock") accounts = Accounts(inst, basedn) acct = accounts.get(dn=dn) acct.unlock() diff --git a/src/lib389/lib389/idm/account.py b/src/lib389/lib389/idm/account.py index c772b66..666b623 100644 --- a/src/lib389/lib389/idm/account.py +++ b/src/lib389/lib389/idm/account.py @@ -105,7 +105,9 @@ class Account(DSLdapObject): spec_attr = self._dict_get_with_ignore_indexerror(config_settings, "specattrname") limit_attr = self._dict_get_with_ignore_indexerror(config_settings, "limitattrname") - cos_entries = CosTemplates(inst, self.dn) + mapping_trees = MappingTrees(inst) + root_suffix = mapping_trees.get_root_suffix_by_entry(self.dn) + cos_entries = CosTemplates(inst, root_suffix) accpol_entry_dn = "" for cos in cos_entries.list(): if cos.present(spec_attr): diff --git a/src/lib389/lib389/plugins.py b/src/lib389/lib389/plugins.py index c702a96..fb03736 100644 --- a/src/lib389/lib389/plugins.py +++ b/src/lib389/lib389/plugins.py @@ -1881,7 +1881,7 @@ class AccountPolicyEntry(DSLdapObject): """ def __init__(self, instance, dn=None): - super(AccountPolicyConfig, self).__init__(instance, dn) + super(AccountPolicyEntry, self).__init__(instance, dn) self._rdn_attribute = 'cn' self._must_attributes = ['cn'] self._create_objectclasses = ['top', 'accountpolicy']