This commit is contained in:
Jason Ertel
2024-11-04 10:49:30 -05:00
parent 7442ffc7d8
commit e8ab7bce0c
2 changed files with 12 additions and 13 deletions

View File

@@ -72,27 +72,27 @@ while [[ $# -gt 0 ]]; do
shift shift
case "$param" in case "$param" in
--id) --id)
id=$1 id=$(echo $1 | sed 's/"/\\"/g')
[[ ${#id} -gt 55 ]] && fail "id cannot be longer than 55 characters" [[ ${#id} -gt 55 ]] && fail "id cannot be longer than 55 characters"
shift shift
;; ;;
--permission) --permission)
perm=$1 perm=$(echo $1 | sed 's/"/\\"/g')
[[ ${#perm} -gt 50 ]] && fail "permission cannot be longer than 50 characters" [[ ${#perm} -gt 50 ]] && fail "permission cannot be longer than 50 characters"
shift shift
;; ;;
--name) --name)
name=$1 name=$(echo $1 | sed 's/"/\\"/g')
[[ ${#name} -gt 50 ]] && fail "name cannot be longer than 50 characters" [[ ${#name} -gt 50 ]] && fail "name cannot be longer than 50 characters"
shift shift
;; ;;
--note) --note)
note=$1 note=$(echo $1 | sed 's/"/\\"/g')
[[ ${#note} -gt 100 ]] && fail "note cannot be longer than 100 characters" [[ ${#note} -gt 100 ]] && fail "note cannot be longer than 100 characters"
shift shift
;; ;;
--searchusername) --searchusername)
searchUsername=$1 searchUsername=$(echo $1 | sed 's/"/\\"/g')
[[ ${#searchUsername} -gt 50 ]] && fail "search username cannot be longer than 50 characters" [[ ${#searchUsername} -gt 50 ]] && fail "search username cannot be longer than 50 characters"
shift shift
;; ;;
@@ -230,8 +230,7 @@ function convertNameToId() {
function createClient() { function createClient() {
name=$1 name=$1
perm=$2 note=$2
note=$3
id=$(convertNameToId "$name") id=$(convertNameToId "$name")
now=$(date -u +%FT%TZ) now=$(date -u +%FT%TZ)
@@ -336,7 +335,7 @@ case "${operation}" in
[[ "$name" == "" ]] && fail "A short client name must be provided" [[ "$name" == "" ]] && fail "A short client name must be provided"
lock lock
createClient "$name" "${note}" createClient "$name" "$note"
if [[ "$json" == "1" ]]; then if [[ "$json" == "1" ]]; then
echo "{\"id\":\"$id\",\"secret\":\"$secret\"}" echo "{\"id\":\"$id\",\"secret\":\"$secret\"}"
else else

View File

@@ -100,23 +100,23 @@ while [[ $# -gt 0 ]]; do
shift shift
case "$param" in case "$param" in
--email) --email)
email=$1 email=$(echo $1 | sed 's/"/\\"/g')
shift shift
;; ;;
--role) --role)
role=$1 role=$(echo $1 | sed 's/"/\\"/g')
shift shift
;; ;;
--firstName) --firstName)
firstName=$1 firstName=$(echo $1 | sed 's/"/\\"/g')
shift shift
;; ;;
--lastName) --lastName)
lastName=$1 lastName=$(echo $1 | sed 's/"/\\"/g')
shift shift
;; ;;
--note) --note)
note=$1 note=$(echo $1 | sed 's/"/\\"/g')
shift shift
;; ;;
--skip-sync) --skip-sync)