2022-12-23 02:29:12 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function error_handler() {
|
|
|
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
2023-05-22 18:58:51 +00:00
|
|
|
database=spiffworkflow_backend_local_development
|
|
|
|
if [[ "${1:-}" == "test" ]]; then
|
|
|
|
database=spiffworkflow_backend_unit_testing
|
|
|
|
fi
|
|
|
|
|
|
|
|
# shellcheck disable=2016
|
|
|
|
mysql -uroot "$database" -e '
|
2023-05-25 16:00:24 +00:00
|
|
|
select u.username username, g.identifier group_name
|
2023-05-22 18:58:51 +00:00
|
|
|
FROM `user` u
|
2023-05-25 16:00:24 +00:00
|
|
|
JOIN `user_group_assignment` uga ON uga.user_id = u.id
|
|
|
|
JOIN `group` g ON g.id = uga.group_id;
|
2023-05-22 18:58:51 +00:00
|
|
|
|
|
|
|
select pa.id, g.identifier group_identifier, pt.uri, permission from permission_assignment pa
|
2023-05-25 16:00:24 +00:00
|
|
|
JOIN principal p ON p.id = pa.principal_id
|
|
|
|
JOIN `group` g ON g.id = p.group_id
|
|
|
|
JOIN permission_target pt ON pt.id = pa.permission_target_id;
|
2023-05-22 18:58:51 +00:00
|
|
|
'
|