@@ -3,6 +3,7 @@ package config
3
3
import (
4
4
"github.com/gosimple/slug"
5
5
6
+ "github.com/kyverno/policy-reporter-ui/pkg/auth"
6
7
"github.com/kyverno/policy-reporter-ui/pkg/server/api"
7
8
"github.com/kyverno/policy-reporter-ui/pkg/utils"
8
9
)
@@ -19,6 +20,9 @@ func MapConfig(c *Config) *api.Config {
19
20
Name : cl .Name ,
20
21
Slug : slug .Make (cl .Name ),
21
22
Plugins : plugins ,
23
+ Permissions : auth.Permissions {
24
+ AccessControl : auth .AccessControl (cl .AccessControl ),
25
+ },
22
26
})
23
27
}
24
28
@@ -38,8 +42,8 @@ func MapConfig(c *Config) *api.Config {
38
42
OAuth : oauth ,
39
43
Banner : c .UI .Banner ,
40
44
Boards : api.Boards {
41
- Permissions : api .Permissions {
42
- AccessControl : api .AccessControl {
45
+ Permissions : auth .Permissions {
46
+ AccessControl : auth .AccessControl {
43
47
Emails : c .Boards .AccessControl .Emails ,
44
48
},
45
49
},
@@ -76,8 +80,8 @@ func MapCustomBoards(customBoards []CustomBoard) map[string]api.CustomBoard {
76
80
Sources : api.Sources {
77
81
List : c .Sources .List ,
78
82
},
79
- Permissions : api .Permissions {
80
- AccessControl : api .AccessControl {
83
+ Permissions : auth .Permissions {
84
+ AccessControl : auth .AccessControl {
81
85
Emails : c .AccessControl .Emails ,
82
86
},
83
87
},
@@ -90,3 +94,14 @@ func MapCustomBoards(customBoards []CustomBoard) map[string]api.CustomBoard {
90
94
91
95
return configs
92
96
}
97
+
98
+ func MapClusterPermissions (c * Config ) map [string ]auth.Permissions {
99
+ permissions := make (map [string ]auth.Permissions , len (c .Clusters ))
100
+ for _ , cluster := range c .Clusters {
101
+ permissions [slug .Make (cluster .Name )] = auth.Permissions {
102
+ AccessControl : auth .AccessControl (cluster .AccessControl ),
103
+ }
104
+ }
105
+
106
+ return permissions
107
+ }
0 commit comments