Yeah your pseudo code is pretty much all you can do. But its not
really securing the client side.. its more like displaying a clean
user interface where a user dont see UI elements he actually cant use
because of some missing permissions. An attacker will always have all
UI elements.
Our UserRole object just holds a list of unique Strings, one for each
permission the user role is allowed to do. When a presenter gets
active it sends an array of permissions that are needed by the
persenters display to secure this display to the server. The server
then checks this array against the logged in user account and its
roles and returns a boolean array with true, false for each permission
it has checked (in the same order).
Then we call display.secure(checkedPermissions[1],
checkedPermissions[2], ...) and the display hides/adds/removes UI
elements. So each Display that needs to be secured has a secure
method, e.g. secure(boolean hasEditPermission, boolean
hasDeletePermission, boolean hasCreatePermission). The Presenter then
asks the server to check edit, delete and create permissions for a
given user/role so that it can call the secure method with the correct
values. If a display is more complex, we have much more parameters in
our secure method.