Skip to content

Commit 4d56ecb

Browse files
authored
Added tracking of logging user's federation identifier (#682)
* Added new long textarea (512) fields LoggedByFederationIdentifier__c on LogEntryEvent__e and Log__c to track the value of Schema.User.FederationIdentifier for the logging user * Added new field Log__c.HasLoggedByFederationIdentifier__c to make it easier to filter/identify records where the user's federation ID has been populated * Added field-level security (FLS) for the new Log__c fields to the permission sets LoggerAdmin, LoggerLogViewer, and LoggerEndUser * Added new field Log__c.LoggedByFederationIdentifier__c to the flexipage LogRecordPage - it conditionally shows, based on the value of the other new field, Log__c.HasLoggedByFederationIdentifier__c * Renamed the Big Object index LogEntryArchiveIndex.indexe-meta.xml to LogEntryArchiveIndex.index-meta.xml (indexe --> index) * Deleted several old scripts in package.json and in the directory ./scripts/build * Upgraded package dependencies & regenerated package-lock.json * Tweaked config in .prettierrc * Updated GitHub Actions in build.yml to use v4 (compatible with Node 20)
1 parent 18b4b52 commit 4d56ecb

31 files changed

Lines changed: 33779 additions & 24654 deletions

.github/workflows/build.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- name: 'Checkout source code'
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4949

5050
- name: 'Restore node_modules cache'
5151
id: cache-npm
52-
uses: actions/cache@v3
52+
uses: actions/cache@v4
5353
with:
5454
path: node_modules
5555
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -99,11 +99,11 @@ jobs:
9999
runs-on: ubuntu-latest
100100
steps:
101101
- name: 'Checkout source code'
102-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
103103

104104
- name: 'Restore node_modules cache'
105105
id: cache-npm
106-
uses: actions/cache@v3
106+
uses: actions/cache@v4
107107
with:
108108
path: node_modules
109109
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -131,11 +131,11 @@ jobs:
131131
environment: 'Base Scratch Org'
132132
steps:
133133
- name: 'Checkout source code'
134-
uses: actions/checkout@v3
134+
uses: actions/checkout@v4
135135

136136
- name: 'Restore node_modules cache'
137137
id: cache-npm
138-
uses: actions/cache@v3
138+
uses: actions/cache@v4
139139
with:
140140
path: node_modules
141141
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -183,7 +183,7 @@ jobs:
183183
run: npm run test:apex:nocoverage -- --synchronous
184184

185185
- name: 'Delete Base Scratch Org'
186-
run: npm run org:delete:noprompt
186+
run: npx sf org delete scratch --no-prompt
187187
if: ${{ always() }}
188188

189189
experience-cloud-scratch-org-tests:
@@ -193,11 +193,11 @@ jobs:
193193
environment: 'Experience Cloud Scratch Org'
194194
steps:
195195
- name: 'Checkout source code'
196-
uses: actions/checkout@v3
196+
uses: actions/checkout@v4
197197

198198
- name: 'Restore node_modules cache'
199199
id: cache-npm
200-
uses: actions/cache@v3
200+
uses: actions/cache@v4
201201
with:
202202
path: node_modules
203203
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -254,7 +254,7 @@ jobs:
254254
flags: Apex
255255

256256
- name: 'Delete Experience Cloud Scratch Org'
257-
run: npm run org:delete:noprompt
257+
run: npx sf org delete scratch --no-prompt
258258
if: ${{ always() }}
259259

260260
create-managed-package-beta:
@@ -265,13 +265,13 @@ jobs:
265265
environment: 'Demo Org'
266266
steps:
267267
- name: 'Checkout source code'
268-
uses: actions/checkout@v3
268+
uses: actions/checkout@v4
269269
with:
270270
ref: ${{ github.event.pull_request.head.ref }}
271271

272272
- name: 'Restore node_modules cache'
273273
id: cache-npm
274-
uses: actions/cache@v3
274+
uses: actions/cache@v4
275275
with:
276276
path: node_modules
277277
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -306,13 +306,13 @@ jobs:
306306
environment: 'Demo Org'
307307
steps:
308308
- name: 'Checkout source code'
309-
uses: actions/checkout@v3
309+
uses: actions/checkout@v4
310310
with:
311311
ref: ${{ github.event.pull_request.head.ref }}
312312

