Skip to content

feat(squads): SquadPolicy — captain/sub-captain or super-admin authorization#453

Open
Re-Gouveia-QA wants to merge 1 commit into
feat/squadsfrom
feat/squad-action-authorization
Open

feat(squads): SquadPolicy — captain/sub-captain or super-admin authorization#453
Re-Gouveia-QA wants to merge 1 commit into
feat/squadsfrom
feat/squad-action-authorization

Conversation

@Re-Gouveia-QA

Copy link
Copy Markdown

Materializa o design de Policies/SquadPolicy já descrito em CONTEXT.md.

  • canManage(User $actor, Squad $squad): bool — verdadeiro para super-admins incondicionalmente; caso contrário, apenas para um Captain/SubCaptain ativo do squad alvo.
  • authorize(User $actor, Squad $squad): void — lança AuthorizationException, seguindo o padrão throw_unless já utilizado em CreateSquad/ManageSquadStatus.

Fora do escopo (conforme o plano): ações concretas que irão consumir esta policy (PromoteToSubCaptain, DecideApplication, MarkExMember, AssignCaptain, ReallocateLeader) — ainda não implementadas neste módulo.

Plano de testes

  • SquadPolicyTest.php — 5 cenários (captain do próprio/outro squad, super-admin, sub-captain, membro comum), 5/5 verdes
  • Suite completa de app-modules/squads — 27/27 verdes
  • Pint limpo nos arquivos modificados

Closes #357

…ization

Materializes the Policies/SquadPolicy design already noted in CONTEXT.md:
canManage() authorizes super-admins unconditionally, otherwise only an
active Captain/SubCaptain of the target squad; authorize() throws
AuthorizationException, matching the throw_unless pattern already used
in CreateSquad/ManageSquadStatus.
@Re-Gouveia-QA
Re-Gouveia-QA requested a review from a team July 25, 2026 15:20

@davicbtoliveira davicbtoliveira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@YuriSouzaDev YuriSouzaDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@arthurbazzz arthurbazzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@stherzada stherzada added this to the Squads milestone Jul 26, 2026
@stherzada stherzada linked an issue Jul 26, 2026 that may be closed by this pull request
4 tasks
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.

feat(squads): SquadPolicy (capitão/sub do squad vs super-admin)

6 participants