This commit is contained in:
2026-10-03 13:07:50 +07:00
parent 7a7808b4d1
commit 3aeaa09ea8
14 changed files with 98 additions and 28 deletions
+8 -5
View File
@@ -28,13 +28,16 @@ var (
}
)
type UiService struct{}
// UIService provides user interface permissions.
type UIService struct{}
func NewUiService() *UiService {
return &UiService{}
// NewUIService creates a UI service.
func NewUIService() *UIService {
return &UIService{}
}
func (s *UiService) GetPermissions(roles []string) []string {
// GetPermissions returns permissions for the supplied roles.
func (s *UIService) GetPermissions(roles []string) []string {
resMap := s.getPermissionsMap(roles)
res := make([]string, 0, len(resMap))
for permission := range resMap {
@@ -43,7 +46,7 @@ func (s *UiService) GetPermissions(roles []string) []string {
return res
}
func (s *UiService) getPermissionsMap(roles []string) map[string]any {
func (s *UIService) getPermissionsMap(roles []string) map[string]any {
resMap := make(map[string]any, 100)
if slices.Contains(roles, rolesModule.Admin) {