You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/02/22 23:24:31 UTC
svn commit: r510693 - in /myfaces/tobago/trunk/contrib/security/src/main:
java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java
java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java
resources/META-INF/faces-config.xml
Author: bommel
Date: Thu Feb 22 14:24:30 2007
New Revision: 510693
URL: http://svn.apache.org/viewvc?view=rev&rev=510693
Log:
(TOBAGO-264) A markup attribute for button would be nice
(TOBAGO-289) markup attribute for link component
Added:
myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java
myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java
Modified:
myfaces/tobago/trunk/contrib/security/src/main/resources/META-INF/faces-config.xml
Added: myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java?view=auto&rev=510693
==============================================================================
--- myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java (added)
+++ myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredButtonCommand.java Thu Feb 22 14:24:30 2007
@@ -0,0 +1,36 @@
+package org.apache.myfaces.tobago.security;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.component.UIButtonCommand;
+
+import javax.faces.context.FacesContext;
+
+public class UISecuredButtonCommand extends UIButtonCommand {
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SecuredButtonCommand";
+
+ public boolean isDisabled() {
+ if (getAction() instanceof CheckAuthorisationMethodBinding) {
+ return !((CheckAuthorisationMethodBinding) getAction()).isAuthorized(FacesContext.getCurrentInstance())
+ || super.isDisabled();
+ }
+ return super.isDisabled();
+ }
+
+}
Added: myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java?view=auto&rev=510693
==============================================================================
--- myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java (added)
+++ myfaces/tobago/trunk/contrib/security/src/main/java/org/apache/myfaces/tobago/security/UISecuredLinkCommand.java Thu Feb 22 14:24:30 2007
@@ -0,0 +1,35 @@
+package org.apache.myfaces.tobago.security;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.component.UILinkCommand;
+
+import javax.faces.context.FacesContext;
+
+public class UISecuredLinkCommand extends UILinkCommand {
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SecuredLinkCommand";
+
+ public boolean isDisabled() {
+ if (getAction() instanceof CheckAuthorisationMethodBinding) {
+ return !((CheckAuthorisationMethodBinding) getAction()).isAuthorized(FacesContext.getCurrentInstance())
+ || super.isDisabled();
+ }
+ return super.isDisabled();
+ }
+}
Modified: myfaces/tobago/trunk/contrib/security/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/security/src/main/resources/META-INF/faces-config.xml?view=diff&rev=510693&r1=510692&r2=510693
==============================================================================
--- myfaces/tobago/trunk/contrib/security/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/contrib/security/src/main/resources/META-INF/faces-config.xml Thu Feb 22 14:24:30 2007
@@ -30,4 +30,14 @@
<component-class>org.apache.myfaces.tobago.security.UISecuredCommand</component-class>
</component>
+ <component>
+ <component-type>org.apache.myfaces.tobago.LinkCommand</component-type>
+ <component-class>org.apache.myfaces.tobago.security.UISecuredLinkCommand</component-class>
+ </component>
+
+ <component>
+ <component-type>org.apache.myfaces.tobago.ButtonCommand</component-type>
+ <component-class>org.apache.myfaces.tobago.security.UISecuredButtonCommand</component-class>
+ </component>
+
</faces-config>