You need to sign in to do that
Don't have an account?
SBK
Access to User object in a Custom Controller
I am new to this environment.
I am developing a Site and have enabled user registration and authentication for a user.
I have to develop a controller with some of my custom objects I have created for the site. I need
access to the User object (not the standard 'Account' object). I am not sure if I should develop
a custom controller or extend a standard controller to get the user attributes.
In any case how can I access the User object for the site in my controller?
Thanks,
I think what you're asking is:
"If I use a custom controller for my Visualforce page, can I make my visualforce page only accessible to portal users and not anonymous Sites users?"
The answer is yes, what you need to do is make sure that the Visualforce page is NOT enabled for the Site and that it is enabled for the portal profile.
All Answers
I got the answer for my first question - "UserInfo".
So my question now is should I implement a custom controller or extend a standard controller?
If I develop a custom controller will I still get the benefits like authentication etc in my custom
controller?
Thanks.
I think what you're asking is:
"If I use a custom controller for my Visualforce page, can I make my visualforce page only accessible to portal users and not anonymous Sites users?"
The answer is yes, what you need to do is make sure that the Visualforce page is NOT enabled for the Site and that it is enabled for the portal profile.
Thanks Ryan, I have a related question as I am unable to view a custom object on a visualforce page rendered
by a custom controller.
I made sure the visualforce page (say MyPage) is no longer enabled for the site.
When I went to edit the profile (Customer Portal Manager), in the "Custom Object Permissions" tab my custom object shows up but is not editable for "Basic Access". In short how do I enable my custom objects and pages for my site
profile (Customer Portal Manager). Any help or links in this regard would be appreciated.
Thanks
Looks like you have to clone it and then make the changes.
I might have answered my own question.
Yes, you stumbled upon one of the many nuances of Salesforce. The standard profiles aren't very customizable, you have to clone them if you want full customization.