1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-12 04:39:05 +00:00

Implement generic CanDo against k8s roles

This commit is contained in:
Darren Shepherd
2021-05-18 22:34:46 -07:00
parent 43139e348a
commit a1ef4004f8
2 changed files with 33 additions and 1 deletions

View File

@@ -125,9 +125,20 @@ func (c *Collection) schemasForSubject(access *accesscontrol.AccessSet) (*types.
}
}
result.Attributes = map[string]interface{}{
"accessSet": access,
}
return result, nil
}
func (c *Collection) defaultStore() types.Store {
templates := c.templates[""]
if len(templates) > 0 {
return templates[0].Store
}
return nil
}
func (c *Collection) applyTemplates(schema *types.APISchema) {
c.lock.RLock()
defer c.lock.RUnlock()
@@ -152,7 +163,7 @@ func (c *Collection) applyTemplates(schema *types.APISchema) {
if t.StoreFactory == nil {
schema.Store = t.Store
} else {
schema.Store = t.StoreFactory(templates[2].Store)
schema.Store = t.StoreFactory(c.defaultStore())
}
}
if t.Customize != nil {