export function hasPriv(code) {
  const privObj = JSON.parse(sessionStorage.getItem('privItem'));
  if (!privObj) return false;
  const result = hasPermission(privObj, code);
  return result;
}
function hasPermission(privItem, code) {
  if (!privItem) return false;
  if (code == privItem.code) {
    return true;
  } else {
    if (privItem.privList.length && privItem.privList.length > 0) {
      for (var index = 0; index < privItem.privList.length; index++) {
        var result = hasPermission(privItem.privList[index], code);
        if (result) {
          return true;
        }
      }
    }
  }
  return false;
}
