0

I have two questions:

  1. How to get all Permission Sets' Name/Label?

  2. How to know the Security setting in a name-knowed Permission Set?

Scenario:

For audit reason, I have to retrieve Object/Field read/edit Security, programatically.

Regular Security Setting/Profile, could be retrieve via sqol as:

SELECT ID, SObjectType, ParentId, PermissionsCreate , PermissionsEdit, PermissionsDelete
    From ObjectPermissions
    where SObjectType = 'Account'
            AND ParentId IN ( Select id 
                    FROM PermissionSet
                    WHERE PermissionSet.Profile.Name = 'System Administrator' )

And I've learned Permission sets are related to an user via PermissionSetAssignment.

Such as:

SELECT PermissionSet.Name, Assignee.Id, Assignee.Name, Assignee.ProfileId
        FROM PermissionSetAssignment
        ORDER BY PermissionSet.Name

But I don't know how to combined these soql to get security setting in a permission set.

Please help!

0

I am not very sure about what you are asking due to your explanation. But,

How to get all Permission Sets' Name?

Use this query:

Select Id, Name From PermissionSet

How to know the Security setting in a name-knowed Permission Set?

Use something like:

SELECT ID, SObjectType, ParentId, PermissionsCreate , PermissionsEdit, PermissionsDelete
    From ObjectPermissions
    where SObjectType = 'Account'
            AND ParentId IN ( Select id 
                    FROM PermissionSet
                    WHERE PermissionSet.Name = 'XXX' )

Judging by your description, if you know the assignee's Id and want to find out the related permission set's permission:

SELECT ID, SObjectType, ParentId, PermissionsCreate , PermissionsEdit, PermissionsDelete
    From ObjectPermissions
    where SObjectType = 'Account'
            AND ParentId IN ( Select PermissionSetId 
                    FROM PermissionSetAssignment
                    WHERE Assignee.Id = 'XXX' )
  • Thank you for your quick reply! The first soql is really useful once I've add Lable in it: Select Id, Name, Label From PermissionSet – 陳紅狼 Jun 3 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.