mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: Implement RBAC checks on /templates endpoints (#1678)
* feat: Generic Filter method for rbac objects
This commit is contained in:
@ -6,6 +6,11 @@ import (
|
||||
|
||||
const WildcardSymbol = "*"
|
||||
|
||||
// Objecter returns the RBAC object for itself.
|
||||
type Objecter interface {
|
||||
RBACObject() Object
|
||||
}
|
||||
|
||||
// Resources are just typed objects. Making resources this way allows directly
|
||||
// passing them into an Authorize function and use the chaining api.
|
||||
var (
|
||||
@ -99,6 +104,10 @@ type Object struct {
|
||||
// TODO: SharedUsers?
|
||||
}
|
||||
|
||||
func (z Object) RBACObject() Object {
|
||||
return z
|
||||
}
|
||||
|
||||
// All returns an object matching all resources of the same type.
|
||||
func (z Object) All() Object {
|
||||
return Object{
|
||||
|
Reference in New Issue
Block a user