feat(repository): add permission check option (#10756)

This commit is contained in:
Tim Möhlmann
2025-09-19 15:08:58 +00:00
committed by GitHub
parent 2c0ee0008f
commit adc8fb2013
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -57,6 +57,14 @@ func WithLeftJoin(table string, columns Condition) QueryOption {
}
}
// WithPermissionCheck enables a check if the authenticated user has the
// passed permission to read or write a resource.
func WithPermissionCheck(permission string) QueryOption {
return func(opts *QueryOpts) {
opts.Permission = permission
}
}
type joinType string
const (
@@ -100,6 +108,9 @@ type QueryOpts struct {
// Joins is a list of joins to be applied to the query.
// It is used to build the JOIN clauses of the SQL statement.
Joins []join
// Permission required to read or write the resource.
// When unset, no permission check is made.
Permission string
}
func (opts *QueryOpts) Write(builder *StatementBuilder) {