Like any code, there are probably a thousand ways to go about this. What I have here is the most fundamental method.
If you are using sessions or polling the database before the page is built you can probably build the page with the functions based on the users privlidges. I presume that when you say 'role' you are referring to their access rights such as superuser, admin, user, or guest.
The complexity of your code will also be defined by how your roles are labeled (numerically or alphanumerically) such as Superuser = 4 or Superuser = superuser. This is an example using ASP and VBScript and you could probably reduce this code dramatically.
For Sessions:
<%
' Key references
'
' Superuser = 4
' Admin = 3
' User = 2
' Guest = 1
%>
<% If Session("role") = 4 Then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="button1" type="button" value="button1"></td>
<td><input name="button2" type="button" value="button2"></td>
<td><input name="button3" type="button" value="button3"></td>
<td><input name="button4" type="button" value="button4"></td>
</tr>
</table>
<% ElseIf Session("role") = 3 Then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="button5" type="button" value="button5"></td>
<td><input name="button6" type="button" value="button6"></td>
<td><input name="button7" type="button" value="button7"></td>
<td><input name="button8" type="button" value="button8"></td>
</tr>
</table>
<% End If %>
For DB, just change your If and ElseIf statements to reflect the fields in question:
<% If (rsGET.Fields.Item("role").Value) = 4 Then %>
<% ElseIf (rsGET.Fields.Item("role").Value) = 3 Then %>
The code above will display a table with functions based on privlidges (role) of the user. Its not limited to buttons, in fact you can use anything you want. What the code actually does is display a TABLE based on a value.
Since it is ASP (server side) the page will only be built with the allowed table/functions and not reveal any others or how they work. Again, this code could be dumbed down even further but you should get the general idea.
I hope I am on the right track and this helps.