mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-22 12:58:46 +00:00
feat(relational): command permission check (#10771)
# Which Problems Are Solved There is no implementation of the permission framework in the new command pattern. We risk forgetting permission options as we are already migrating the service layer to the new pattern. # How the Problems Are Solved Use an permission checker interface, which will be a sub-interface of the Permission Repository. The permission checker is passed in the command executor and invoker as part of the command options. From here the implementation can call the correct permission method. This PR proposes a check method for each [level](https://github.com/zitadel/zitadel/wiki/Internal-AuthZ#levels). # Additional Changes - none # Additional Context - Draft design: https://github.com/zitadel/zitadel/wiki/Internal-AuthZ#enforcement - Related for queries: https://github.com/zitadel/zitadel/pull/10756
This commit is contained in:
@@ -28,8 +28,9 @@ type Invoker interface {
|
||||
// CommandOpts are passed to each command
|
||||
// it provides common fields used by commands like the database client.
|
||||
type CommandOpts struct {
|
||||
DB database.QueryExecutor
|
||||
Invoker Invoker
|
||||
DB database.QueryExecutor
|
||||
Invoker Invoker
|
||||
Permissions PermissionChecker
|
||||
}
|
||||
|
||||
type ensureTxOpts struct {
|
||||
@@ -101,8 +102,9 @@ func DefaultOpts(invoker Invoker) *CommandOpts {
|
||||
invoker = &noopInvoker{}
|
||||
}
|
||||
return &CommandOpts{
|
||||
DB: pool,
|
||||
Invoker: invoker,
|
||||
DB: pool,
|
||||
Invoker: invoker,
|
||||
Permissions: &noopPermissionChecker{}, // prevent panics for now
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user