1 parent
b967ff7f05
commit
72aa110f72
50 files changed
+489
-540
No files matched your search
@@ -16,5 +16,5 @@ function list_accounts() {
|
||||
|
||||
function account_id() {
|
||||
local acct=$1
|
||||
strip $(list_accounts | jq -c ".[] | select(.attributes.login_name | contains(\"$acct\")) | .[\"id\"]")
|
||||
strip $(list_accounts | jq -c ".items[] | select(.attributes.login_name | contains(\"$acct\")) | .[\"id\"]")
|
||||
}
|
||||
@@ -4,5 +4,5 @@ function has_authorized_action() {
|
||||
# has_authorized_action $out authorize-session
|
||||
local out=$1
|
||||
local action=$2
|
||||
echo $out | jq -c ".authorized_actions | contains([\"$action\"])"
|
||||
echo $out | jq -c ".item.authorized_actions | contains([\"$action\"])"
|
||||
}
|
||||
@@ -22,12 +22,12 @@ function assoc_group_acct() {
|
||||
|
||||
function group_id() {
|
||||
local group=$1
|
||||
strip $(list_groups | jq -c ".[] | select(.name | contains(\"$group\")) | .[\"id\"]")
|
||||
strip $(list_groups | jq -c ".items[] | select(.name | contains(\"$group\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function group_member_ids() {
|
||||
local gid=$1
|
||||
boundary groups read -id $gid -format json | jq '.["members"][]["id"]'
|
||||
boundary groups read -id $gid -format json | jq '.item["members"][]["id"]'
|
||||
}
|
||||
|
||||
function group_has_member_id() {
|
||||
|
||||
@@ -25,7 +25,7 @@ function list_host_catalogs() {
|
||||
function host_catalog_id() {
|
||||
local id=$1
|
||||
local sid=$2
|
||||
strip $(list_host_catalogs $sid | jq -c ".[] | select(.name | contains(\"$id\")) | .[\"id\"]")
|
||||
strip $(list_host_catalogs $sid | jq -c ".items[] | select(.name | contains(\"$id\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_host_catalog_actions() {
|
||||
|
||||
@@ -28,12 +28,12 @@ function assoc_host_set_host() {
|
||||
function host_set_id() {
|
||||
local name=$1
|
||||
local hcid=$2
|
||||
strip $(list_host_sets $hcid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_host_sets $hcid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function host_set_host_ids() {
|
||||
local id=$1
|
||||
ids=$(read_host_set $id | jq '.["host_ids"]')
|
||||
ids=$(read_host_set $id | jq '.item["host_ids"]')
|
||||
echo "ids $ids"
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ function host_id() {
|
||||
local name=$1
|
||||
local hcid=$2
|
||||
|
||||
strip $(list_hosts $hcid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_hosts $hcid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_host_actions() {
|
||||
|
||||
@@ -55,12 +55,12 @@ function remove_role_principal() {
|
||||
function role_id() {
|
||||
local name=$1
|
||||
local sid=$2
|
||||
strip $(list_roles $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_roles $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function role_principal_ids() {
|
||||
local rid=$1
|
||||
strip $(read_role $rid | jq '.["principals"][]["id"]')
|
||||
strip $(read_role $rid | jq '.item["principals"][]["id"]')
|
||||
}
|
||||
|
||||
function role_has_principal_id() {
|
||||
@@ -77,7 +77,7 @@ function role_has_principal_id() {
|
||||
|
||||
function role_grants() {
|
||||
local rid=$1
|
||||
read_role $rid | jq -rc '.grant_strings | @sh'
|
||||
read_role $rid | jq -rc '.item.grant_strings | @sh'
|
||||
}
|
||||
|
||||
function role_has_grant() {
|
||||
|
||||
@@ -27,7 +27,7 @@ function scope_id() {
|
||||
local name=$1
|
||||
local sid=$2
|
||||
|
||||
strip $(list_scopes $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_scopes $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_scope_actions() {
|
||||
|
||||
@@ -5,7 +5,7 @@ function list_sessions() {
|
||||
}
|
||||
|
||||
function count_sessions() {
|
||||
list_sessions $1 | jq '. | length'
|
||||
list_sessions $1 | jq '.items | length'
|
||||
}
|
||||
|
||||
function cancel_session() {
|
||||
@@ -14,4 +14,4 @@ function cancel_session() {
|
||||
|
||||
function read_session() {
|
||||
boundary sessions read -id $1
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,12 @@ function assoc_host_sets() {
|
||||
function target_id_from_name() {
|
||||
local sid=$1
|
||||
local name=$2
|
||||
strip $(list_targets $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_targets $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function target_host_set_ids() {
|
||||
local tid=$1
|
||||
boundary targets read -id $tid -format json | jq '.host_sets[].id'
|
||||
boundary targets read -id $tid -format json | jq '.item.host_sets[].id'
|
||||
}
|
||||
|
||||
function target_has_host_set_id() {
|
||||
|
||||
@@ -35,5 +35,5 @@ function has_default_user_actions() {
|
||||
|
||||
function user_id() {
|
||||
local user=$1
|
||||
strip $(list_users | jq -c ".[] | select(.name | contains(\"$user\")) | .[\"id\"]")
|
||||
strip $(list_users | jq -c ".items[] | select(.name | contains(\"$user\")) | .[\"id\"]")
|
||||
}
|
||||
@@ -59,7 +59,7 @@ load _helpers
|
||||
[ "$status" -eq 0 ]
|
||||
run list_sessions $DEFAULT_P_ID
|
||||
[ "$status" -eq 0 ]
|
||||
id=$(echo "$output" | jq -r '[.[]|select(.user_id == "u_1234567890")][0].id')
|
||||
id=$(echo "$output" | jq -r '[.items[]|select(.user_id == "u_1234567890")][0].id')
|
||||
|
||||
# Check unpriv cannot read or cancel an admin's session
|
||||
run login $DEFAULT_UNPRIVILEGED_LOGIN
|
||||
@@ -86,7 +86,7 @@ load _helpers
|
||||
[ "$status" -eq 0 ]
|
||||
run list_sessions $DEFAULT_P_ID
|
||||
[ "$status" -eq 0 ]
|
||||
id=$(echo "$output" | jq -r '[.[]|select(.user_id == "u_0987654321")][0].id')
|
||||
id=$(echo "$output" | jq -r '[.items[]|select(.user_id == "u_0987654321")][0].id')
|
||||
|
||||
# Check unpriv can read and cancel their own session
|
||||
run login $DEFAULT_UNPRIVILEGED_LOGIN
|
||||
|
||||
Reference in new issue
Block a user