Skip to content

Add ability to disable/enable users#46

Merged
avborup merged 4 commits into
mainfrom
feature/disable-user-auth
Oct 7, 2025
Merged

Add ability to disable/enable users#46
avborup merged 4 commits into
mainfrom
feature/disable-user-auth

Conversation

@avborup

@avborup avborup commented Oct 3, 2025

Copy link
Copy Markdown
Owner

Adds support for disabling and enabling user accounts via the disabled() method on UpdateUserValues.

Summary by CodeRabbit

  • New Features

    • You can now disable or re-enable a user account as part of an update, via an optional flag while remaining backward compatible.
  • Documentation

    • Added a step-by-step example demonstrating disabling a user, verifying the disabled state, then re-enabling and verifying again.
  • Chores

    • CI updated to install formatting tooling before running checks, linting, and tests.

@coderabbitai

coderabbitai Bot commented Oct 3, 2025

Copy link
Copy Markdown

Walkthrough

Adds a disabled flag to update-user models and builder, wires it into the outgoing request body, extends docs with an example showing disabling/re-enabling a user, and adds rustfmt installation steps to multiple CI jobs. No changes to public function signatures or control flow beyond the new fields/method.

Changes

Cohort / File(s) Summary
Auth docs/example
src/auth/mod.rs
Extended doc comment: example demonstrating disable/enable via UpdateUserValues::new().disabled(true) and .disabled(false). No runtime or API changes.
Update user models
src/auth/models/update_user.rs
Added disabled: Option<bool> to UpdateUserValues with builder pub fn disabled(mut self, disabled: bool) -> Self. Added disable_user: Option<bool> to UpdateUserBody<'a> (serde skip_none) and mapped disable_user: values.disabled in UpdateUserBody::from_values.
CI workflow
.github/workflows/ci.yml
Added rustup component add rustfmt install steps before cargo commands across CI jobs (check, clippy, tests), ensuring rustfmt is available in each job.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant AuthAPI as Auth API
  participant Model as UpdateUserBody
  participant Provider as Auth Provider

  Client->>AuthAPI: update_user(uid, UpdateUserValues{ disabled: Some(true/false), ... })
  AuthAPI->>Model: from_values(values)
  Note right of Model #dfe7ff: include `disable_user` when `Some(...)`
  Model->>Provider: PATCH /users:uid { disable_user: true/false, ... }
  Provider-->>AuthAPI: 200 OK (user updated)
  AuthAPI-->>Client: Result<User>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Possibly related PRs

  • Filify-app/fireplace#43: Introduced the original UpdateUserValues/UpdateUserBody and update flow extended here with the disabled flag.

Suggested labels

enhancement

Suggested reviewers

  • JoachimBorup

Poem

Flip the flag and hush or hum,
Builder toggles, change will come.
Models carry the on/off cue,
Docs show how to use it too.
CI adds tools — format and run.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title nails the main change by stating that users can now be disabled or enabled and directly matches the PR’s objective. It’s concise and clear so teammates scanning the history know at a glance what this PR does.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/disable-user-auth

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae57017 and 78f7437.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (3 hunks)

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

@avborup avborup added the Auth label Oct 3, 2025
@avborup avborup self-assigned this Oct 3, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f381fc6 and b915a12.

📒 Files selected for processing (2)
  • src/auth/mod.rs (1 hunks)
  • src/auth/models/update_user.rs (4 hunks)
🔇 Additional comments (2)
src/auth/models/update_user.rs (2)

9-9: Adding disabled: Option<bool> to values is spot on

Matches the API semantics (unset = no-op; true = disable; false = enable). No issues.


75-80: Correct mapping from values to body

Passing through values.disabled to disable_user is correct.

Comment thread src/auth/mod.rs
Comment thread src/auth/models/update_user.rs
Comment thread src/auth/models/update_user.rs
@avborup
avborup force-pushed the feature/disable-user-auth branch from ae57017 to 78f7437 Compare October 3, 2025 13:17
@avborup
avborup merged commit 6cfd673 into main Oct 7, 2025
5 checks passed
@avborup
avborup deleted the feature/disable-user-auth branch October 7, 2025 08:10
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