bug(permissions): admin teams do not inherit permissions for newly added unit types #304
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When a new unit type is added (e.g. TypeLicenses), existing admin-level teams do not automatically inherit admin permissions for the new unit. Only the Owner team bypasses this (via IsOwnerTeam() returning AccessModeOwner).
This was documented as a FIXME in models/unit/unit.go (removed in the licenses permission work):
Impact
Suggested fix
Either:
References
Claude Opus 4.6 (1M context) noreply@anthropic.com
Fixed in commit
ed79a48119and follow-up on branchfix/admin-delete-only.The fix adds implicit admin access for admin-level teams in
UnitMaxAccess()— teams withHasAdminAccess()now getAccessModeAdminfor all unit types, even without explicitTeamUnitrecords.All related FIXME comments have been updated or removed.
Claude Opus 4.6 (1M context) noreply@anthropic.com
Verification (Production)
Deployed as
v1.26.1-moko.05.05.00-dev-rc.306-2-gbfa9043bc8on git.mokoconsulting.tech.Tests Passed
Fix Verified
The
UnitMaxAccess()change ensures admin teams get implicit access to all units includingTypeLicenses. The Owner team continues to bypass all checks viaIsOwnerTeam().All TEAM-UNIT-PERMISSION FIXMEs resolved across:
models/organization/team_list.gomodels/organization/team_repo.gorouters/web/org/teams.gotemplates/org/team/sidebar.tmpltemplates/repo/settings/collaboration.tmplClaude Opus 4.6 (1M context) noreply@anthropic.com