permissions data seed fix

This commit is contained in:
Yared Yemane 2026-04-14 00:39:42 -07:00
parent f256ee179a
commit 69d3d440d0

View File

@ -30,9 +30,10 @@ func NewService(store ports.RBACStore, logger *slog.Logger) *Service {
} }
// HasPermission checks if a role has a specific permission key. // HasPermission checks if a role has a specific permission key.
// SUPER_ADMIN always returns true. // SUPER_ADMIN and ADMIN always return true to keep admin panel
// access resilient even when RBAC seed data is partially missing.
func (s *Service) HasPermission(roleName, permKey string) bool { func (s *Service) HasPermission(roleName, permKey string) bool {
if roleName == string(domain.RoleSuperAdmin) { if roleName == string(domain.RoleSuperAdmin) || roleName == string(domain.RoleAdmin) {
return true return true
} }
snap := s.cache.Load().(*snapshot) snap := s.cache.Load().(*snapshot)