Skip to content

Commit

Permalink
WIP 'request_individual_signature' API
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Gryglicki <[email protected]>
  • Loading branch information
lukaszgryglicki committed Nov 27, 2024
1 parent 8e02cb1 commit 3eeaf1f
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 1 deletion.
1 change: 0 additions & 1 deletion cla-backend/cla/models/docusign_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def request_individual_signature(self, project_id, user_id, return_url=None, ret
signature_embargo_acked=True,
signature_return_url=return_url,
signature_callback_url=callback_url)

# Set signature ACL
if return_url_type.lower() == "github":
acl = user.get_user_github_id()
Expand Down
2 changes: 2 additions & 0 deletions cla-backend/scripts/describe_table.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
aws --profile lfproduct-dev dynamodb describe-table --table-name cla-dev-signatures
2 changes: 2 additions & 0 deletions cla-backend/scripts/lookup_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
aws --profile lfproduct-dev dynamodb query --table-name cla-dev-projects --index-name project-name-lower-search-index --key-condition-expression "project_name_lower = :name" --expression-attribute-values '{":name":{"S":"child group earths"}}'
2 changes: 2 additions & 0 deletions cla-backend/scripts/lookup_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
aws --profile lfproduct-dev dynamodb query --table-name cla-dev-users --index-name github-username-index --key-condition-expression "user_github_username = :name" --expression-attribute-values '{":name":{"S":"lukaszgryglicki"}}'
45 changes: 45 additions & 0 deletions cla-backend/scripts/request_individual_signature_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
# API_URL=https://3f13-147-75-85-27.ngrok-free.app (defaults to localhost:5000)
# user_id='9dcf5bbc-2492-11ed-97c7-3e2a23ea20b5'
# project_id='88ee12de-122b-4c46-9046-19422054ed8d'
# return_url_type='github'
# return_url='http://localhost'

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 project_id as a 2nd parameter"
exit 2
fi
export project_id="$2"

if [ -z "$3" ]
then
echo "$0: you need to specify return_url_type as a 3rd parameter: github|gitlab|gerrit"
exit 3
fi
export return_url_type="$3"

if [ -z "$4" ]
then
echo "$0: you need to specify return_url as a 4th parameter"
exit 4
fi
export return_url="$4"

if [ -z "$API_URL" ]
then
export API_URL="http://localhost:5000"
fi

if [ ! -z "$DEBUG" ]
then
echo "curl -s -XPOST -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v2/request-individual-signature' -d '{\"project_id\":\"${project_id}\",\"user_id\":\"${user_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}' | jq -r '.'"
fi
curl -s -XPOST -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v2/request-individual-signature" -d "{\"project_id\":\"${project_id}\",\"user_id\":\"${user_id}\",\"return_url_type\":\"${return_url_type}\",\"return_url\":\"${return_url}\"}" | jq -r '.'
2 changes: 2 additions & 0 deletions cla-backend/scripts/scan_projects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
aws --profile lfproduct-dev dynamodb scan --table-name cla-dev-projects --max-items 3
2 changes: 2 additions & 0 deletions cla-backend/scripts/scan_signatures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
aws --profile lfproduct-dev dynamodb scan --table-name cla-dev-signatures --max-items 1
1 change: 1 addition & 0 deletions setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export AWS_ACCESS_KEY_ID="$(echo "${data}" | jq -r '.Credentials.AccessKeyId')"
export AWS_SECRET_ACCESS_KEY="$(echo "${data}" | jq -r '.Credentials.SecretAccessKey')"
export AWS_SESSION_TOKEN="$(echo "${data}" | jq -r '.Credentials.SessionToken')"
export AWS_SECURITY_TOKEN="$(echo "${data}" | jq -r '.Credentials.SessionToken')"
export GITHUB_OAUTH_TOKEN="$(cat /etc/github/oauth)"

export AWS_SDK_LOAD_CONFIG=true
export AWS_PROFILE='lfproduct-dev'
Expand Down
1 change: 1 addition & 0 deletions unsetenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ unset REGION
unset AWS_ROLE_ARN
unset AWS_TOKEN_SERIAL
unset AWS_SDK_LOAD_CONFIG
unset GITHUB_OAUTH_TOKEN

0 comments on commit 3eeaf1f

Please sign in to comment.