mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-21 18:02:48 +08:00
新增isApiSupport,用于判断是否为api支持
This commit is contained in:
@@ -17,7 +17,13 @@ public interface AuthorizeValidatorConfig {
|
||||
AuthorizeValidatorConfig setMod(Authorize.MOD mod);
|
||||
|
||||
AuthorizeValidatorConfig addExpression(String expression, String language);
|
||||
|
||||
AuthorizeValidatorConfig setApiSupport(boolean apiSupport);
|
||||
|
||||
boolean isApiSupport();
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
default AuthorizeValidatorConfig addAnnotation(Set<Authorize> authorizes) {
|
||||
Set<String> modules = new LinkedHashSet<>();
|
||||
Set<String> roles = new LinkedHashSet<>();
|
||||
@@ -28,6 +34,7 @@ public interface AuthorizeValidatorConfig {
|
||||
actions.addAll(Arrays.asList(tmp.action()));
|
||||
setMod(tmp.mod());
|
||||
addExpression(tmp.expression(), tmp.expressionLanguage());
|
||||
setApiSupport(tmp.api());
|
||||
});
|
||||
setActions(actions).setModules(modules).setRoles(roles);
|
||||
return this;
|
||||
|
||||
@@ -20,6 +20,13 @@ public class SimpleAuthorizeValidatorConfig implements AuthorizeValidatorConfig
|
||||
protected Set<String> actions;
|
||||
protected Set<Expression> expressions = new LinkedHashSet<>();
|
||||
protected Authorize.MOD mod;
|
||||
protected boolean apiSupport;
|
||||
|
||||
@Override
|
||||
public AuthorizeValidatorConfig setApiSupport(boolean apiSupport) {
|
||||
this.apiSupport = apiSupport;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthorizeValidatorConfig setModules(Set<String> modules) {
|
||||
@@ -84,6 +91,10 @@ public class SimpleAuthorizeValidatorConfig implements AuthorizeValidatorConfig
|
||||
return expressions;
|
||||
}
|
||||
|
||||
public boolean isApiSupport() {
|
||||
return apiSupport;
|
||||
}
|
||||
|
||||
public void setExpressions(Set<Expression> expressions) {
|
||||
this.expressions = expressions;
|
||||
}
|
||||
@@ -94,7 +105,7 @@ public class SimpleAuthorizeValidatorConfig implements AuthorizeValidatorConfig
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return getModules().isEmpty() && getRoles().isEmpty() && getExpressions().isEmpty();
|
||||
return getModules().isEmpty() && getRoles().isEmpty() && getExpressions().isEmpty();
|
||||
}
|
||||
|
||||
public static class Expression {
|
||||
|
||||
Reference in New Issue
Block a user