Merge Go frontend (apiserver + xcecli) into meson build
This commit is contained in:
parent
43dc12a36c
commit
c9dc8c4676
205 changed files with 30793 additions and 328 deletions
84
src/frontend/apiserver/models/roles.go
Normal file
84
src/frontend/apiserver/models/roles.go
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package models
|
||||
|
||||
var RolesAvailableTypes = []string{"builtin", "all"}
|
||||
|
||||
var BUILTIN_ROLE_NAMES = []string{
|
||||
"basic_user",
|
||||
"cluster_admin",
|
||||
"queue_admin",
|
||||
}
|
||||
|
||||
var ROLE_SUPPORT_FILTERS = []string{
|
||||
"role_name",
|
||||
"action",
|
||||
}
|
||||
|
||||
var ROLE_SUPPORT_SORT = []string{
|
||||
"role_name",
|
||||
"action",
|
||||
}
|
||||
|
||||
var ROLE_DEFAULT_COLUMN = []string{
|
||||
"role_name",
|
||||
"action",
|
||||
"domain_type",
|
||||
"domain_values",
|
||||
}
|
||||
|
||||
var JSONBRFields = []string{"domain_values"}
|
||||
|
||||
type RoleFields struct {
|
||||
RoleName string `json:"role_name"`
|
||||
}
|
||||
type RoleInfo struct {
|
||||
RoleName string `json:"role_name"`
|
||||
Action string `json:"action"`
|
||||
DomainType string `json:"domain_type"`
|
||||
DomainValues Jsonb `json:"domain_values"`
|
||||
}
|
||||
|
||||
type RolePermission struct {
|
||||
Permission string `json:"permission_name" binding:"required"`
|
||||
DomainType string `json:"domain_type" binding:"required"`
|
||||
DomainValues []string `json:"domain_values"`
|
||||
}
|
||||
|
||||
type CreateRoleRequest struct {
|
||||
RoleName string `json:"role_name" binding:"required"`
|
||||
RolePermissions []RolePermission `json:"permissions" binding:"required"`
|
||||
}
|
||||
|
||||
const (
|
||||
DomainTypeAll = "all"
|
||||
DomainTypeSelf = "self"
|
||||
DomainTypeCluster = "cluster"
|
||||
DomainTypeJob = "job"
|
||||
DomainTypeQueue = "queue"
|
||||
DomainTypeHost = "host"
|
||||
DomainTypeUser = "user"
|
||||
DomainTypeFile = "file"
|
||||
DomainTypeHostGroup = "hostgroup"
|
||||
DomainTypeUserGroup = "usergroup"
|
||||
DomainTypeResource = "resource"
|
||||
DomainTypeSelfUG = "self_ug"
|
||||
DomainTypeSelfHG = "self_hg"
|
||||
DomainTypeRBAC = "rbac"
|
||||
)
|
||||
|
||||
var SupportedDomainTypes = map[string][]string{
|
||||
DomainTypeCluster: {DomainTypeAll},
|
||||
DomainTypeJob: {DomainTypeAll, DomainTypeSelf, DomainTypeSelfUG},
|
||||
DomainTypeQueue: {DomainTypeAll, DomainTypeQueue},
|
||||
DomainTypeHost: {DomainTypeAll, DomainTypeHostGroup},
|
||||
DomainTypeUser: {DomainTypeAll, DomainTypeSelf},
|
||||
DomainTypeFile: {DomainTypeAll, DomainTypeSelf},
|
||||
DomainTypeHostGroup: {DomainTypeAll, DomainTypeSelfHG, DomainTypeHostGroup},
|
||||
DomainTypeUserGroup: {DomainTypeAll, DomainTypeSelfUG, DomainTypeUserGroup},
|
||||
DomainTypeResource: {DomainTypeAll, DomainTypeSelf},
|
||||
DomainTypeRBAC: {DomainTypeAll, DomainTypeSelf},
|
||||
}
|
||||
|
||||
type RoleCreateResponse struct {
|
||||
RoleName string `json:"role_name"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue