mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-23 13:28:45 +00:00
feat(repository): add permission check option (#10756)
This commit is contained in:
@@ -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
|
type joinType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -100,6 +108,9 @@ type QueryOpts struct {
|
|||||||
// Joins is a list of joins to be applied to the query.
|
// Joins is a list of joins to be applied to the query.
|
||||||
// It is used to build the JOIN clauses of the SQL statement.
|
// It is used to build the JOIN clauses of the SQL statement.
|
||||||
Joins []join
|
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) {
|
func (opts *QueryOpts) Write(builder *StatementBuilder) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Package implements the repositories defined in the domain package.
|
// Package repository implements the repositories defined in the domain package.
|
||||||
// The repositories are used by the domain package to access the database.
|
// The repositories are used by the domain package to access the database.
|
||||||
// the inheritance.sql file is me over-engineering table inheritance.
|
// the inheritance.sql file is me over-engineering table inheritance.
|
||||||
// I would create a user table which is inherited by human_user and machine_user and the same for objects like idps.
|
// I would create a user table which is inherited by human_user and machine_user and the same for objects like idps.
|
||||||
|
|||||||
Reference in New Issue
Block a user