1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 15:18:20 +00:00

Put in stubs for dynamic access control on schemas

This commit is contained in:
Darren Shepherd
2018-01-16 18:03:35 -07:00
parent f7f989c4e2
commit 245c089cd5
8 changed files with 66 additions and 30 deletions

View File

@@ -127,15 +127,15 @@ func (j *JSONResponseWriter) addLinks(b *builder.Builder, schema *types.Schema,
self := context.URLBuilder.ResourceLink(rawResource)
rawResource.Links["self"] = self
if schema.CanUpdate() {
if context.AccessControl.CanUpdate(context, input, schema) {
rawResource.Links["update"] = self
}
if schema.CanDelete() {
if context.AccessControl.CanDelete(context, input, schema) {
rawResource.Links["remove"] = self
}
for _, backRef := range context.Schemas.References(schema) {
if !backRef.Schema.CanList() {
if !backRef.Schema.CanList(context) {
continue
}