mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
chore: remove rbac psuedo resources, add custom verbs (#13276)
Removes our pseudo rbac resources like `WorkspaceApplicationConnect` in favor of additional verbs like `ssh`. This is to make more intuitive permissions for building custom roles. The source of truth is now `policy.go`
This commit is contained in:
@@ -4,6 +4,18 @@ import (
|
||||
"golang.org/x/exp/constraints"
|
||||
)
|
||||
|
||||
// Omit creates a new slice with the arguments omitted from the list.
|
||||
func Omit[T comparable](a []T, omits ...T) []T {
|
||||
tmp := make([]T, 0, len(a))
|
||||
for _, v := range a {
|
||||
if Contains(omits, v) {
|
||||
continue
|
||||
}
|
||||
tmp = append(tmp, v)
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
// SameElements returns true if the 2 lists have the same elements in any
|
||||
// order.
|
||||
func SameElements[T comparable](a []T, b []T) bool {
|
||||
|
||||
@@ -123,3 +123,11 @@ func TestDescending(t *testing.T) {
|
||||
assert.Equal(t, 0, slice.Descending(1, 1))
|
||||
assert.Equal(t, -1, slice.Descending(2, 1))
|
||||
}
|
||||
|
||||
func TestOmit(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert.Equal(t, []string{"a", "b", "f"},
|
||||
slice.Omit([]string{"a", "b", "c", "d", "e", "f"}, "c", "d", "e"),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user