Fix auditor processing activity access
Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -150,7 +150,7 @@ var AuditorPolicy = policy.NewPolicy(
|
||||
ActionFindingGet, ActionFindingList,
|
||||
ActionObligationGet, ActionObligationList,
|
||||
ActionProcessingActivityGet, ActionProcessingActivityList,
|
||||
ActionDataProtectionImpactAssessmentGet,
|
||||
ActionDataProtectionImpactAssessmentGet, ActionDataProtectionImpactAssessmentList,
|
||||
ActionTransferImpactAssessmentGet, ActionTransferImpactAssessmentList,
|
||||
ActionSnapshotGet, ActionSnapshotList,
|
||||
ActionFileGet, ActionFileDownloadUrl,
|
||||
|
||||
75
pkg/probo/policies_test.go
Normal file
75
pkg/probo/policies_test.go
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package probo_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
"go.probo.inc/probo/pkg/iam/policy"
|
||||
"go.probo.inc/probo/pkg/probo"
|
||||
)
|
||||
|
||||
func TestAuditorPolicy_ProcessingActivityPageReadAccess(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
organizationID := gid.New(gid.NewTenantID(), 1)
|
||||
evaluator := policy.NewEvaluator()
|
||||
conditionContext := policy.ConditionContext{
|
||||
Principal: map[string]string{
|
||||
"organization_id": organizationID.String(),
|
||||
},
|
||||
Resource: map[string]string{
|
||||
"organization_id": organizationID.String(),
|
||||
},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
action string
|
||||
}{
|
||||
{
|
||||
name: "list processing activities",
|
||||
action: probo.ActionProcessingActivityList,
|
||||
},
|
||||
{
|
||||
name: "list data protection impact assessments",
|
||||
action: probo.ActionDataProtectionImpactAssessmentList,
|
||||
},
|
||||
{
|
||||
name: "list transfer impact assessments",
|
||||
action: probo.ActionTransferImpactAssessmentList,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
result := evaluator.Evaluate(
|
||||
policy.AuthorizationRequest{
|
||||
Principal: organizationID,
|
||||
Resource: organizationID,
|
||||
Action: tt.action,
|
||||
ConditionContext: conditionContext,
|
||||
},
|
||||
[]*policy.Policy{probo.AuditorPolicy},
|
||||
)
|
||||
|
||||
assert.True(t, result.IsAllowed())
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user