ch en -tk
This commit is contained in:
1 parent
8b73df4435
commit
19a1f70588
3 files changed
+16
No files matched your search
@@ -17,6 +17,20 @@ const (
|
|||||||
ScopeAll Scope = "all" // every branch
|
ScopeAll Scope = "all" // every branch
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Name is the Turkmen display label for the admin UI.
|
||||||
|
func (s Scope) Name() string {
|
||||||
|
switch s {
|
||||||
|
case ScopeOwn:
|
||||||
|
return "Diňe öz maglumatlary"
|
||||||
|
case ScopeBranch:
|
||||||
|
return "Öz şahamçalary"
|
||||||
|
case ScopeAll:
|
||||||
|
return "Ähli şahamçalar"
|
||||||
|
default:
|
||||||
|
return string(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s Scope) Valid() bool {
|
func (s Scope) Valid() bool {
|
||||||
return s == ScopeOwn || s == ScopeBranch || s == ScopeAll
|
return s == ScopeOwn || s == ScopeBranch || s == ScopeAll
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ func scanRole(row genericrepo.Scanner) (role.RoleDTO, error) {
|
|||||||
return role.RoleDTO{}, err
|
return role.RoleDTO{}, err
|
||||||
}
|
}
|
||||||
item.Scope = rbac.Scope(scope)
|
item.Scope = rbac.Scope(scope)
|
||||||
|
item.ScopeName = item.Scope.Name()
|
||||||
item.Permissions = make([]perm.Code, len(codes))
|
item.Permissions = make([]perm.Code, len(codes))
|
||||||
for i, code := range codes {
|
for i, code := range codes {
|
||||||
item.Permissions[i] = perm.Code(code)
|
item.Permissions[i] = perm.Code(code)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type RoleDTO struct {
|
|||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Scope rbac.Scope `json:"scope"`
|
Scope rbac.Scope `json:"scope"`
|
||||||
|
ScopeName string `json:"scopeName"`
|
||||||
IsSuper bool `json:"isSuper"`
|
IsSuper bool `json:"isSuper"`
|
||||||
IsSystem bool `json:"isSystem"`
|
IsSystem bool `json:"isSystem"`
|
||||||
Permissions []perm.Code `json:"permissions"`
|
Permissions []perm.Code `json:"permissions"`
|
||||||
|
|||||||
Reference in new issue
Block a user