Skip to content

Commit 7e0891e

Browse files
Merge pull request #398 from scottmcclung:feature/security-utils-test-fix
fflib_SecurityUtilsTest: Applying permission set to Read Only profile user
2 parents 991bcbc + 571d2cc commit 7e0891e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ private class fflib_SecurityUtilsTest {
8080

8181
static User setupTestUser(String profileName){
8282
Profile p;
83-
Boolean usedMinimumAccessProfile = false;
83+
Boolean applyReadOnlyPermissionSet = false;
8484
if (profileName == 'Read Only') {
85+
applyReadOnlyPermissionSet = true;
8586
try {
8687
p = getProfile(profileName);
8788
} catch (QueryException ex) {
8889
if (ex.getMessage().contains('List has no rows for assignment to SObject')) {
8990
// #315 If the "Read Only" Profile is absent, then assume it's a Spring '21 org and see if there's a
9091
// "Minimum Access - Salesforce" Profile we can use instead.
9192
p = getProfile('Minimum Access - Salesforce');
92-
usedMinimumAccessProfile = true;
9393
}
9494
}
9595
} else {
@@ -117,7 +117,7 @@ private class fflib_SecurityUtilsTest {
117117
);
118118
insert usr;
119119

120-
if (usedMinimumAccessProfile) {
120+
if (applyReadOnlyPermissionSet) {
121121
// #315 We need to assign the Perm Set to grant Account "Read" access
122122
PermissionSet accountReadPS = [SELECT Id FROM PermissionSet WHERE Name = 'ReadOnlyPermissionSet'];
123123
PermissionSetAssignment psa = new PermissionSetAssignment(AssigneeId = usr.Id, PermissionSetId = accountReadPS.Id);

0 commit comments

Comments
 (0)