Go to that visualforce page under setup-->click on security settings of that vf page -->enable the profile access for which you want to give access to vf page
Yes we can check whether login user have access to the specific page.following is the code which show. whether login user have access to given page.
List < SetupEntityAccess> SEA =[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 = 'Given Page name' AND NamespacePrefix = null)]; if(SEA.isEmpty()){ //Login user do not have access to given page }else{ //login user have access to given page }
you can't achive this at user level....you can check with the profile...
how would check if the profile has access in code?
Hi Scott,
Go to that visualforce page under setup-->click on security settings of that vf page -->enable the profile access for which you want to give access to vf page
Yes, but I want to check if the running profile has access to an unknown page before I send the user there.
class sudo{
public pageReference myAction() {
//do something
if(user has access to page)
return user_configured_page
else
return other_page
}
}
u can check the profile check in the page level itself....
like {!$profile.name} == 'system admin'... then only you can process.....
No, that can be found through Apex.
The only way is through what kiran has mentioned.
Did anyone get the solution? please reply
Hi did you get the solution to this problem i am also having same issue.
Yes we can check whether login user have access to the specific page.following is the code which show. whether login user have access to given page.
List < SetupEntityAccess> SEA =[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 = 'Given Page name' AND NamespacePrefix = null)];
if(SEA.isEmpty()){
//Login user do not have access to given page
}else{
//login user have access to given page
}
Hope it will be helpful to you.
Thanks
Khillan Singh