fix: custom error requires permission object
@@ -10,7 +10,7 @@ import (
// PermissionDeniedError represents an error that arises when a user does not have sufficient
// access privileges. RequiredPermissions can be empty for non-rbac errors.
type PermissionDeniedError struct {
- RequiredPermissions []*rbacv1.Permission
+ RequiredPermissions []rbacv1.PermissionType
}
// Error returns an error string.
@@ -21,7 +21,7 @@ func (p PermissionDeniedError) Error() string {
permissions := make([]string, len(p.RequiredPermissions))
for i, perm := range p.RequiredPermissions {
- permissions[i] = perm.Name
+ permissions[i] = rbacv1.PermissionType_name[int32(perm)]
}
return fmt.Sprintf("access denied; required permissions: %s", strings.Join(
permissions, ", "))
