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

[Backport][ipa-4-8] user-stage: transfer all attributes from preserved to stage user #3478

Closed
wants to merge 2 commits into from

Conversation

abbra
Copy link
Contributor

@abbra abbra commented Jul 31, 2019

This PR was opened automatically because PR #3448 was pushed to master and backport to ipa-4-8 is required.

The user-stage command is internally implemented as:
- user_show(all=True) in order to read the user attributes
- loop on the attributes defined as possible to add using stageuser-add and
transform them into new options for stageuser_add (for instance stageuser-add
provides the option --shell for the attribute loginshell, but there is no
option for the attribute businesscategory).
- call stageuser_add in order to create a new entry in the active users subtree
- user-del to remove the previous entry in the staged users subtree

The issue is in the 2nd step. Only the attributes with a stageuser-add option
are processed.
The logic of the code should be slightly modified, so that all the attributes
read in the first step are processed:
- if they correspond to an option of stageuser-add, process them like it's
currently done. For instance if the entry contains displayname, then it
should be processed as --displayName=value in the stageuser-add cmd
- if they do not correspond to an option of stageuser-add, add them with
--setattr=<attrname>=<attrvalue>

Note that some attributes may need to be filtered, for instance user-show
returns has_password or has_keytab, which do not correspond to attributes
in the LDAP entry.

Fixes: https://pagure.io/freeipa/issue/7597
When moving a preserved user to the stage area, check that the
custom attributes are not lost ( = the attr for which there is
no specific user_stage option).

Test scenario:
- add a stage user with --setattr "businesscategory=value"
- activate the user, check that businesscategory is still present
- delete (preserve) the user, check that attr is still present
- stage the user, check that attr is still present

Related: https://pagure.io/freeipa/issue/7597
@abbra abbra added the ack Pull Request approved, can be merged label Jul 31, 2019
@abbra
Copy link
Contributor Author

abbra commented Jul 31, 2019

PR was ACKed automatically because this is backport of PR #3448. Wait for CI to finish before pushing. In case of questions or problems contact @flo-renaud who is author of the original PR.

@abbra abbra added the re-run Trigger a new run of PR-CI label Jul 31, 2019
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Jul 31, 2019
@abbra
Copy link
Contributor Author

abbra commented Jul 31, 2019

ipa-4-8:

  • 317787b user-stage: transfer all attributes from preserved to stage user
  • 17b97ae xmlrpc test: add test for preserved > stage user

@abbra abbra added the pushed Pull Request has already been pushed label Jul 31, 2019
@abbra abbra closed this Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
3 participants