代码拉取完成,页面将自动刷新
package rbac
import v1 "github.com/rancher/types/apis/rbac.authorization.k8s.io/v1"
type ListPermissionStore struct {
users *permissionIndex
groups *permissionIndex
}
func NewListPermissionStore(client v1.Interface) *ListPermissionStore {
users, groups := newIndexes(client)
return &ListPermissionStore{
users: users,
groups: groups,
}
}
type ListPermissionSet map[ListPermission]bool
func (l ListPermissionSet) HasAccess(namespace, name string) bool {
return l[ListPermission{
Namespace: namespace,
Name: name,
}]
}
type ListPermission struct {
Namespace string
Name string
}
func (l *ListPermissionStore) UserPermissions(subjectName, apiGroup, resource, verb string) ListPermissionSet {
return getFromIndex(subjectName, apiGroup, resource, verb, l.users)
}
func (l *ListPermissionStore) GroupPermissions(subjectName, apiGroup, resource, verb string) ListPermissionSet {
return getFromIndex(subjectName, apiGroup, resource, verb, l.groups)
}
func getFromIndex(subjectName, apiGroup, resource, verb string, index *permissionIndex) ListPermissionSet {
result := ListPermissionSet{}
for _, value := range index.get(subjectName, apiGroup, resource, verb) {
result[value] = true
}
return result
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。