Skip to content

feat: add user set-password, remove-role and roles commands - #31

Merged
NathaelB merged 3 commits into
mainfrom
feature/user-password-role-management
Sep 2, 2026
Merged

feat: add user set-password, remove-role and roles commands#31
NathaelB merged 3 commits into
mainfrom
feature/user-password-role-management

Conversation

@NathaelB

@NathaelB NathaelB commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • user set-password <username> [--temporary] (--password <value> | --stdin) — set a user's password. --stdin is the way to avoid leaking the password into shell history / the process list; --password is kept for scripts that accept that trade-off. Exactly one of the two is required.
  • user remove-role <username> <role> — remove a realm role from a user (mirrors the already-shipped assign-role).
  • user roles <username> — list a user's realm roles.
  • New client methods: set_user_password (PUT realms/{realm}/users/{id}/reset-password), remove_user_role (DELETE realms/{realm}/users/{id}/roles/{role_id}, mirroring the existing assign_user_role POST), list_user_roles (GET realms/{realm}/users/{id}/roles).

Issue

Refs #23 — not closing it: --client <client_id> on assign-role/remove-role (assigning a client role to a user) is still missing. I didn't want to guess that endpoint's shape (likely a doubly-nested path under both the user and the client) without a way to verify it against a running server. Left for a follow-up.

Verification

Verified live against a local FerrisKey server: created a throwaway user, ran roles (empty), assign-role + roles (shows it), remove-role + roles (empty again), set-password with --password, --temporary, and --stdin, then deleted the test fixtures. Caught and fixed one wrong assumption this way: set_user_password originally guessed PUT .../users/{id}/password (404) — the real endpoint is PUT .../users/{id}/reset-password, found via the Allow header on a 405. remove_user_role/list_user_roles worked first try, mirroring the already-correct assign_user_role/list_realm_roles shapes.

Test plan

  • cargo build --workspace
  • cargo test --workspace (66 passed, +6 new: password-source resolution)
  • cargo clippy --workspace --all-targets --all-features -- -D warnings (matches CI, no issues)
  • Manual full lifecycle test against a running FerrisKey server (see above)

@NathaelB NathaelB self-assigned this Sep 2, 2026
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 42627d6f-b9cd-4a80-902c-18cc8337792d

📥 Commits

Reviewing files that changed from the base of the PR and between 15eaaae and 0a19464.

📒 Files selected for processing (4)
  • libs/ferriskey-cli-client/src/lib.rs
  • libs/ferriskey-cli-commands/src/lib.rs
  • libs/ferriskey-cli-commands/src/user.rs
  • libs/ferriskey-cli-core/src/user.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ver)

set_user_password guessed PUT realms/{realm}/users/{id}/password
(404). The real endpoint is PUT realms/{realm}/users/{id}/reset-password
- found via the 405 Allow header while probing against a running
FerrisKey server.
@NathaelB
NathaelB force-pushed the feature/user-password-role-management branch from 2cc8b33 to 0290c06 Compare September 2, 2026 22:20
GitHub's branch-update rebase of this PR onto main (post-#32) replayed
this branch's additive commit without semantic conflict: the new
remove-role/roles/set-password functions still called the now-removed
authenticate(context, realm) helper instead of #32's auth_client(context).
@NathaelB
NathaelB merged commit e5ab54c into main Sep 2, 2026
4 checks passed
@NathaelB
NathaelB deleted the feature/user-password-role-management branch September 2, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant