从事务更新 Hyperledger ACL
Update Hyperledger ACL from transactions
我有 User
和 Buyer
网络参与者。通常,买家不能 READ
用户的数据,但我想进行 GrantAccess
和 RevokeAccess
交易,以便 User
可以选择授予和撤销 READ
从 Buyer
s
访问
我还没有找到任何有关如何执行此操作的信息,希望得到任何帮助。
你会 运行 一个 'tx_GrantAccess' 交易,首先,更新特定 BUYER 的记录(例如 id buyer123 - 参与者使用名为的字段建模access
,本次交易设置为true
)。
我可以在目标 BUYER 记录(资源)上使用条件匹配(作为布尔值),如果 BUYER,比如 buyer123(即正在访问业务网络)有access=true
然后他可以读取 USER 记录。
交易规则(User
需要访问交易 类)
rule rule_1 {
description: "grant access to User, for the 2 x Transactions themselves"
participant: "org.acme.example.User"
operation: CREATE
resource: "org.acme.example.tx_*"
action: ALLOW
}
用户访问规则:
rule rule_2 {
description: "if granted access, allow READ of User by buyer"
participant(m): "org.acme.example.Buyer"
operation: READ
resource(v): "org.acme.example.User"
condition: (m.access)
action: ALLOW
}
其中 Buyer
有一个字段(例如
participant Buyer identified by id {
o String id
o Boolean access default=false
}
并且您的交易 tx_GrantAccess
具有将特定买家记录上的 access
设置为 true 并且 tx_RevokeAccess
将其设置为 false 等的功能。
我有 User
和 Buyer
网络参与者。通常,买家不能 READ
用户的数据,但我想进行 GrantAccess
和 RevokeAccess
交易,以便 User
可以选择授予和撤销 READ
从 Buyer
s
我还没有找到任何有关如何执行此操作的信息,希望得到任何帮助。
你会 运行 一个 'tx_GrantAccess' 交易,首先,更新特定 BUYER 的记录(例如 id buyer123 - 参与者使用名为的字段建模access
,本次交易设置为true
)。
我可以在目标 BUYER 记录(资源)上使用条件匹配(作为布尔值),如果 BUYER,比如 buyer123(即正在访问业务网络)有access=true
然后他可以读取 USER 记录。
交易规则(User
需要访问交易 类)
rule rule_1 {
description: "grant access to User, for the 2 x Transactions themselves"
participant: "org.acme.example.User"
operation: CREATE
resource: "org.acme.example.tx_*"
action: ALLOW
}
用户访问规则:
rule rule_2 {
description: "if granted access, allow READ of User by buyer"
participant(m): "org.acme.example.Buyer"
operation: READ
resource(v): "org.acme.example.User"
condition: (m.access)
action: ALLOW
}
其中 Buyer
有一个字段(例如
participant Buyer identified by id {
o String id
o Boolean access default=false
}
并且您的交易 tx_GrantAccess
具有将特定买家记录上的 access
设置为 true 并且 tx_RevokeAccess
将其设置为 false 等的功能。