Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Member management refactor. #923

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

rjeffman
Copy link
Member

No description provided.

Member management in modules is similar in each module and involve a lot
of code duplication, for example, add/del list management. The problem
with this approach is that bugs, like idempotence bugs, may require
changes in several modules, when it is found that the similar idiom used
is flawed. Another issue is the need to duplicate the code, which can
lead to errors.

This patch proposes a method to centralize the creation of the IPA
commands for object members, provided the IPA API method names and a
mapping between IPA API parameter, module parameter and the LDAP
attributes of the object.

With this crentralized approach, fixes, optimizations, and code changes
can be made in a single place, without requiring every plugin to be
changed.
Several modules depend on parameters that require the same kind of data
transformation, and this transformation is usually reimplemented on each
module.

This patch proposes a different approach, where data transformation
functions are provided to be used by any module, or as arguments for
methods that process parameters, like the parameter mapping used by
gen_member_manage_commands.

The following transformation functions are provided:

* transform_lowercase: ensure strings are lowercase
* transform_hostmask: ensure hostmasks values are network CIDR.
* transform_host_fqdn: ensure hostnames are FQDN.
* transform_host_param: ensure host parameters are lowercase FQDN.
* transform_service_param: ensure services parameters are lowercase
  principals.
@rjeffman rjeffman changed the title WIP: Sudorule refactor WIP: Member management refactor. Feb 11, 2023
Change ipasudorule to use the global member management method.
Change ipasudocmdgroup to use the global member management method.
Change ipaservice to use the global member management method.
Change ipaservicedelegationtarget to use the global member management
method.
Change ipaservicedelegationrule to use the global member management
method.
Change iparole to use the global member management
method.

NOTE: This changes modify the behavior of the 'service' member, by not
preserving case.
Change ipagroup to use the global member management method.
Change ipahbacrule to use the global member management method.
Change ipahbacsvcgroup to use the global member management method.
The function servicedelegation_normalize_principals acn be used to
normalize principals, but would work only on list or tuples. With
this patch a simple string can be passed as the 'principal' argument
and will also be normalized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant