1 /*
2 * Apache License
3 * Version 2.0, January 2004
4 * http://www.apache.org/licenses/
5 *
6 * Copyright 2008 by chenillekit.org
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 */
14
15 package org.chenillekit.access.annotations;
16
17 import java.lang.annotation.Documented;
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
22
23 /**
24 * Annotation to hold role weight and/or group names the user
25 * must fulfill in his profile to access a restricted page.
26 *
27 * @version $Id: Restricted.java 333 2008-11-19 16:26:03Z mlusetti $
28 */
29 @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
30 @Retention(RetentionPolicy.RUNTIME)
31 @Documented
32 public @interface Restricted
33 {
34 /**
35 * @return the <em>minimum</em> role weight a user should own
36 */
37 int role() default 0;
38
39 /**
40 * @return the groups names (or ids if you like) a user should be listed in
41 */
42 String[] groups() default {};
43 }