调整Accessor参数
This commit is contained in:
@@ -155,7 +155,7 @@ public abstract class FlowableManager {
|
||||
throw new IllegalArgumentException("权限检查器为空");
|
||||
}
|
||||
FlowableAccessor accessor = createBean(accessorClass);
|
||||
if (!accessor.access(configuration, instance, node, action)) {
|
||||
if (!accessor.access(instance, node, action)) {
|
||||
throw new IllegalArgumentException("权限校验不通过");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.lanyuanxiaoyao.flowable.core.model;
|
||||
|
||||
import com.lanyuanxiaoyao.flowable.core.manager.FlowableConfiguration;
|
||||
|
||||
/**
|
||||
* 权限校验
|
||||
*
|
||||
@@ -9,11 +7,11 @@ import com.lanyuanxiaoyao.flowable.core.manager.FlowableConfiguration;
|
||||
* @version 20241231
|
||||
*/
|
||||
public interface FlowableAccessor {
|
||||
boolean access(FlowableConfiguration configuration, FlowableInstance instance, FlowableNode node, FlowableAction action);
|
||||
boolean access(FlowableInstance instance, FlowableNode node, FlowableAction action);
|
||||
|
||||
class DefaultFlowableAccessor implements FlowableAccessor {
|
||||
@Override
|
||||
public boolean access(FlowableConfiguration configuration, FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||
public boolean access(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.lanyuanxiaoyao.flowable.test.accessor;
|
||||
|
||||
import com.lanyuanxiaoyao.flowable.core.manager.FlowableConfiguration;
|
||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableAccessor;
|
||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||
@@ -15,7 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class RoleCheckAccessor implements FlowableAccessor {
|
||||
@Override
|
||||
public boolean access(FlowableConfiguration configuration, FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||
public boolean access(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||
FlowableMetadata metadata = instance.getMetadata();
|
||||
return metadata.containsKey("role");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user