Skip to content

Проверять permissions в UseCase и удалить клеймы секций - #74

Merged
PANiXiDA merged 11 commits into
developmentfrom
feature/permission-driven-access
Oct 20, 2026
Merged

PANiXiDA merged 11 commits into
developmentfrom
feature/permission-driven-access

Conversation

@PANiXiDA

@PANiXiDA PANiXiDA commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Что изменено и зачем

  • Удалены каталог секций, /api/v1/claims/sections и Common/Authentication/Sections. Модули остаются группировкой permissions: moduleCode/moduleDisplayName.
  • Иерархия прав: Permissions.Identity.Roles/Users и Permissions.Compendium.Factions/Heroes/Units. Строковые коды всех 20 permissions сохранены.
  • Административные UseCase требуют соответствующие permissions. Выбор фракций, список ролей и статусы пользователей требуют read.
  • Пользователям и ролям назначаются только permission из каталога. Миграция RemoveNonPermissionClaims удаляет все остальные типы клеймов у пользователей и ролей; исторические миграции сохранены.
  • /connect/authorize проверяет доступность пользователя отдельным query: загружает UserReadDbModel без ролей и клеймов и вызывает EnsureAvailable(UserReadDbModel).
  • /connect/token загружает актуальные пользовательские и ролевые клеймы. Permissions включены в ID token для UI.
  • Проверки доступа находятся в тестах соответствующих эндпоинтов. Отдельные PermissionAuthorizationTests удалены; замечания Roslyn по тестовым коллекциям исправлены.

Frontend: tactical-heroes/admin#58.
Удаление константы Section из библиотеки: panixida-dotnet-core/application#23.

Как проверить локально

Нужен Docker. Проверка обновлённой миграции:

dotnet build tests/Identity/PANiXiDA.TacticalHeroes.Identity.IntegrationTests/PANiXiDA.TacticalHeroes.Identity.IntegrationTests.csproj -c Release --no-restore
dotnet test --project tests/Identity/PANiXiDA.TacticalHeroes.Identity.IntegrationTests/PANiXiDA.TacticalHeroes.Identity.IntegrationTests.csproj -c Release --no-build --no-restore --filter-class '*RemoveNonPermissionClaimsTests'

Последнее изменение: сборки IntegrationTests и FunctionalTests без предупреждений и ошибок; проверка миграции на PostgreSQL и 4 HTTP-теста GetPermissions прошли. Проверено форматирование. Миграция повторно выполняется в тесте: permissions, включая смешанный регистр/пробелы в типе и значения вне каталога, сохраняются; section, custom и пустые типы удаляются.

Полный CI на предыдущем коммите 241c3e3 прошёл, включая Sonar без новых замечаний. На последнем изменении полный набор локально повторно не запускался.

Совместимость

  • Миграция данных удаляет все клеймы пользователей и ролей, кроме типа permission; откат не восстанавливает удалённые назначения. Миграция переименована из RemoveSectionClaims в RemoveNonPermissionClaims.
  • Breaking changes: удалён endpoint секций; sectionCode заменён метаданными модуля; административные операции требуют permissions; произвольные типы назначаемых клеймов не поддерживаются.
  • Новых настроек нет. Сначала обновить API и применить миграцию, затем frontend и войти заново.
  • API собирается с текущим Application 5.1.1; публикация удаления константы Section не блокирует этот PR.
  • tactical-heroes-service используется для introspection; собственные бизнес-права и ApiPermissions ему пока не добавляются.
  • Отзыв токенов при изменении прав — отдельный issue Design token revocation after authorization changes #73, вне этого PR.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T11:55:57.500188Z 455870d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31d3dc8d5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@PANiXiDA

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 241c3e3064

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@panixida-sonarqube

Copy link
Copy Markdown

@PANiXiDA

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 455870d273

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@PANiXiDA
PANiXiDA merged commit 0d876f5 into development Oct 20, 2026
47 checks passed
@PANiXiDA
PANiXiDA deleted the feature/permission-driven-access branch October 20, 2026 11:56
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