Full dynamic RBAC and pagination

This commit is contained in:
Darren Shepherd
2020-02-10 10:18:20 -07:00
parent 12df5d1a3d
commit e64845dcb9
18 changed files with 656 additions and 36 deletions

View File

@@ -232,18 +232,25 @@ func (s *Store) getCount(apiOp *types.APIRequest) Count {
for _, schema := range s.schemasToWatch(apiOp) {
gvr := attributes.GVR(schema)
access, _ := attributes.Access(schema).(accesscontrol.AccessListByVerb)
rev := 0
itemCount := ItemCount{
Namespaces: map[string]int{},
}
all := access.Grants("list", "*", "*")
for _, obj := range s.ccache.List(gvr) {
_, ns, revision, ok := getInfo(obj)
name, ns, revision, ok := getInfo(obj)
if !ok {
continue
}
if !all && !access.Grants("list", ns, name) && !access.Grants("get", ns, name) {
continue
}
if revision > rev {
rev = revision
}