use of com.jd.blockchain.ledger.BlockchainIdentity in project jdchain-core by blockchain-jd-com.
the class UncommittedLedgerQueryService method getUsers.
@Override
public BlockchainIdentity[] getUsers(int fromIndex, int count) {
UserAccountSet userAccountSet = transactionContext.getDataset().getUserAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) userAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = userAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of com.jd.blockchain.ledger.BlockchainIdentity in project jdchain-core by blockchain-jd-com.
the class DataAccountRegisterOperationHandle method doProcess.
@Override
protected void doProcess(DataAccountRegisterOperation op, LedgerTransactionContext transactionContext, TransactionRequestExtension requestContext, LedgerQuery ledger, OperationHandleContext handleContext, EventManager manager) {
// TODO: 请求者应该提供数据账户的公钥签名,以更好地确保注册人对该地址和公钥具有合法使用权;
// 权限校验;
SecurityPolicy securityPolicy = SecurityContext.getContextUsersPolicy();
securityPolicy.checkEndpointPermission(LedgerPermission.REGISTER_DATA_ACCOUNT, MultiIDsPolicy.AT_LEAST_ONE);
// 操作账本;
BlockchainIdentity bid = op.getAccountID();
DataAccount account = ((DataAccountSetEditor) (transactionContext.getDataset().getDataAccountSet())).register(bid.getAddress(), bid.getPubKey(), null);
account.setPermission(new AccountDataPermission(AccountType.DATA, requestContext.getEndpointAddresses().toArray(new Bytes[0])));
}
Aggregations