313313
- name: 'Restore node_modules cache'
314314
id: cache-npm
315-
uses: actions/cache@v3
315+
uses: actions/cache@v4
316316
with:
317317
path: node_modules
318318
key: npm-${{ hashFiles('**/package-lock.json') }}
@@ -377,11 +377,11 @@ jobs:
377377
runs-on: ubuntu-latest
378378
steps:
379379
- name: 'Checkout source code'
380-
uses: actions/checkout@v3
380+
uses: actions/checkout@v4
381381

382382
- name: 'Restore node_modules cache'
383383
id: cache-npm
384-
uses: actions/cache@v3
384+
uses: actions/cache@v4
385385
with:
386386
path: node_modules
387387
key: npm-${{ hashFiles('**/package-lock.json') }}

.prettierrc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@
77
"plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"],
88
"overrides": [
99
{
10-
"files": "*.{cls, apex}",
10+
"files": "*.{apex,cls,trigger}",
1111
"options": { "parser": "apex" }
1212
},
1313
{
1414
"files": "**/lwc/**/*.html",
1515
"options": { "parser": "lwc" }
1616
},
1717
{
18-
"files": "*.{cmp,page,component}",
18+
"files": "*.{cmp,page}",
1919
"options": { "parser": "html" }
20-
},
21-
{
22-
"files": "*.{md}",
23-
"options": { "parser": "markdown" }
2420
}
2521
]
2622
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.
77

8-
## Unlocked Package - v4.13.10
8+
## Unlocked Package - v4.13.11
99

10-
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000027L04QAE)
11-
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000027L04QAE)
10+
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000027L98QAE)
11+
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000027L98QAE)
1212
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)
1313

14-
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000027L04QAE`
14+
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000027L98QAE`
1515

16-
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000027L04QAE`
16+
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000027L98QAE`
1717

1818
---
1919

nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
155155
ImpersonatedBy__c = logEntryEvent.ImpersonatedById__c,
156156
Locale__c = logEntryEvent.Locale__c,
157157
LoggedBy__c = logEntryEvent.LoggedById__c,
158+
LoggedByFederationIdentifier__c = logEntryEvent.LoggedByFederationIdentifier__c,
158159
LoggedByUsername__c = logEntryEvent.LoggedByUsername__c,
159160
LoggerVersionNumber__c = logEntryEvent.LoggerVersionNumber__c,
160161
LoginApplication__c = logEntryEvent.LoginApplication__c,
@@ -695,6 +696,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
695696
}
696697

697698
Schema.User matchingUser = userIdToUser.get(log.LoggedBy__c);
699+
log.LoggedByFederationIdentifier__c = matchingUser.FederationIdentifier;
698700
log.LoggedByUsername__c = matchingUser.Username;
699701
log.ProfileName__c = matchingUser.Profile.Name;
700702
log.UserLicenseDefinitionKey__c = matchingUser.Profile.UserLicense.LicenseDefinitionKey;

nebula-logger/core/main/log-management/classes/LogHandler.cls

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
3939
this.logs = (List<Log__c>) triggerNew;
4040
this.loggerScenariosById = queryLoggerScenarios(this.logs);
4141

42-
this.setHasCommentsField();
4342
this.setClosedStatusFields();
4443
this.setOrganizationLimits();
4544
// The log OwnerId field should support being manually changed, so only auto-set it on insert
@@ -54,7 +53,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
5453
this.logs = (List<Log__c>) triggerNewMap.values();
5554
this.oldLogsById = (Map<Id, Log__c>) triggerOldMap;
5655

57-
this.setHasCommentsField();
5856
this.setClosedStatusFields();
5957
// Priority logic relies on roll-up fields, so only run on update (after log entries are inserted)
6058
this.setPriority();
@@ -68,12 +66,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
6866
this.shareLogsWithLoggingUsers();
6967
}
7068

