Search in sources :

Example 1 with PrivilegeSet

use of com.jd.blockchain.ledger.PrivilegeSet in project jdchain-core by blockchain-jd-com.

the class RolePrivilegeDataset method getRolePrivilege.

/**
 * 查询角色权限;
 *
 * <br>
 * 如果不存在,则返回 null;
 *
 * @param address
 * @return
 */
@Override
public RolePrivileges getRolePrivilege(String roleName) {
    // 只返回最新版本;
    Bytes key = encodeKey(roleName);
    DataEntry<Bytes, byte[]> kv = dataset.getDataEntry(key);
    if (kv == null) {
        return null;
    }
    PrivilegeSet privilege = BinaryProtocol.decode(kv.getValue());
    return new RolePrivileges(roleName, kv.getVersion(), privilege);
}
Also used : Bytes(utils.Bytes) RolePrivileges(com.jd.blockchain.ledger.RolePrivileges) PrivilegeSet(com.jd.blockchain.ledger.PrivilegeSet)

Aggregations

PrivilegeSet (com.jd.blockchain.ledger.PrivilegeSet)1 RolePrivileges (com.jd.blockchain.ledger.RolePrivileges)1 Bytes (utils.Bytes)1