-
Notifications
You must be signed in to change notification settings - Fork 0
Add: AttributeType ldap_display_name #974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rimu-stack
merged 6 commits into
feature/1258_ldap_schema_move_from_models_to_directories
from
feature/subtask_1258_add_ldap_display_name
Apr 2, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8118a1d
add: AttributeType ldap_display_name subtask_1258
milov-dmitriy ef69b11
fix: ruff subtask_1258
milov-dmitriy 0186767
fix: copilot commets subtask_1258
milov-dmitriy d58e37e
fix: ldap search request for attribute types subtask_1258
milov-dmitriy 4d6e6e5
fix: temporary replace name to ldap_display_name subtask_1258
milov-dmitriy a5765ce
Add: Denormalization: delete ace attributeTypeId, add attribute_type_…
milov-dmitriy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
app/alembic/versions/1b71cafba681_replace_attributeTypeId.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| """Delete attributeTypeId add attribute_type_name from AccessControlEntries. | ||
|
|
||
| Revision ID: 1b71cafba681 | ||
| Revises: 708b01eaf025 | ||
| Create Date: 2026-03-24 16:28:49.116712 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from dishka import AsyncContainer, Scope | ||
| from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession | ||
|
|
||
| from ldap_protocol.roles.migrations_ace_dao import ( | ||
| AccessControlEntryDirectoryMappingDAO, | ||
| ) | ||
| from ldap_protocol.utils.queries import get_base_directories | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: None | str = "1b71cafba681" | ||
| down_revision: None | str = "708b01eaf025" | ||
| branch_labels: None | list[str] = None | ||
| depends_on: None | list[str] = None | ||
|
|
||
|
|
||
| def upgrade(container: AsyncContainer) -> None: | ||
| """Upgrade.""" | ||
|
|
||
| async def _map_ace_to_directory_name(connection: AsyncConnection) -> None: # noqa: ARG001 | ||
| async with container(scope=Scope.REQUEST) as cnt: | ||
| session = await cnt.get(AsyncSession) | ||
| ace_dao = await cnt.get(AccessControlEntryDirectoryMappingDAO) | ||
|
|
||
| if not await get_base_directories(session): | ||
| return | ||
|
|
||
| await ace_dao.upgrade() | ||
| await session.commit() | ||
|
|
||
| op.add_column( | ||
| "AccessControlEntries", | ||
| sa.Column("attribute_type_name", sa.String(), nullable=True), | ||
| ) | ||
|
|
||
| op.run_async(_map_ace_to_directory_name) | ||
|
|
||
| op.drop_index( | ||
| op.f("idx_ace_attribute_type_id"), | ||
| table_name="AccessControlEntries", | ||
| postgresql_using="hash", | ||
| ) | ||
| op.drop_constraint( | ||
| op.f("AccessControlEntries_directoryAttributeTypeId_fkey"), | ||
| "AccessControlEntries", | ||
| type_="foreignkey", | ||
| ) | ||
| op.drop_column("AccessControlEntries", "attributeTypeId") | ||
|
|
||
|
|
||
| def downgrade(container: AsyncContainer) -> None: | ||
| """Downgrade.""" | ||
|
|
||
| async def _map_ace_to_directory_id(connection: AsyncConnection) -> None: # noqa: ARG001 | ||
| async with container(scope=Scope.REQUEST) as cnt: | ||
| session = await cnt.get(AsyncSession) | ||
| ace_dao = await cnt.get(AccessControlEntryDirectoryMappingDAO) | ||
|
|
||
| if not await get_base_directories(session): | ||
| return | ||
|
|
||
| await ace_dao.downgrade() | ||
| await session.commit() | ||
|
|
||
| op.add_column( | ||
| "AccessControlEntries", | ||
| sa.Column( | ||
| "attributeTypeId", | ||
| sa.INTEGER(), | ||
| autoincrement=False, | ||
| nullable=True, | ||
| ), | ||
| ) | ||
|
|
||
| op.run_async(_map_ace_to_directory_id) | ||
|
|
||
| op.create_foreign_key( | ||
| op.f("AccessControlEntries_directoryAttributeTypeId_fkey"), | ||
| "AccessControlEntries", | ||
| "Directory", | ||
| ["attributeTypeId"], | ||
| ["id"], | ||
| ondelete="CASCADE", | ||
| ) | ||
| op.create_index( | ||
| op.f("idx_ace_attribute_type_id"), | ||
| "AccessControlEntries", | ||
| ["attributeTypeId"], | ||
| unique=False, | ||
| postgresql_using="hash", | ||
| ) | ||
| op.drop_column("AccessControlEntries", "attribute_type_name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.