use of com.jd.blockchain.ledger.TransactionPrivilegeBitset in project jdchain-core by blockchain-jd-com.
the class RolePrivilegeDataset method addRolePrivilege.
/**
* 加入新的角色权限; <br>
*
* 如果指定的角色已经存在,则引发 {@link LedgerException} 异常;
*
* @param roleName 角色名称;不能超过 {@link #MAX_ROLE_NAME_LENGTH} 个 Unicode
* 字符;
* @param ledgerPermissions 给角色授予的账本权限列表;
* @param txPermissions 给角色授予的交易权限列表;
* @return
*/
public long addRolePrivilege(String roleName, LedgerPermission[] ledgerPermissions, TransactionPermission[] txPermissions) {
LedgerPrivilegeBitset ledgerPrivilege = new LedgerPrivilegeBitset();
for (LedgerPermission lp : ledgerPermissions) {
ledgerPrivilege.enable(lp);
}
TransactionPrivilegeBitset txPrivilege = new TransactionPrivilegeBitset();
for (TransactionPermission tp : txPermissions) {
txPrivilege.enable(tp);
}
return addRolePrivilege(roleName, ledgerPrivilege, txPrivilege);
}
Aggregations