PermissionCheckController Salesforce
public with sharing class PermissionCheckController {
@AuraEnabled(cacheable=true)
public static Boolean hasEditPermission(String permissionSetName) {
// Get the User ID
Id userId = UserInfo.getUserId();
// Query the PermissionSetAssignment object
PermissionSetAssignment psa = [
SELECT Id
FROM PermissionSetAssignment
WHERE AssigneeId = :userId
AND PermissionSet.Name = :permissionSetName
LIMIT 1
];
return psa != null;
}
}
PermissionCheckController Salesforce
Reviewed by dasfrogpractice
on
07:09
Rating:
No comments: