You need to sign in to do that
Don't have an account?

How to know the Logged in user accessing visualforce page is Admin or not
How to know the Logged in user accessing visualforce page is Admin or not using apex. i want to do this using my custom controller .i know in visualforce we can do like this $Profile.Name =='System Administrator' but how to accomplish it in apex code ??
public class GetProfile {
List<Profile> PROFILE = [SELECT Id, Name FROM Profile WHERE Id=:userinfo.getProfileId() LIMIT 1];
if(PROFILE.get(0).name == 'System Administrator') {
// Do your work
}
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks