-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Bring auditor role to NewDot #47561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring auditor role to NewDot #47561
Changes from all commits
a986e71
fec77ba
0f6423c
5b59e2c
c34ae3c
f08c970
775b47d
79c7b28
97df3fd
740fde0
59abfac
a9ca0d6
429cac3
e5fb2b7
e717b1f
32c5d74
dfd6e5f
608d3c1
3a64f82
e31a362
b286926
ba0cff2
5109afa
419780a
dcfe404
1d6aecc
e6ff8f1
e6bd7aa
bd55006
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1415,12 +1415,28 @@ function isJoinRequestInAdminRoom(report: OnyxEntry<Report>): boolean { | |
| return ReportActionsUtils.isActionableJoinRequestPending(report.reportID); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the user has auditor permission in the provided report | ||
| */ | ||
| function isAuditor(report: OnyxEntry<Report>): boolean { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay so I think this is slightly wrong - I think we should check for
I looked at Onyx and the auditor's report permissions for the task assigned to the admin is What do you think? Would this cause any issues I'm not aware of?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow up - let me know how you were testing it before if it was seeming to work then? Maybe I did something wrong - or maybe there's a flow (maybe the change role isn't working or something?) that we need to adjust
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks let me take a look
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's pretty weird that on the admin assigned task, when I viewed it as an auditor the permissions are read, write, share which makes Switch the Thanks for testing it! 💯
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! |
||
| if (report?.policyID) { | ||
| const policy = getPolicy(report.policyID); | ||
| return PolicyUtils.isPolicyAuditor(policy); | ||
| } | ||
|
|
||
| if (Array.isArray(report?.permissions) && report?.permissions.length > 0) { | ||
| return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.AUDITOR); | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the user can write in the provided report | ||
| */ | ||
| function canWriteInReport(report: OnyxEntry<Report>): boolean { | ||
| if (Array.isArray(report?.permissions) && report?.permissions.length > 0) { | ||
| return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.WRITE) || (report?.permissions?.includes(CONST.REPORT.PERMISSIONS.AUDITOR) && isExpenseReport(report)); | ||
| if (Array.isArray(report?.permissions) && report?.permissions.length > 0 && !report?.permissions?.includes(CONST.REPORT.PERMISSIONS.AUDITOR)) { | ||
| return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.WRITE); | ||
| } | ||
|
|
||
| return true; | ||
|
|
@@ -1430,6 +1446,10 @@ function canWriteInReport(report: OnyxEntry<Report>): boolean { | |
| * Checks if the current user is allowed to comment on the given report. | ||
| */ | ||
| function isAllowedToComment(report: OnyxEntry<Report>): boolean { | ||
| if (isAuditor(report)) { | ||
| return true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| if (!canWriteInReport(report)) { | ||
| return false; | ||
| } | ||
|
|
@@ -7075,7 +7095,8 @@ function canEditReportDescription(report: OnyxEntry<Report>, policy: OnyxEntry<P | |
| isChatRoom(report) && | ||
| !isChatThread(report) && | ||
| !isEmpty(policy) && | ||
| hasParticipantInArray(report, [currentUserAccountID ?? 0]) | ||
| hasParticipantInArray(report, [currentUserAccountID ?? 0]) && | ||
| !isAuditor(report) | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -8108,6 +8129,7 @@ export { | |
| getArchiveReason, | ||
| getApprovalChain, | ||
| isIndividualInvoiceRoom, | ||
| isAuditor, | ||
| hasMissingInvoiceBankAccount, | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.