Allow auditors to read the organization context

Auditors could not see the Context page in the console because
AuditorPolicy was missing core:organization-context:get. Grant the
read action (mirroring ViewerPolicy) so the sidebar item appears and
the context resolver succeeds for auditors.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-06-05 16:48:26 +02:00
parent 3d1f089685
commit 400800fd41
2 changed files with 29 additions and 0 deletions

View File

@@ -133,6 +133,8 @@ var AuditorPolicy = policy.NewPolicy(
ActionOrganizationGetHorizontalLogoUrl,
).WithSID("org-read-access").When(organizationCondition),
policy.Allow(ActionOrganizationContextGet).WithSID("organization-context-read").When(organizationCondition),
policy.Allow(
ActionThirdPartyGet, ActionThirdPartyList,
ActionThirdPartyContactGet, ActionThirdPartyContactList,

View File

@@ -73,3 +73,30 @@ func TestAuditorPolicy_ProcessingActivityPageReadAccess(t *testing.T) {
})
}
}
func TestAuditorPolicy_OrganizationContextReadAccess(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(),
},
}
result := evaluator.Evaluate(
policy.AuthorizationRequest{
Principal: organizationID,
Resource: organizationID,
Action: probo.ActionOrganizationContextGet,
ConditionContext: conditionContext,
},
[]*policy.Policy{probo.AuditorPolicy},
)
assert.True(t, result.IsAllowed())
}