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

Schema compiler support for relationship expiration trait #2142

Merged
merged 2 commits into from
Nov 26, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pkg/namespace/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,29 @@ func AllowedRelationWithCaveat(namespaceName string, relationName string, withCa
}
}

// AllowedRelationWithExpiration creates a relation reference to an allowed relation.
func AllowedRelationWithExpiration(namespaceName string, relationName string) *core.AllowedRelation {
return &core.AllowedRelation{
Namespace: namespaceName,
RelationOrWildcard: &core.AllowedRelation_Relation{
Relation: relationName,
},
RequiredExpiration: &core.ExpirationTrait{},
}
}

// AllowedRelationWithCaveatAndExpiration creates a relation reference to an allowed relation.
func AllowedRelationWithCaveatAndExpiration(namespaceName string, relationName string, withCaveat *core.AllowedCaveat) *core.AllowedRelation {
return &core.AllowedRelation{
Namespace: namespaceName,
RelationOrWildcard: &core.AllowedRelation_Relation{
Relation: relationName,
},
RequiredExpiration: &core.ExpirationTrait{},
RequiredCaveat: withCaveat,
}
}

// AllowedPublicNamespace creates a relation reference to an allowed public namespace.
func AllowedPublicNamespace(namespaceName string) *core.AllowedRelation {
return &core.AllowedRelation{
Expand Down
Loading
Loading