0

I am running a couple of SOQL queriesthrough a Visualforce page. The queries simply look like:

[SELECT Id, Name, UserRoleId FROM User WHERE Id = :UserInfo.getUserId()]
[SELECT Id, Name, ParentRoleId FROM UserRole WHERE Id = :UserInfo.getUserRoleId()]

This page works fine for system administrators; however, I get an Insufficient Privileges error when I try to visit this page in a standard user context. I guess it's probably because I don't setup the access permission for the standard user profile properly, but it seems that I can't change the "Administrative Permissions" for a standard user profile. I also tried to create a new profile and check the "Manage Users" box in the "Administrative Permissions", but I was still getting the same error when I was in a context of this new profile. I wonder what configuration do I need to perform exactly to get around this privilege issue?

Thanks!

2

enter image description here but it seems that I can't change the "Administrative Permissions" for a standard user profile.

You can change settings on a custom profile and not on standard profile.

This page works fine for system administrators; however, I get an Insufficient Privileges error when I try to visit this page in a standard user context

When you create a VF page / controller you need to make sure that the page is enabled for a particular profile. On the VF page you should see a link called security.When you click on it you can see the list of profiles are enabled to view the page, add your new profile that you created and revisit the page. Also enable the profile to access the controller too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.