71-
private void setHasCommentsField() {
72-
for (Log__c log : this.logs) {
73-
log.HasComments__c = String.isNotBlank(log.Comments__c);
74-
}
75-
}
76-
7769
private void setClosedStatusFields() {
7870
Map<String, LogStatus__mdt> logStatusNameToStatus = loadActiveLogStatuses();
7971
for (Log__c log : this.logs) {
@@ -222,6 +214,8 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
222214

223215
private void setCheckboxFields() {
224216
for (Log__c log : this.logs) {
217+
log.HasComments__c = log.Comments__c != null;
218+
log.HasLoggedByFederationIdentifier__c = log.LoggedByFederationIdentifier__c != null;
225219
log.HasOrganizationLimits__c = log.OrganizationLimits__c != null;
226220
}
227221
}

nebula-logger/core/main/log-management/flexipages/LogRecordPage.flexipage-meta.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,23 @@
388388
<identifier>RecordLoggedByUsernameLink__cField</identifier>
389389
</fieldInstance>
390390
</itemInstances>
391+
<itemInstances>
392+
<fieldInstance>
393+
<fieldInstanceProperties>
394+
<name>uiBehavior</name>
395+
<value>readonly</value>
396+
</fieldInstanceProperties>
397+
<fieldItem>Record.LoggedByFederationIdentifier__c</fieldItem>
398+
<identifier>RecordLoggedByFederationIdentifier_cField</identifier>
399+
<visibilityRule>
400+
<criteria>
401+
<leftValue>{!Record.HasLoggedByFederationIdentifier__c}</leftValue>
402+
<operator>EQUAL</operator>
403+
<rightValue>true</rightValue>
404+
</criteria>
405+
</visibilityRule>
406+
</fieldInstance>
407+
</itemInstances>
391408
<itemInstances>
392409
<fieldInstance>
393410
<fieldInstanceProperties>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<fullName>HasLoggedByFederationIdentifier__c</fullName>
4+
<businessStatus>Active</businessStatus>
5+
<complianceGroup>None</complianceGroup>
6+
<defaultValue>false</defaultValue>
7+
<externalId>false</externalId>
8+
<label>Has User Federation Identifier</label>
9+
<securityClassification>Confidential</securityClassification>
10+
<trackFeedHistory>false</trackFeedHistory>
11+
<trackHistory>false</trackHistory>
12+
<trackTrending>false</trackTrending>
13+
<type>Checkbox</type>
14+
</CustomField>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<fullName>LoggedByFederationIdentifier__c</fullName>
4+
<businessStatus>Active</businessStatus>
5+
<complianceGroup>PII;GDPR;CCPA</complianceGroup>
6+
<externalId>false</externalId>
7+
<label>User Federation Identifier</label>
8+
<length>512</length>
9+
<securityClassification>Confidential</securityClassification>
10+
<trackHistory>false</trackHistory>
11+
<trackTrending>false</trackTrending>
12+
<type>LongTextArea</type>
13+
<visibleLines>3</visibleLines>
14+
</CustomField>

nebula-logger/core/main/log-management/permissionsets/LoggerAdmin.permissionset-meta.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,11 @@
11911191
<field>Log__c.HasComments__c</field>
11921192
<readable>true</readable>
11931193
</fieldPermissions>
1194+
<fieldPermissions>
1195+
<editable>false</editable>
1196+
<field>Log__c.HasLoggedByFederationIdentifier__c</field>
1197+
<readable>true</readable>
1198+
</fieldPermissions>
11941199
<fieldPermissions>
11951200
<editable>false</editable>
11961201
<field>Log__c.HasOrganizationLimits__c</field>
@@ -1241,6 +1246,11 @@
12411246
<field>Log__c.LogRetentionDate__c</field>
12421247
<readable>true</readable>
12431248
</fieldPermissions>
1249+
<fieldPermissions>
1250+
<editable>false</editable>
1251+
<field>Log__c.LoggedByFederationIdentifier__c</field>
1252+
<readable>true</readable>
1253+
</fieldPermissions>
12441254
<fieldPermissions>
12451255
<editable>false</editable>
12461256
<field>Log__c.LoggedByUsernameLink__c</field>

nebula-logger/core/main/log-management/permissionsets/LoggerEndUser.permissionset-meta.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,11 @@
737737
<field>Log__c.EndTime__c</field>
738738
<readable>true</readable>
739739
</fieldPermissions>
740+
<fieldPermissions>
741+
<editable>false</editable>
742+
<field>Log__c.HasLoggedByFederationIdentifier__c</field>
743+
<readable>true</readable>
744+
</fieldPermissions>
740745
<fieldPermissions>
741746
<editable>false</editable>
742747
<field>Log__c.HasOrganizationLimits__c</field>
@@ -772,6 +777,11 @@
772777
<field>Log__c.LogRetentionDate__c</field>
773778
<readable>true</readable>
774779
</fieldPermissions>
780+
<fieldPermissions>
781+
<editable>false</editable>
782+
<field>Log__c.LoggedByFederationIdentifier__c</field>
783+
<readable>true</readable>
784+
</fieldPermissions>
775785
<fieldPermissions>
776786
<editable>false</editable>
777787
<field>Log__c.LoggedByUsernameLink__c</field>

0 commit comments

Comments
 (0)