Tag Archives: VF Page Access

Check User Access Permission To Visualforce Page In Apex

Sample Code:

List<SetupEntityAccess> seaList = [SELECT Id, Parent.Name, Parent.Profile.Name, Parent.Profile.Id FROM SetupEntityAccess
                                   WHERE Parent.Profile.Id = :UserInfo.getProfileId() AND SetupEntityId IN
                                   (SELECT Id FROM ApexPage WHERE Name = :your_VF_page AND NamespacePrefix = :your_namespace)];

if(!seaList.isEmpty()){
    //Login user have access to given VF page
}else{
    //login user don't have access to given VF page
}