Как обновить принадлежность и атрибут члена, используя узел ткани - PullRequest
0 голосов
/ 31 октября 2019

У меня есть настройка сети фабрики с 2 организациями и двумя фабриками, я зарегистрировался и зарегистрировал пользователя.

 1. How i can update the affiliation of user, I am trying to call the getCaName from node js and reenroll its doest not work.

 2. How to change the attribute of user using fabric node .

 3. How to revoke the certificate.

Ответы [ 2 ]

0 голосов
/ 31 октября 2019

@ fama

Вы можете использовать мой ниже фрагмент

let adminUserObj = await client.setUserContext({
  username: admins.username,
  password: admins.secret
});

let caClient = client.getCertificateAuthority();

let affiliationService = caClient.newAffiliationService();
// Check if organization exists
let registeredAffiliations = await affiliationService.getAll(adminUserObj);
if (!registeredAffiliations.result.affiliations.some(x => x.name == userOrg.toLowerCase())) {
  let affiliation = userOrg.toLowerCase() + '.department1';
  await affiliationService.create({
    name: affiliation,
    force: true
  }, adminUserObj);
}
...