假设我分别创建两个参与者类型A和B,以及一个只能由参与者类型B或admin执行的事务X。
此外,我添加了一些权限规则,即只能由管理员或其他类型为A的其他参与者创建/更新参与者A。
现在,我在事务X中的逻辑要求创建/更新参与者A。因此,如果我使用参与者B注册中心ID之一执行事务X,它是否能够创建/更新参与者A?
如果不是,那么有什么办法吗?
答案 0 :(得分:2)
如果我正确理解了您的要求,那么这些规则应该适用于您想要的核心内容: (此示例使用默认的基本样本网络)
rule BforX {
description: "Allow B access to transaction X"
participant: "org.example.basic.SampleParticipantB"
operation: READ, CREATE, UPDATE
resource: "org.example.basic.SampleTransactionX"
action: ALLOW
}
rule BforAinX {
description: "Allow B access to A whilst in X"
participant: "org.example.basic.SampleParticipantB"
operation: READ, CREATE, UPDATE
resource: "org.example.basic.SampleParticipantA"
transaction: "org.example.basic.SampleTransactionX"
action: ALLOW
}
rule NotAforX {
description: "Deny A access to transaction X"
participant: "org.example.basic.SampleParticipantA"
operation: ALL
resource: "org.example.basic.SampleTransactionX"
action: DENY
}
rule AforA {
description: "Allow A access to Participant_A"
participant: "org.example.basic.SampleParticipantA"
operation: READ, CREATE, UPDATE
resource: "org.example.basic.SampleParticipantA"
action: ALLOW
}