Skip to content

Commit

Permalink
Merge pull request #2142 from josephschorr/rel-expiration-compiler
Browse files Browse the repository at this point in the history
Schema compiler support for relationship expiration trait
  • Loading branch information
josephschorr authored Nov 26, 2024
2 parents 96b3ec5 + 64e174b commit 5647633
Show file tree
Hide file tree
Showing 10 changed files with 943 additions and 391 deletions.
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

0 comments on commit 5647633

Please sign in to comment.