Skip to content

Update objectsid logic 1051#944

Open
Misha-Shvets wants to merge 37 commits intodevfrom
update_objectsid_logic_1051
Open

Update objectsid logic 1051#944
Misha-Shvets wants to merge 37 commits intodevfrom
update_objectsid_logic_1051

Conversation

@Misha-Shvets
Copy link
Copy Markdown
Collaborator

@Misha-Shvets Misha-Shvets commented Feb 26, 2026

Задача: https://tracker.yandex.ru/MULTIDIRECTORY-1051
Добавлено:

  • Миграция по переносу object_sid из Directory в Attributes
  • object_sid UseCase\Gateway - формирования сида
  • RIDManager UseCase\Gateway - формирует локальные пулы для RidSet из общего и определение нужного DC
  • RIDSet UseCase\Gateway - выдача NextRid из локального пула и обновление пула через RIDManager
  • setup этой всей балалайки

Изменено:

  • Разделил логику создания базового домена
  • Логика формирования objectSid
  • Формирование sid префикса(в зависимости от ситемных\кастомных записей)
  • Вынес из Кербероса создание каталога System(теперь создается по умолчанию)

Есть 2 варианта формирования object_sid:

  1. RID задан(системный sid, для сущностей domain admins, domain users и подобные) их диапазон ридов от 500 до 1100 и они не запрашиваются у DC.
    Формат objectSid sid_prefix-rid

  2. RID запрашивается у DC, диапозон от 1100 и до 1млрд.
    Формат objectSid sid_prefix-domain_identifier-rid

Как работает:

  1. Тут особо логики нет, просто кладем в бд objectSid с заданым RID, минуя DC RIDSet RIDManager. ObjectSIDUseCase.add --> ObjectSIDGateway.add
    app/ldap_protocol/rid_manager/object_sid_use_case.py
    app/ldap_protocol/rid_manager/object_sid_gateway.py

  2. Берем DC домена, по нему получаем его RIDSet. У полученного RIDSet запрашиваем RID.
    ObjectSIDUseCase.add --> RIDManagerUseCase.get_domain_controller --> RIDSetUseCase.allocate_next_rid(domain_controller)
    app/ldap_protocol/rid_manager/object_sid_use_case.py
    app/ldap_protocol/rid_manager/rid_manager_use_case.py
    app/ldap_protocol/rid_manager/rid_set_use_case.py

2.1 Проверяем может ли локальный пул(rIDPreviousAllocationPool) у RIDSet выдать RID. Если да - выдаем RID(rIDNextRID +1), если нет - текущий пул(rIDPreviousAllocationPool) заменяем значением следующего забронированного пула(rIDAllocationPool) и запрашиваем у RIDManager новый следущий пул(rIDAllocationPool), так же меняем rIDNextRID по нижней границе этого пула, после выдаем RID
В АД следущий пул запрашивается при 50% заполнености текущего, технически, делается тоже самое
RIDSetUseCase.is_pool_exceeded -->RIDSetGateway.get_rid_next_rid --> RIDSetGateway.update_next_rid_and_pool
| ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀🠝
🠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀|
RIDManagerUseCase.allocate_pool -> RIDSetUseCase.reset_attrs_when_pool_exceeded

@Misha-Shvets Misha-Shvets force-pushed the update_objectsid_logic_1051 branch from 57d28c6 to 39db0bf Compare February 26, 2026 15:40
@Misha-Shvets Misha-Shvets requested a review from Naksen February 27, 2026 14:20
Copy link
Copy Markdown
Collaborator

@Naksen Naksen left a comment

Choose a reason for hiding this comment

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

Опиши подробно механизмы:

  1. Выдачи нового RID
  2. Как глобальный пул делится на локальные пулы для каждого RID Set
  3. Как происходит обновление локального пула

@Misha-Shvets Misha-Shvets force-pushed the update_objectsid_logic_1051 branch from 296058c to 58726a2 Compare March 6, 2026 07:35
@Misha-Shvets Misha-Shvets force-pushed the update_objectsid_logic_1051 branch from bd76e79 to 4f6e9c7 Compare March 30, 2026 10:00
m.shvets added 21 commits April 7, 2026 10:54
…jectSIDGateway to raise it when SID is not found
…or consistency with production environment
m.shvets added 2 commits April 7, 2026 11:12
…nstead of objects for improved consistency and performance
@Misha-Shvets Misha-Shvets force-pushed the update_objectsid_logic_1051 branch from c2111d9 to f35eee2 Compare April 7, 2026 08:12
m.shvets added 3 commits April 7, 2026 11:43
…ses to improve code organization and maintainability
…nd clean up unused methods in directory_create_use_case and directory_dao for improved clarity and maintainability
…irectory creation, improving clarity and maintainability
@Misha-Shvets
Copy link
Copy Markdown
Collaborator Author

сделал подгрузку атрибутов в
_get_dir_query
get_group
get_groups

…g by introducing caching and updating method signatures for improved clarity and performance
@Misha-Shvets Misha-Shvets requested a review from Naksen April 9, 2026 12:08
m.shvets added 7 commits April 9, 2026 15:15
… improved configuration management in tests
…before object SID assignment for improved domain controller setup
…y using or_ for improved readability and maintainability
…format existing identifiers and assign built-in SIDs for domain groups, improving data integrity and consistency
m.shvets added 2 commits April 10, 2026 13:57
…election and improve object SID handling by skipping entries with null parent IDs, ensuring better data integrity for domain groups.
…yRequest and add utility function to verify group inclusion by primary RID, improving group management logic.
@Misha-Shvets Misha-Shvets requested a review from Naksen April 10, 2026 11:55
…IDs during object SID migration, ensuring proper handling of top-level containers and configuration subtrees. Update upgrade function to add DomainIdentifier attribute and normalize object SID handling for domain directories.
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.

2 participants