I want to do the following:
I have a webpart and two users (not in groups, though, because for a reason I don't understand there are no groups in the productive environment here ;) ).
One stands for the "attendee". This user(s) has read permissions to the sitecollection i'm creating atm.
The other one stands for the "editor". This user(s) has contribute permissions.
Now I have a visual webpart on top of the DispForm of a custom list which shows the attendee a button (for simplicity). Everything the attendee could do is done with runwithelevatedprivileges-method, so he has only read-rights, even though he could do some actions. Apart from that, I'm calling my method (let's call it GetAttendeeView) to get the button in page_load.
Now I want to show my editors another button with custom action behind. I want to do it based on the permission level in page_load. So if user has read-permissions, show this button, if user has contribute-permission, show that button.
So my questions are:
1) Is there a Sharepoint-method I can use? I just found this: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.checkpermissions.aspx (checkpermissions) but its not giving me a bool-value to check, it throws an exception. Apart from that it's on List-Level. I think it is possible to use it, but it seems to me there shall be a better solution.
2) Is there a better way to check the user (it's the web.currentUser btw.) and show the buttons depending on permissions apart from checking it every time the page loads in page_load? I think this may cause a possible slow-down?!