Skip to content

Commit c8f8200

Browse files
authored
auditor should be able to view org files/avatar (#2554)
1 parent 3ea465d commit c8f8200

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

fga/model/base/file.fga

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ type file
2424
# parent permissions derived based on `crud` permissions or parents
2525
define parent_deleter: full_access from parent_context or can_delete from parent
2626
define parent_editor: can_edit from parent_context or can_edit_file from parent_context or can_edit from parent
27-
define parent_viewer: can_view from parent_context or can_view_file from parent_context or can_view from parent
27+
define parent_viewer: can_view from parent_context or can_view_file from parent_context or can_view_org from parent or can_view from parent
2828
define parent_context: [organization]
2929
# NOTE: organization is generally not considered a parent, but for backwards compatibility with files, we are keeping this here - do not replicate on other models
3030
define parent: [user, program, organization, group, control, procedure, template, document_data, contact, internal_policy, narrative, evidence, note, trust_center_setting, subprocessor, export, trust_center_watermark_config, standard,trust_center_entity, entity, identity_holder, trust_center_subprocessor, scan, platform, review]
3131
define tc_doc_parent: [trust_center_doc]
3232

33-

fga/tests/tests.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,18 @@ tests:
830830
can_view: true
831831
can_edit: true
832832
can_delete: true
833+
- user: user:ulid-auditor # organization auditor should be able to view organization avatar files
834+
object: file:file-org-avatar
835+
assertions:
836+
can_view: true
837+
can_edit: false
838+
can_delete: false
839+
- user: user:ulid-auditor # organization auditor should not view all organization-scoped files
840+
object: file:file-org-scoped
841+
assertions:
842+
can_view: false
843+
can_edit: false
844+
can_delete: false
833845
# test user-owned file access
834846
- user: user:ulid-file-owner # the file owner should have full access
835847
object: file:file-user-owned

fga/tests/tuples/files.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
- user: contact:contact-1
2727
relation: parent
2828
object: file:file-3 # contact has access to file
29+
- user: user:ulid-auditor
30+
relation: auditor
31+
object: organization:auditor-file-org
32+
- user: organization:auditor-file-org
33+
relation: parent
34+
object: file:file-org-avatar
35+
- user: organization:auditor-file-org
36+
relation: parent_context
37+
object: file:file-org-scoped
2938

3039
#setup organization with empty domain condition
3140
- user: organization:contact-org#member

0 commit comments

Comments
 (0)