generated from VLADIMIR/template
up
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user