Created
March 1, 2021 23:00
-
-
Save chadmiller/dd63a85f3e491a26d33059b59fb841cd to your computer and use it in GitHub Desktop.
An itermediate step that almost lets you effectively un-share Bitwarden items shared to an Organization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# One can not currently un-share shared items to an organization in Bitwarden. | |
# | |
# A workaround is to copy them back to yourself, and then remove them from the organization. | |
# | |
# Here's a simple, dumb script that creates a personal folder, and copies org items to it. | |
# | |
# You need the bitwarden command-line (CLI) tool, and to have previously run "bw login" | |
set -eux -o pipefail | |
srcorg_name=${1:?Source org name} | |
dstfolder_name=${2:?Personal folder name} | |
srcorg_id=$(bw list organizations |jq -r ".[] | select(.name == \"$srcorg_name\") | .id") | |
echo "Org $srcorg_name has id $srcorg_id ." | |
dstfolder_id=$(bw encode <<< "{\"name\":\"$dstfolder_name\"}" |bw create folder |jq -r .id) | |
test -n "$srcorg_id" | |
test -n "$dstfolder_id" | |
bw list items --organizationid "${srcorg_id}" |jq -c ".[] | del(.organizationId) | .folderId=\"$dstfolder_id\"" |while read json; do | |
bw encode <<<$json |bw create item | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment