(core) Allow doc owners to view document usage regardless of access rules

Summary: Document usage is now available for owners regardless ACL rules

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3717
This commit is contained in:
Jarosław Sadziński 2022-11-23 16:26:40 +01:00
parent 312d2331a8
commit 2ca407505b

View File

@ -628,6 +628,10 @@ export class GranularAccess implements GranularAccessForBundle {
options: {role?: Role | null} = {} options: {role?: Role | null} = {}
): Promise<FilteredDocUsageSummary> { ): Promise<FilteredDocUsageSummary> {
const result: FilteredDocUsageSummary = { ...docUsage }; const result: FilteredDocUsageSummary = { ...docUsage };
// Owners can see everything all the time.
if (await this.isOwner(docSession)) {
return result;
}
const role = options.role ?? await this.getNominalAccess(docSession); const role = options.role ?? await this.getNominalAccess(docSession);
const hasEditRole = canEdit(role); const hasEditRole = canEdit(role);
if (!hasEditRole) { result.dataLimitStatus = null; } if (!hasEditRole) { result.dataLimitStatus = null; }