Skip to content

Commit

Permalink
Improved output of inaccessible fields on security violation
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Mar 30, 2022
1 parent 62b2089 commit 5e008f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,9 @@ public inherited sharing virtual class SecureDml extends fflib_SobjectUnitOfWork
String label = Label.ortoo_core_fls_violation;
String modeDescription = descriptionByMode.get( mode );
String sobjectTypeName = SobjectUtils.getSobjectName( sobjectType );
String fieldsInViolationString = String.join( ListUtils.convertToListOfStrings( fieldsInViolation ), ', ' );

throw new SecureDmlException( StringUtils.formatLabel( label, new List<String>{ modeDescription, sobjectTypeName, fieldsInViolation.toString() } ) )
throw new SecureDmlException( StringUtils.formatLabel( label, new List<String>{ modeDescription, sobjectTypeName, fieldsInViolationString } ) )
.setErrorCode( FrameworkErrorCodes.DML_ON_INACCESSIBLE_FIELDS )
.addContext( 'sobjectTypeName', sobjectTypeName )
.addContext( 'fieldsInViolation', fieldsInViolation )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<language>en_US</language>
<protected>false</protected>
<shortDescription>Message when FLS violation occurs on a DML operation.</shortDescription>
<value>Attempted to {0} {1} with fields that are not accessible: {2}</value>
<value>Attempted to {0} {1} with fields that are not accessible / updateable: {2}</value>
</labels>
<labels>
<fullName>ortoo_core_crud_insert_violation</fullName>
Expand Down

0 comments on commit 5e008f5

Please sign in to comment.