hudec117 / sf-user-perm-report

Salesforce User Permission Report allows you to see a report of all the permissions a user has and where they are set.
MIT License
10 stars 2 forks source link

Permission Set Group Issue #39

Closed grahampcurran closed 2 years ago

grahampcurran commented 3 years ago

Hi there, I am getting the following error when trying to run the permissions report in Production: Uncaught (in promise) TypeError: Cannot read property 'Name' of null at B.getPermissionSetNames (build.js:2) at async i.runReport (build.js:2) at chrome-extension://gkibdicghcpcikhjpgjoijpobdipklnp/public/async chrome-extension:/gkibdicghcpcikhjpgjoijpobdipklnp/build.js:2 The User has permission sets and a permission set group assigned.

hudec117 commented 3 years ago

Hello @grahampcurran, could you please run:

SELECT PermissionSet.Name, PermissionSet.Type FROM PermissionSetAssignment WHERE AssigneeId = 'USERID' AND PermissionSet.IsOwnedByProfile = false

Where "USERID" is the ID of the user you are trying to open the report for. Please censor anything confidential.

grahampcurran commented 3 years ago

Hey, see below 2021-04-26 16_07_20-Developer Console

hudec117 commented 3 years ago

And then if you run:

SELECT PermissionSet.Name FROM PermissionSetGroupComponent WHERE PermissionSetGroup.DeveloperName = 'CPQ_Standard_User'

This will allow me to see what data the code is working with.

grahampcurran commented 3 years ago

Sure. There is a (null PermissionSet) in there which is quite odd. Probably the source of the issue. Ill have a look at that on my side. 2021-04-27 13_04_31-Developer Console

hudec117 commented 3 years ago

Looks like the 3rd from bottom is the issue, I should probably add an additional condition to filter it out.

SELECT PermissionSet.Name, PermissionSet.Type, PermissionSet.IsOwnedByProfile FROM PermissionSetGroupComponent WHERE PermissionSetGroup.DeveloperName = 'CPQ_Standard_User'

Sorry I keep asking you to run queries, this should be the last one. I added 2 more fields and I expected PermissionSet.Type or Permissionset.IsOwnedByProfile to be usable on filtering out the "(null PermissionSet)"

hudec117 commented 3 years ago

Looks like this is due to a muting permission set in the permission set group. In the query it shows up as an empty PermissionSet.Name. I have added a fix and will put it in the 1.2.1 release.

grahampcurran commented 3 years ago

hey sorry for the delay. See below. Hope thats in line with your thinking 2021-05-02 12_51_09-Window

hudec117 commented 3 years ago

Thanks! That confirms my suspicion, it's the muting permission set that causes the trouble, I've patched it and include it in a hotfix release.

hudec117 commented 2 years ago

@grahampcurran I appreciate it has been nearly a year, but I've released a fix for this now haha. I'm going to close this as fixed.