private async Task ObtainRelations(TransferAssetToUtxo packet, byte[] assetId) { _logger.Debug($"[{_accountId}]: {nameof(ObtainRelations)}"); IEnumerable <RegistrationKeyDescriptionStore> groupRelations = await _schemeResolverService.GetGroupRelations(packet.Signer.ToString(), assetId.ToHexString()).ConfigureAwait(false); foreach (var groupRelation in groupRelations) { string groupOwnerName = await _schemeResolverService.ResolveIssuer(groupRelation.Key).ConfigureAwait(false); long groupRelationId = _dataAccessService.AddUserGroupRelation(_accountId, groupOwnerName, groupRelation.Key, groupRelation.Description, groupRelation.AssetId, groupRelation.Issuer); if (groupRelationId > 0) { GroupRelationDto groupRelationDto = new GroupRelationDto { GroupRelationId = groupRelationId, GroupOwnerName = groupOwnerName, GroupOwnerKey = groupRelation.Key, GroupName = groupRelation.Description, Issuer = groupRelation.Issuer, AssetId = groupRelation.AssetId }; await _idenitiesHubContext.Clients.Group(_accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushGroupRelation", groupRelationDto).ConfigureAwait(false); } } }
public IActionResult SendEmployeeRequest([FromBody] UserAttributeTransferDto userAttributeTransfer) { ulong accountId = ulong.Parse(User.Identity.Name, CultureInfo.InvariantCulture); UtxoPersistency utxoPersistency = _executionContextManager.ResolveUtxoExecutionServices(accountId); bool proceed = true; if (!string.IsNullOrEmpty(userAttributeTransfer.ImageContent) && !string.IsNullOrEmpty(userAttributeTransfer.Content)) { string sourceImage = _dataAccessService.GetUserAssociatedAttributes(accountId).FirstOrDefault(t => t.Item1 == AttributeType.PassportPhoto)?.Item2; BiometricPersonDataForSignatureDto biometricPersonDataForSignature = new BiometricPersonDataForSignatureDto { ImageSource = sourceImage, ImageTarget = userAttributeTransfer.ImageContent }; try { BiometricSignedVerificationDto biometricSignedVerification = $"{Request.Scheme}://{Request.Host.ToUriComponent()}/biometric/".AppendPathSegment("SignPersonFaceVerification").PostJsonAsync(biometricPersonDataForSignature).ReceiveJson <BiometricSignedVerificationDto>().Result; } catch (FlurlHttpException) { proceed = false; } //Tuple<bool, bool> faceRes = VerifyFaceImage(userAttributeTransfer.ImageContent, userAttributeTransfer.Content); proceed = true; // faceRes.Item1; } if (proceed) { SendEmployeeRequest(userAttributeTransfer, utxoPersistency.TransactionsService); string[] categoryEntries = userAttributeTransfer.ExtraInfo.Split("/"); foreach (string categoryEntry in categoryEntries) { string groupOwnerName = categoryEntry.Split("|")[0]; string groupName = categoryEntry.Split("|")[1]; ulong groupRelationId = _dataAccessService.AddUserGroupRelation(accountId, groupOwnerName, userAttributeTransfer.Target, groupName); if (groupRelationId > 0) { GroupRelationDto groupRelationDto = new GroupRelationDto { GroupRelationId = groupRelationId, GroupOwnerName = groupOwnerName, GroupOwnerKey = userAttributeTransfer.Target, GroupName = groupName }; _idenitiesHubContext.Clients.Group(accountId.ToString(CultureInfo.InvariantCulture)).SendAsync("PushGroupRelation", groupRelationDto); } } return(Ok(true)); } return(Ok(false)); }