Salesforce Permissions assigned to an user are stored in Permission Sets and Profiles. Profile and Permission Ses assigned to an user are stored in PermissionSetAssignment object/entity. So, by querying these two objects, we can figure out if an user have a specific Salesforce Permission.
Remote Media for Virtual Desktop
Sample SOQL for Profile:
SELECT Id, Name, PermissionsRemoteMediaVirtualDesktop FROM Profile WHERE Id IN ( SELECT ProfileId FROM User WHERE Id = '0053t00000AG695AAD' )
SELECT Id, Name, PermissionsRemoteMediaVirtualDesktop FROM PermissionSet WHERE Id IN ( SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '005Hs00000CaRBfIAN' ) AND PermissionsRemoteMediaVirtualDesktop = true
In the above example, I am trying to find whether the user have “Remote Media for Virtual Desktop” permission assigned to them.