This commit is contained in:
2026-10-10 13:29:57 +07:00
parent e8b5826c5b
commit ad6c17d30e
9 changed files with 109 additions and 79 deletions
+9 -3
View File
@@ -32,11 +32,17 @@ var (
)
// UIService provides user interface permissions.
type UIService struct{}
type UIService struct {
Environment string
}
// NewUIService creates a UI service.
func NewUIService() *UIService {
return &UIService{}
func NewUIService(venueMode bool) *UIService {
environment := "prod"
if venueMode {
environment = "venue"
}
return &UIService{Environment: environment}
}
// GetPermissions returns permissions for the supplied roles.
+1 -1
View File
@@ -13,7 +13,7 @@ func TestTasksPermission(t *testing.T) {
{"developer", true}, {"admin", true}, {"user", false}, {"author", false}, {"organizer", false},
} {
t.Run(tc.role, func(t *testing.T) {
got := NewUIService().GetPermissions([]string{tc.role})
got := NewUIService(false).GetPermissions([]string{tc.role})
if slices.Contains(got, "tasks_page") != tc.allowed {
t.Fatalf("permissions=%v", got)
}