mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-09 06:32:43 +08:00
missing defaults for annotation
This commit is contained in:
parent
b50f3e7b8e
commit
04ca082688
@ -3,23 +3,53 @@ package io.papermc.hangar.security.annotations.permission;
|
||||
import io.papermc.hangar.model.common.NamedPermission;
|
||||
import io.papermc.hangar.model.common.PermissionType;
|
||||
import io.papermc.hangar.security.annotations.permission.PermissionRequired.List;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Mark a method or class to require permissions
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Repeatable(List.class)
|
||||
@Documented
|
||||
public @interface PermissionRequired {
|
||||
|
||||
/**
|
||||
* Permissions required
|
||||
*/
|
||||
@AliasFor("perms")
|
||||
NamedPermission[] value() default {};
|
||||
|
||||
/**
|
||||
* Type of permissions required
|
||||
*/
|
||||
PermissionType type() default PermissionType.GLOBAL;
|
||||
NamedPermission[] perms();
|
||||
|
||||
/**
|
||||
* Permissions required
|
||||
*/
|
||||
@AliasFor("value")
|
||||
NamedPermission[] perms() default {};
|
||||
|
||||
/**
|
||||
* Method arguments to use when querying permissions
|
||||
* <br>
|
||||
* <b>Only used for {@link PermissionType#PROJECT} or {@link PermissionType#ORGANIZATION}</b>
|
||||
* <br>
|
||||
* The length of the SpEL array <b>must</b> match the type;
|
||||
*/
|
||||
String args() default "{}";
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@interface List {
|
||||
PermissionRequired[] value();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user