Groovy Documentation

griffon.plugins.shiro.annotation
[Java] Annotation Type RequiresPermissions

java.lang.Object
  griffon.plugins.shiro.annotation.RequiresPermissions

@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface RequiresPermissions

Requires the current executor's Subject to imply a particular permission in order to execute the annotated method. If the executor's associated org.apache.shiro.subject.Subject determines that the executor does not imply the specified permission, the method will not be executed.

For example, this declaration:

@RequiresPermissions( {"file:read", "write:aFile.txt"} )
void someMethod();

indicates the current user must be able to both read and write to the file aFile.txt in order for the someMethod() to execute, otherwise an org.apache.shiro.authz.AuthorizationException will be thrown.

See Also:
org.apache.shiro.subject.Subject#checkPermission


Required Element Summary
java.lang.String value

The permission string which will be passed to org.apache.shiro.subject.Subject#isPermitted(String) to determine if the user is allowed to invoke the code protected by this annotation.

 
Optional Element Summary
null logical

The logical operation for the permission checks in case multiple roles are specified.

 
Method Summary
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Element Detail

logical

public Logical logical
The logical operation for the permission checks in case multiple roles are specified. AND is the default @default Logical.AND
Since:
1.1.0


value

public String[] value
The permission string which will be passed to org.apache.shiro.subject.Subject#isPermitted(String) to determine if the user is allowed to invoke the code protected by this annotation.


 

Groovy Documentation