Skip to content

Add: clear user password history#874

Merged
rimu-stack merged 8 commits into
devfrom
add_user_password_history_reset_task_523
Jan 14, 2026
Merged

Add: clear user password history#874
rimu-stack merged 8 commits into
devfrom
add_user_password_history_reset_task_523

Conversation

@milov-dmitriy
Copy link
Copy Markdown
Collaborator

Добавить ручку для очистки истории паролей пользователя. Ручка должна быть доступна только админам.
Допом исправил баг, когда история пользовательских паролей не наполнялась.

Задача: 523

@milov-dmitriy milov-dmitriy self-assigned this Dec 23, 2025
@milov-dmitriy milov-dmitriy added the python Pull requests that update Python code label Dec 23, 2025
@milov-dmitriy milov-dmitriy changed the title Add: reset user pwd history task_523 Add: clear user password history Dec 23, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an endpoint for clearing user password history, accessible only to administrators, as part of task 523. Additionally, it fixes a bug where user password history was not being populated correctly.

Key changes:

  • New /user/password_history/clear/{user_name} endpoint with admin-only access
  • Bug fix: Added attributes.flag_modified() call to ensure password history updates are persisted
  • New USER_CLEAR_PASSWORD_HISTORY authorization rule added to Domain Admins role

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/api/password_policy/user_password_history_router.py Implements new router with clear endpoint for password history
app/api/password_policy/adapter.py Adds UserPasswordHistoryResetFastAPIAdapter for the new endpoint
app/ldap_protocol/policies/password/use_cases.py Implements UserPasswordHistoryUseCases with clear method and permissions
app/ldap_protocol/policies/password/dao.py Fixes password history bug by adding flag_modified call
app/enums.py Adds USER_CLEAR_PASSWORD_HISTORY authorization rule
app/alembic/versions/a99f866a7e3a_add_user_pwd_reset_permission.py Database migration to grant new permission to Domain Admins
app/ioc.py Registers new use cases and adapter in dependency injection container
app/multidirectory.py Includes new router in the application
app/api/password_policy/__init__.py Exports new router
app/api/__init__.py Exports new router
tests/test_api/test_password_policy/test_user_password_history_router.py Tests for the new clear endpoint
tests/test_api/test_password_policy/conftest.py Test fixtures for the new use cases
interface Subproject commit update

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/api/password_policy/adapter.py
@Naksen Naksen self-requested a review January 13, 2026 13:09
Comment thread app/alembic/versions/a99f866a7e3a_add_user_pwd_reset_permission.py Outdated
Comment thread app/alembic/versions/a99f866a7e3a_add_user_pwd_reset_permission.py Outdated
Comment thread app/alembic/versions/a99f866a7e3a_add_user_pwd_reset_permission.py Outdated
Comment thread app/alembic/versions/a99f866a7e3a_add_user_pwd_reset_permission.py Outdated
Comment thread app/api/password_policy/user_password_history_router.py
Comment thread app/api/password_policy/user_password_history_router.py Outdated
Comment thread app/ldap_protocol/policies/password/use_cases.py Outdated
Comment thread app/api/password_policy/user_password_history_router.py Outdated
@rimu-stack rimu-stack merged commit d7f4702 into dev Jan 14, 2026
6 checks passed
@rimu-stack rimu-stack deleted the add_user_password_history_reset_task_523 branch January 14, 2026 14:00
rimu-stack added a commit that referenced this pull request Jan 28, 2026
* Add: directory attributes value validations (#857)

* Add: addRequest validate `new_name` (#862)

* fix: update push branch from main to dev in build workflow (#866)

* Http codes with map 774 (#836)

* Added dishka container to migrations (#868)

* Refactor: integrate NetworkPolicyGateway into LDAP session management (#863)

* Add default admin name 1111 (#872)

* Refactor syslog-ng configuration and enhance SyslogSender class (#871)

* Refactor: git checks (#869)

* Add: global LDAP server (#875)

* Fix: global ldap server (#877)

* Rework dependencies initialization in migrations (#880)

* add: UDP port mapping for LDAP service in docker-compose.yml (#882)

* Refactor ldap server (#867)

* Add: clear user password history (#874)

* Fix migration 275222846605 (#881)

* Add KRBAPIConnectionError handling to error map in krb5_router.py (#885)

* Add: directory is_system (#884)

* add: handling KRBAPIConnectionError in KerberosService exceptions (#886)

* Refactor: merge enterprise tests (#887)

* add: enqueue param for loguru (#888)

* Add: tmpfs and volume prune and kadmin_api depends on kdc (#891)

* New CI (#890)

* add: Contact entity type  (#896)

* refactor: rename services to System (#883)

* Hotfix262 (#898)

* Fix: user addRequest: recreate principal if exists already (#897)

* Enhance AddRequest: suppress KRBAPIPrincipalNotFoundError during principal deletion (#902)

* Refactor: cosmetic (#900)

* Add: Global Catalog logger (#892)

* Refactor: ModifyRequest (#893)

* Fix: Correct path assignment in _update_descendants function (#904)

* refactor: fix paths kadmin_api entrypoint (#903)

* add: rename services (#905)

* fix: replace services with system (#906)

---------

Co-authored-by: Milov Dmitriy <milovdd@mail.ru>
Co-authored-by: Ruslan <khannanov.rus@gmail.com>
Co-authored-by: Misha-Shvets <76677350+Misha-Shvets@users.noreply.github.com>
Co-authored-by: Михаил Михайлов <90135860+TheMihMih@users.noreply.github.com>
Naksen pushed a commit that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants