@@ -17,6 +17,7 @@ package policy
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
)
|
||||
@@ -108,9 +109,7 @@ func (a *Authorizer) Authorize(params AuthorizeParams) error {
|
||||
}
|
||||
|
||||
// Add resource attributes to context
|
||||
for k, v := range params.ResourceAttributes {
|
||||
conditionCtx.Resource[k] = v
|
||||
}
|
||||
maps.Copy(conditionCtx.Resource, params.ResourceAttributes)
|
||||
|
||||
// Build authorization request
|
||||
req := AuthorizationRequest{
|
||||
|
||||
@@ -148,7 +148,7 @@ func (c Condition) Evaluate(ctx ConditionContext) bool {
|
||||
// Support a comma-separated "set" value, e.g.
|
||||
// principal.organization_ids = "org_1,org_2"
|
||||
if strings.Contains(resolved, ",") {
|
||||
for _, item := range strings.Split(resolved, ",") {
|
||||
for item := range strings.SplitSeq(resolved, ",") {
|
||||
if value == strings.TrimSpace(item) {
|
||||
return true
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (c Condition) Evaluate(ctx ConditionContext) bool {
|
||||
}
|
||||
|
||||
if strings.Contains(resolved, ",") {
|
||||
for _, item := range strings.Split(resolved, ",") {
|
||||
for item := range strings.SplitSeq(resolved, ",") {
|
||||
if value == strings.TrimSpace(item) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user