* @return true if the user is allowed to execute the method.
*/
protected boolean hasMethodAccess(String methodName, Class permissionClass, String action, Panel panel) {
try {
Method instanceCreator = permissionClass.getMethod("newInstance", new Class[]{Object.class, String.class});
Permission perm = (Permission) instanceCreator.invoke(null, new Object[]{getResourceForPermission(permissionClass, action, panel), action});
return UserStatus.lookup().hasPermission(perm);
} catch (NoSuchMethodException e) {
log.error("Error checking permission " + permissionClass.getName() + "[" + action + "] for method " + methodName + ":", e);
} catch (IllegalAccessException e) {
log.error("Error checking permission " + permissionClass.getName() + "[" + action + "] for method " + methodName + ":", e);