[PR #1239] Add login_enabled database field for user enable/disable functionality #1200

Open
opened 2026-02-27 09:11:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lldap/lldap/pull/1239
Author: @coolguy1771
Created: 8/7/2025
Status: 🔄 Open

Base: mainHead: feat/user-enable-disable-field


📝 Commits (4)

  • 17189a1 feat: add login_enabled database field users
  • 89ef5dc fix: streamline existing attribute check in migrate_to_v11 function
  • 875846b chore: run cargo fmt
  • d377dd4 Merge branch 'main' into feat/user-enable-disable-field

📊 Changes

5 files changed (+65 additions, -3 deletions)

View changed files

📝 crates/domain-model/src/model/users.rs (+3 -0)
📝 crates/ldap/src/core/user.rs (+2 -1)
📝 crates/sql-backend-handler/src/sql_migrations.rs (+58 -1)
📝 crates/sql-backend-handler/src/sql_tables.rs (+1 -1)
📝 crates/sql-backend-handler/src/sql_user_backend_handler.rs (+1 -0)

📄 Description

Summary

This PR introduces the database foundation for user enable/disable functionality by adding a login_enabled boolean field to the users table. This is the first in a series of PRs to implement the complete feature as discussed in #1193.

Changes

  • Database Migration: Added migration v11 to create the login_enabled column

    • Defaults to true for backward compatibility with existing users
    • Includes a check for conflicting custom attributes with a warning message
  • Model Updates:

    • Updated the User model to include the login_enabled field
    • Ensured new users are created with login_enabled: true by default

Migration Notes

  • The migration checks if a custom attribute named "login_enabled" already exists and warns users if found
  • Existing users will have login_enabled set to true by default, ensuring no disruption to current functionality
  • The field is a separate column (not a custom attribute) for better performance and type safety

Testing

  • Database migration runs successfully
  • Code compiles without errors
  • New users are created with login_enabled: true

Addresses part of #1193


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lldap/lldap/pull/1239 **Author:** [@coolguy1771](https://github.com/coolguy1771) **Created:** 8/7/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/user-enable-disable-field` --- ### 📝 Commits (4) - [`17189a1`](https://github.com/lldap/lldap/commit/17189a1c60a9e717fa5605da2de831e92a3051c7) feat: add login_enabled database field users - [`89ef5dc`](https://github.com/lldap/lldap/commit/89ef5dcea0eb048724786351d8ae172b177c98ca) fix: streamline existing attribute check in migrate_to_v11 function - [`875846b`](https://github.com/lldap/lldap/commit/875846be7dd1f8fcc628e92c1c3c3f94fcea6e97) chore: run cargo fmt - [`d377dd4`](https://github.com/lldap/lldap/commit/d377dd4f5093bd445b19c7886d0b353f376733f4) Merge branch 'main' into feat/user-enable-disable-field ### 📊 Changes **5 files changed** (+65 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/domain-model/src/model/users.rs` (+3 -0) 📝 `crates/ldap/src/core/user.rs` (+2 -1) 📝 `crates/sql-backend-handler/src/sql_migrations.rs` (+58 -1) 📝 `crates/sql-backend-handler/src/sql_tables.rs` (+1 -1) 📝 `crates/sql-backend-handler/src/sql_user_backend_handler.rs` (+1 -0) </details> ### 📄 Description ## Summary This PR introduces the database foundation for user enable/disable functionality by adding a `login_enabled` boolean field to the users table. This is the first in a series of PRs to implement the complete feature as discussed in #1193. ## Changes - **Database Migration**: Added migration v11 to create the `login_enabled` column - Defaults to `true` for backward compatibility with existing users - Includes a check for conflicting custom attributes with a warning message - **Model Updates**: - Updated the User model to include the `login_enabled` field - Ensured new users are created with `login_enabled: true` by default ## Migration Notes - The migration checks if a custom attribute named "login_enabled" already exists and warns users if found - Existing users will have `login_enabled` set to `true` by default, ensuring no disruption to current functionality - The field is a separate column (not a custom attribute) for better performance and type safety ## Testing - [x] Database migration runs successfully - [x] Code compiles without errors - [x] New users are created with `login_enabled: true` ## Related Issues Addresses part of #1193 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#1200
No description provided.