click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From med...@apache.org
Subject svn commit: r792044 - /incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java
Date Wed, 08 Jul 2009 06:09:34 GMT
Author: medgar
Date: Wed Jul  8 06:09:34 2009
New Revision: 792044

URL: http://svn.apache.org/viewvc?rev=792044&view=rev
Log:
improve accessController checks and Javadoc

Modified:
    incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java?rev=792044&r1=792043&r2=792044&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java Wed Jul
 8 06:09:34 2009
@@ -269,12 +269,18 @@
 
     /**
      * Create a new Menu instance.
+     * <p/>
+     * Please ensure you have defined a menu {@link #accessController} if the
+     * menu's {@link #isUserInRoles()} method is going to be called.
      */
     public Menu() {
     }
 
     /**
      * Create a new Menu instance with the given name.
+     * <p/>
+     * Please ensure you have defined a menu {@link #accessController} if the
+     * menu's {@link #isUserInRoles()} method is going to be called.
      *
      * @param name the name of the menu
      */
@@ -610,6 +616,11 @@
      * @return true if the user is in one of the menu roles, or false otherwise
      */
     public boolean isUserInRoles() {
+        if (getAccessController() == null) {
+            String msg = "Menu accessController has not been defined";
+            throw new IllegalStateException(msg);
+        }
+
         HttpServletRequest request = getContext().getRequest();
 
         for (int i = 0, size = getRoles().size(); i < size; i++) {



Mime
View raw message