Update of /var/cvs/contributions/didactor2/src/core/java/nl/didactor/taglib
In directory james.mmbase.org:/tmp/cvs-serv30227

Modified Files:
        MayTag.java 
Log Message:
cleaned up a  bit


See also: 
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/core/java/nl/didactor/taglib


Index: MayTag.java
===================================================================
RCS file: 
/var/cvs/contributions/didactor2/src/core/java/nl/didactor/taglib/MayTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- MayTag.java 21 Jan 2008 17:31:53 -0000      1.4
+++ MayTag.java 21 Jan 2008 18:32:46 -0000      1.5
@@ -21,11 +21,12 @@
  * MayTag: retrieve a security privilege for a component
  * @author Johannes Verelst <[EMAIL PROTECTED]>
  */
-public class MayTag extends CloudReferrerTag {
+public class MayTag extends CloudReferrerTag implements Condition {
     private static final Logger log = Logging.getLoggerInstance(MayTag.class);
     private Attribute component = Attribute.NULL;
     private Attribute  action   = Attribute.NULL;
     private Attribute referids =  Attribute.NULL;
+    private Attribute inverse =  Attribute.NULL;
 
     /**
      * Set the value for the 'component' argument of the May tag
@@ -44,12 +45,13 @@
     }
 
     /**
-     * Set the value for the 'arguments' argument of the May tag, Comma 
seperated.
-     * @param arguments Optional arguments
      */
     public void setReferids(String arguments) throws JspTagException {
         this.referids = getAttribute(arguments);
     }
+    public void setInverse(String i) throws JspTagException {
+        this.inverse = getAttribute(i);
+    }
 
     /**
      * Decide whether or not the body of the tag should be executed, based on:
@@ -81,22 +83,13 @@
             String key = (String) entry.getKey();
             params.set(key, entry.getValue());
         }
-        try {
+        log.debug("Checking " + a + " with " + params);
             value = comp.may(getCloudVar(), a, params);
-        } catch (IllegalArgumentException e) {
-            throw new JspTagException(e.getMessage());
-        }
 
-        if (value[0]) {
+        if (value[0] != inverse.getBoolean(this, false)) {
             return EVAL_BODY;
         } else {
-            try {
-                pageContext.getOut().print( "<h1>Permission denied!</h1>");
                 return SKIP_BODY;
-            } catch (java.io.IOException e) {
-                throw new TaglibException(e.getMessage(), e);
-            }
-
         }
     }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to