首页 > 解决方案 > Hyperledger Composer - NetworkAdmin#admin 对网络没有读取权限

问题描述

按照本教程https://medium.freecodecamp.org/how-to-build-a-blockchain-network-using-hyperledger-fabric-and-composer-e06644ff801d

当我使用命令时:

composer network start --networkName my-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file my-network-admin.card

我成功创建了卡并使用以下命令将其导入:

composer card import --file my-network-admin.card

但是,问题在于使用以下命令:

composer network ping --card admin@my-network

我收到以下错误:

交易返回失败:AccessException:参与者'org.hyperledger.composer.system.NetworkAdmin#admin'没有对资源'org.hyperledger.composer.system.Network#my-network@0.0.1'命令的'READ'访问权限失败的

我查看了文档并尝试重新启动整个过程几次但无济于事。我什至尝试将以下内容添加到我的permissions.acl文件中:

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule Default {
description: "Grant all access by default"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "**"
action: ALLOW
}

rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}

rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}

编辑:

当我运行时composer card list -c admin@my-network,我得到以下信息:

userName:            admin
description:         
businessNetworkName: my-network
identityId:          fc63d3e4b3b3d73a2be2943a0c422e7af862207f9489fc1ce3707e8769efc99b
roles: 
  - PeerAdmin
connectionProfile: 
  name:   hlfv1
  x-type: hlfv1
credentials:         Credentials set

Command succeeded

标签: dockerhyperledger-fabrichyperledgerhyperledger-composer

解决方案


推荐阅读