Skip to content

feature/casl-integration#85

Open
AlexandrNel wants to merge 4 commits into
devfrom
feature/casl-integration
Open

feature/casl-integration#85
AlexandrNel wants to merge 4 commits into
devfrom
feature/casl-integration

Conversation

@AlexandrNel

Copy link
Copy Markdown
Collaborator

Что сделано

  • Создан новый feature-слой features/ability с CASL-провайдером, стором, правилами и утилитами
  • Перенесена логика прав команды в features/ability/model/team.ability.ts
  • Добавлены права проектов (project.ability.ts): publish, archive, share, create, read, delete
  • Добавлены права для настроек команды (TeamSettings): update
  • Реализован AbilityProvider - единый провайдер способностей на уровне AppProviders
  • Реализован SyncAbilityStore - синхронизация пользователя, teamRole и projectRole в стор способностей
  • Компонент <Can> и хук useAbility для декларативной проверки прав
  • ProjectCard принимает проп permissions и скрывает кнопку действий, если нет прав
  • В sidebar, страницу проектов, участников и настроек команды добавлены проверки прав через useAbility и <Can>

Зачем

Централизовать и унифицировать управление правами доступа через CASL вместо разрозненных проверок. Убрать дублирование логики (ранее ability жила в entities/team и пересоздавалась вручную в каждом компоненте). Теперь права определяются в одном месте и автоматически обновляются при смене пользователя или роли.

Проверка

  • pnpm lint
  • pnpm typecheck
  • у пользователя с ролью member и viewer нет доступа к созданию и обновлению проектов, настроек команды и управлению участниками
  • у admin есть права на управление member/viewer, но нет прав на owner
  • у owner есть полный доступ ко всем действиям
  • пользователь не может удалить/изменить роль самому себе

@AlexandrNel AlexandrNel requested a review from kapitulin24 as a code owner June 26, 2026 16:15
@github-actions github-actions Bot added core-logic Global providers, api instances and core shared libs features User scenarios and sliced features views Pages, widgets and layouts config labels Jun 26, 2026
…t logic

- store: simplified storage fields, rename types
- stable reference for `ability` has been implemented;
- new rules for the existing `ability` instance are now created within `useEffect` based on the new user.
@AlexandrNel AlexandrNel force-pushed the feature/casl-integration branch from 4335379 to e11e111 Compare June 26, 2026 19:38
@github-actions github-actions Bot added dependencies Dependency updates (package.json, pnpm-lock) and removed config labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-logic Global providers, api instances and core shared libs dependencies Dependency updates (package.json, pnpm-lock) features User scenarios and sliced features views Pages, widgets and layouts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant