authd icon indicating copy to clipboard operation
authd copied to clipboard

Add `authctl user set-uid` command

Open adombeck opened this issue 2 months ago • 2 comments

Support setting the UID of a user via authctl user set-uid <user> <uid>.

Also changes the owner and group of the user's home directory and all files in the home directory from the old UID and GID to the new UID and GID (if it is owned by the current user), same as usermod does when changing the UID of a user.

Closes #630 UDENG-7717

adombeck avatar Sep 24 '25 09:09 adombeck

Codecov Report

:x: Patch coverage is 51.12782% with 130 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 86.35%. Comparing base (6f434b2) to head (0a9e98b).

Files with missing lines Patch % Lines
internal/users/manager.go 56.07% 47 Missing :warning:
internal/users/db/update.go 69.87% 25 Missing :warning:
internal/fileutils/fileutils.go 0.00% 18 Missing :warning:
cmd/authctl/group/set-gid.go 0.00% 16 Missing :warning:
cmd/authctl/user/set-uid.go 0.00% 16 Missing :warning:
internal/services/user/user.go 70.00% 6 Missing :warning:
cmd/authctl/group/group.go 50.00% 1 Missing :warning:
internal/services/permissions.go 50.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1087      +/-   ##
==========================================
- Coverage   87.82%   86.35%   -1.47%     
==========================================
  Files          89       92       +3     
  Lines        6150     6406     +256     
  Branches      111      111              
==========================================
+ Hits         5401     5532     +131     
- Misses        693      818     +125     
  Partials       56       56              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Sep 24 '25 12:09 codecov-commenter

@3v1n0 @denisonbarbosa The PR is still missing tests, but I would appreciate a first review nonetheless, especially regarding the decision to automatically change the owner of the home directory (see e68fd5380d7541ccbc3f71c8e6dc338b31fdd1c1) before I spend time adding tests for that.

adombeck avatar Nov 12 '25 10:11 adombeck

Will add the missing tests and also update TestChownRecursiveFrom to use bubblewrap :)

Done and I also added authctl group set-gid. Should be ready for another round of review.

adombeck avatar Dec 02 '25 16:12 adombeck