public object UpdateData(string address, string publicKey) { SecurityContext.DemandPermissions(new UserSecurityProvider(SecurityContext.CurrentAccount.ID), Core.Users.Constants.Action_EditUser); var currentAddressString = BlockchainLoginProvider.GetAddress(); if (!string.IsNullOrEmpty(currentAddressString)) { var currentAddress = JsonConvert.DeserializeObject <BlockchainAddress>(currentAddressString); if (currentAddress.PublicKey.Equals(publicKey)) { return new { isset = true } } ; LogManager.GetLogger("ASC.Api.Documents").InfoFormat("User {0} updates address", SecurityContext.CurrentAccount.ID); } var account = new BlockchainAddress { Address = address, PublicKey = publicKey }; var accountString = JsonConvert.SerializeObject(account); BlockchainLoginProvider.UpdateData(accountString); return(new { isset = !string.IsNullOrEmpty(BlockchainLoginProvider.GetAddress()) }); }
public static IEnumerable <string> GetAddress(string fileId) { var fileShares = Global.FileStorageService.GetSharedInfo(new ItemList <string> { String.Format("file_{0}", fileId) }).ToList(); fileShares = fileShares.Where(share => !share.SubjectGroup && !share.SubjectId.Equals(FileConstant.ShareLinkId) && share.Share == FileShare.ReadWrite).ToList(); var accountsString = fileShares.Select(share => BlockchainLoginProvider.GetAddress(share.SubjectId)).Where(address => address != null); return(accountsString); }