001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.authroles.authorization.strategies.role.annotations;
018
019import java.lang.annotation.Documented;
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Inherited;
022import java.lang.annotation.Retention;
023import java.lang.annotation.RetentionPolicy;
024import java.lang.annotation.Target;
025
026/**
027 * A mapping of 1..n roles to an action. This annotions must be embedded in the
028 * {@link AuthorizeActions} annotation.
029 * 
030 * @see org.apache.wicket.authorization.IAuthorizationStrategy
031 * @see AnnotationsRoleAuthorizationStrategy
032 * @see AuthorizeActions
033 * @see AuthorizeInstantiation
034 * 
035 * @author Eelco Hillenius
036 */
037@Retention(RetentionPolicy.RUNTIME)
038@Target({ ElementType.PACKAGE, ElementType.TYPE })
039@Documented
040@Inherited
041public @interface AuthorizeAction {
042
043        /**
044         * The action that is allowed. The default actions that are supported by Wicket are
045         * <code>RENDER</code> and <code>ENABLE<code> as defined as constants
046         * of {@link org.apache.wicket.Component}.
047         * 
048         * @see org.apache.wicket.Component#RENDER
049         * @see org.apache.wicket.Component#ENABLE
050         * 
051         * @return the action that is allowed
052         */
053        String action();
054
055        /**
056         * The roles for this action.
057         * 
058         * @return the roles for this action. The default is an empty string (annotations do not allow
059         *         null default values)
060         */
061        String[] roles() default { };
062
063        /**
064         * The roles to deny for this action.
065         * 
066         * @return the roles to deny for this action. The default is an empty string (annotations do not
067         *         allow null default values)
068         */
069        String[] deny() default { };
070}