Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update api for wildcard support #42

Merged
merged 2 commits into from Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion buf.gen.yaml
@@ -1,4 +1,4 @@
#!/usr/bin/env -S buf generate buf.build/authzed/api:262837a8e7451bfd9cac0518972ceaef1d0b9963 --template
#!/usr/bin/env -S buf generate buf.build/authzed/api:13e8ee73802a1a7825fcfa66a3ff9b13c43e2d8e --template
---
version: "v1"
plugins:
Expand Down
19 changes: 18 additions & 1 deletion proto/apidocs.swagger.json
Expand Up @@ -377,6 +377,9 @@
}
},
"definitions": {
"AllowedRelationPublicWildcard": {
"type": "object"
},
"CheckPermissionResponsePermissionship": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -615,6 +618,20 @@
}
}
},
"v0AllowedRelation": {
"type": "object",
"properties": {
"namespace": {
"type": "string"
},
"relation": {
"type": "string"
},
"publicWildcard": {
"$ref": "#/definitions/AllowedRelationPublicWildcard"
}
}
},
"v0CheckResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1050,7 +1067,7 @@
"allowedDirectRelations": {
"type": "array",
"items": {
"$ref": "#/definitions/v0RelationReference"
"$ref": "#/definitions/v0AllowedRelation"
}
}
}
Expand Down
47 changes: 47 additions & 0 deletions proto/authzed/api/v0/02_handwritten_validation.go
@@ -0,0 +1,47 @@
// The contents of this file are hand-written to add HandwrittenValidate to select message types

package v0

func (m *CheckRequest) HandwrittenValidate() error {
if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *ContentChangeCheckRequest) HandwrittenValidate() error {
if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *ExpandRequest) HandwrittenValidate() error {
if m.GetUserset() != nil && m.GetUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *LookupRequest) HandwrittenValidate() error {
if m.GetUser() != nil && m.GetUser().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}
119 changes: 60 additions & 59 deletions proto/authzed/api/v0/acl_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions proto/authzed/api/v0/acl_service.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.