From 7aa75a87e8a554512a7adc0d3421b140885eb86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Gryglicki?= Date: Thu, 5 Dec 2024 10:49:09 +0000 Subject: [PATCH] Ready for review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ɓukasz Gryglicki --- utils/request_corporate_signature_go_post.sh | 22 +++--- utils/request_employee_signature_go_post.sh | 79 -------------------- 2 files changed, 11 insertions(+), 90 deletions(-) delete mode 100755 utils/request_employee_signature_go_post.sh diff --git a/utils/request_corporate_signature_go_post.sh b/utils/request_corporate_signature_go_post.sh index dfeebb8c1..49f83779b 100755 --- a/utils/request_corporate_signature_go_post.sh +++ b/utils/request_corporate_signature_go_post.sh @@ -1,12 +1,12 @@ #!/bin/bash # API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000) -# company_id='862ff296-6508-4f10-9147-2bc2dd7bfe80' -# project_id='88ee12de-122b-4c46-9046-19422054ed8d' +# company_sfid='0016s000006Uq9VAAS' +# project_sfid='a092h000004wx1DAAQ' # return_url_type='github' # return_url='http://localhost' # TOKEN='...' - Auth0 JWT bearer token # XACL='...' - X-ACL -# DEBUG=1 XACL="$(cat ./x-acl.secret)" TOKEN="$(cat ./auth0.token.secret)" ./utils/request_corporate_signature_go_post.sh 862ff296-6508-4f10-9147-2bc2dd7bfe80 88ee12de-122b-4c46-9046-19422054ed8d github 'http://localhost' +# DEBUG=1 XACL="$(cat ./x-acl.secret)" TOKEN="$(cat ./auth0.token.secret)" ./utils/request_corporate_signature_go_post.sh 0016s000006Uq9VAAS a092h000004wx1DAAQ github 'http://localhost' if [ -z "$TOKEN" ] then @@ -15,7 +15,7 @@ then fi if [ -z "$TOKEN" ] -then +then echo "$0: TOKEN not specified and unable to obtain one" exit 1 fi @@ -33,17 +33,17 @@ fi if [ -z "$1" ] then - echo "$0: you need to specify company_id as a 1st parameter" + echo "$0: you need to specify company_sfid as a 1st parameter" exit 1 fi -export company_id="$1" +export company_sfid="$1" if [ -z "$2" ] then - echo "$0: you need to specify project_id as a 2nd parameter" + echo "$0: you need to specify project_sfid as a 2nd parameter" exit 2 fi -export project_id="$2" +export project_sfid="$2" if [ -z "$3" ] then @@ -54,7 +54,7 @@ export return_url_type="$3" if [ -z "$4" ] then - echo "$0: you need to specify return_url as a 4th parameter" + echo "$0: you need to specify return_urlas a 4th parameter" exit 4 fi export return_url="$4" @@ -66,6 +66,6 @@ fi if [ ! -z "$DEBUG" ] then - echo "curl -s -XPOST -H 'X-ACL: ${XACL}' -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v4/request-corporate-signature' -d '{\"project_id\":\"${project_id}\",\"company_id\":\"${company_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}' | jq -r '.'" + echo "curl -s -XPOST -H 'X-ACL: ${XACL}' -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v4/request-corporate-signature' -d '{\"project_sfid\":\"${project_sfid}\",\"company_sfid\":\"${company_sfid}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}' | jq -r '.'" fi -curl -s -XPOST -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/request-corporate-signature" -d "{\"project_id\":\"${project_id}\",\"company_id\":\"${company_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}" | jq -r '.' +curl -s -XPOST -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/request-corporate-signature" -d "{\"project_sfid\":\"${project_sfid}\",\"company_sfid\":\"${company_sfid}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}" | jq -r '.' diff --git a/utils/request_employee_signature_go_post.sh b/utils/request_employee_signature_go_post.sh deleted file mode 100755 index 92eec3f9d..000000000 --- a/utils/request_employee_signature_go_post.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# API_URL=https://3f13-147-75-85-27.ngrok-free.app (defaults to localhost:5000) -# user_id='9dcf5bbc-2492-11ed-97c7-3e2a23ea20b5' -# company_id='862ff296-6508-4f10-9147-2bc2dd7bfe80' -# project_id='88ee12de-122b-4c46-9046-19422054ed8d' -# return_url_type='github' -# return_url='http://localhost' -# TOKEN='...' - Auth0 JWT bearer token -# XACL='...' - X-ACL -# DEBUG=1 TOKEN="$(cat ./auth0.token.secret)" XACL="$(cat ./x-acl.secret)" ./utils/request_employee_signature_go_post.sh 9dcf5bbc-2492-11ed-97c7-3e2a23ea20b5 862ff296-6508-4f10-9147-2bc2dd7bfe80 88ee12de-122b-4c46-9046-19422054ed8d github 'http://localhost' - -if [ -z "$TOKEN" ] -then - # source ./auth0_token.secret - TOKEN="$(cat ./auth0.token.secret)" -fi - -if [ -z "$TOKEN" ] -then - echo "$0: TOKEN not specified and unable to obtain one" - exit 1 -fi - -if [ -z "$XACL" ] -then - XACL="$(cat ./x-acl.secret)" -fi - -if [ -z "$XACL" ] -then - echo "$0: XACL not specified and unable to obtain one" - exit 2 -fi - -if [ -z "$1" ] -then - echo "$0: you need to specify user_id as a 1st parameter" - exit 1 -fi -export user_id="$1" - -if [ -z "$2" ] -then - echo "$0: you need to specify company_id as a 2nd parameter" - exit 2 -fi -export company_id="$2" - -if [ -z "$3" ] -then - echo "$0: you need to specify project_id as a 3rd parameter" - exit 3 -fi -export project_id="$3" - -if [ -z "$4" ] -then - echo "$0: you need to specify return_url_type as a 4th parameter: github|gitlab|gerrit" - exit 4 -fi -export return_url_type="$4" - -if [ -z "$5" ] -then - echo "$0: you need to specify return_url as a 5th parameter" - exit 5 -fi -export return_url="$5" - -if [ -z "$API_URL" ] -then - export API_URL="http://localhost:5000" -fi - -if [ ! -z "$DEBUG" ] -then - echo "curl -s -XPOST -H 'X-ACL: ${XACL}' -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v4/request-employee-signature' -d '{\"project_id\":\"${project_id}\",\"user_id\":\"${user_id}\",\"company_id\":\"${company_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}' | jq -r '.'" -fi -curl -s -XPOST -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/request-employee-signature" -d "{\"project_id\":\"${project_id}\",\"user_id\":\"${user_id}\",\"company_id\":\"${company_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}" | jq -r '.'