Has anyone else experienced issues with permission based elements on visualforce when rerendering a section?
For example I have a section that for administrators will provide a link but for common users it would just display the text like so:
<apex:repeat id="myRepeat">
<apex:outpanel id="myWrapper"
<!-- If user has admin permissions -->
<apex:outputPanel rendered="{!$Permission.AdminPermission}">
<a href="/{!record.Id}" target="_blank">
<apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
</a>
</apex:outputPanel>
<!-- If user does NOT have admin permissions -->
<apex:outputPanel rendered="{!!$Permission.AdminPermission}">
<apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
</apex:outputPanel>
<!-- Input text with onchange actionFunction method -->
<apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>
<!-- Action Functions -->
<apex:actionFunction
action="{!setUnits}"
name="updateUnitsAction"
reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>
<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>
When the page first loads this works exactly as expected but then when I rerender the section that contains this portion of markup the permission that once worked (granting the link) is now false (showing just the text). If I refresh the page I again have the admin link.
Appreciate any feedback, thanks!
Edited with command button, inputtext onchange, and wrapper section markup
NOT
inside a merge field than!
especially first thing. Also better to do{!URLFOR($Action.MyObject__c.View, record.Id)}
than/{!record.Id}
.$Permission
outside the repeat using anapex:variable
tag? Might work...