missing defaults for annotation

This commit is contained in:
Jake Potrebic 2021-04-06 16:20:57 -07:00
parent b50f3e7b8e
commit 04ca082688
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8

View File

@ -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();
}