I have created a custom settings object with two fields. I have also created a Apex controller , and a Visual Force Page to update/edit the custom settings. As a system administrator I can edit the custom settings using that form. But when I login as a standard user the form fields are not showing up. I can't add custom setting even through Setup->Develop->CustomSettings and clicking on manage, when I am logged in as standard user. I have made both my controller and Visual force page permissions to be accesible by any one.
Below is my controller code,
public class XYZSettingsController
{
public XYZSettings__c mySettings {get; set;}
public XYZSettings__c myOrgSettings{get; set;}
public XYZSettingsController()
{
mySettings = XYZSettings__c.getValues(System.Userinfo.getUserId());
myOrgSettings = XYZSettings__c.getInstance();
if(mySettings == null)
{
mySettings = new XYZSettings__c(SetupOwnerId=System.Userinfo.getUserId());
}
}
public String getOrgUrl()
{
return myOrgSettings.XYZ_Url__c;
}
public String getOrgEmail()
{
return myOrgSettings.XYZ_Email__c;
}
public String getUrl()
{
return mySettings.XYZ_Url__c;
}
public String getEmail()
{
return mySettings.XYZ_Email__c;
}
public PageReference save() {
if(mySettings.id == null){
upsert mySettings;
}
else{
update mySettings;
}
return null;
}
}
And below is my Visual Force page,
<apex:page Controller="XYZSettingsController" title="Edit XYZ access settings">
<apex:form >
<apex:pagemessage severity="info" strength="1">
Your default XYZ platform url is: {!OrgUrl} and Email is: {!OrgEmail}
<br></br>
You can override it in the settings below
</apex:pagemessage>
<apex:pageBlock title="Edit XYZ settings" mode="edit">
<apex:commandButton action="{!save}" value="Save"/>
<apex:pageBlockSection columns="2">
<apex:inputField value="{!mySettings.XYZ_Url__c}"/>
<apex:inputField value="{!mySettings.XYZ_Email__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Any clues?
I just ran across this issue and answered it over on Salesforce. Refer to my answer there for a work around. https://salesforce.stackexchange.com/questions/28329/giving-users-access-to-a-specific-custom-setting-without-granting-them-customize/45079#45079