• joaquin-timba
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi, we have had with the new realease "Spring 09" some issues. It seems that in Spring 09 release a changed had been introduced in profile permission. You can't anymore query any field from Profile object if you had not set "view setup and configuration permission" in the profile of the user running the application.

 

This is the test I made, and here the code:

 

-Controller

public class TestProfileBug {

   
    public TestProfileBug()
    {
        User u = [Select Id, Profile.Name from User limit 1];   
    }
}

 

 

-Page

 

<apex:smileytongue:age controller="TestProfileBug" >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:smileytongue:age>

 

 

Here we go with test result.

 

With a profile without "view setup and configuration permission"

 

This error appears:

 

"No such column 'ProfileId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names."

 

With a profile with "view setup and configuration permission"  shows the page correctly.

 

My code doens't have any ProfileId, but internal salesforce's framework query this field to get the profile name.

 

Other thing is that if I save my controller and then log-in with a profile that don't have this permission all work great the first time. Then, I reload the page and the previous error appears.

 

I tried other ways to get profile name without any success. I think that this is the expected behavior, but it has to be a way that my code running under profile without this permission can query this object. I tried with System.RunAs(user) but as in previous release it seems not to be working in classes only with unit testing.

 

Any help about that will be appreciated. If possible, we would like to keep this permision away for almost all profiles for security reasons.

 

Thanks.

Joaquin

We have an application that runs in a web tab and for this one specific user we are getting this error when they click on the tab.

INVALID_FIELD: SELECT ProfileId FROM User WHERE Id = '123456ABCDEFG' ^ ERROR at Row:1:Column:8 No such column 'ProfileId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

Note: I have masked the Id, we are using a real Id not 123456ABCDEFG

I believe but cannot confirm that it is because the user does not have permission to "View Setup and Configuration"... any ideas?

Cheers!

  • September 22, 2005
  • Like
  • 0