Skip to content
Closed
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
7e2222e
Add /v2/user-from-token API and update a few v1/v2 APIs to require be…
lukaszgryglicki Jun 4, 2025
275e4f9
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jun 18, 2025
1a21481
Update more V1 and V2 API to require the bearer token and check if au…
lukaszgryglicki Jun 18, 2025
a95477e
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jun 18, 2025
c4ee277
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jun 25, 2025
50815ad
Updates to test tokens
lukaszgryglicki Jun 25, 2025
2fc5ab1
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jun 25, 2025
82c781e
Manual merge
lukaszgryglicki Jun 25, 2025
2f51d6e
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 1, 2025
f83bc6d
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 2, 2025
0d299c5
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 8, 2025
40a1e75
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 8, 2025
1e05dd3
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 10, 2025
df5c252
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 15, 2025
c733936
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 21, 2025
b869e96
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 22, 2025
dfa1b8c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 23, 2025
517dc22
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 24, 2025
2e68432
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 29, 2025
7b08e8c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 30, 2025
4efeb16
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
1942a10
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
e0401e4
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
b908892
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
eec7d94
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
4c71f02
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Jul 31, 2025
9209baa
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 1, 2025
5d9f620
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 2, 2025
46d1bc4
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 2, 2025
212eef7
Resolve merge conflicts
lukaszgryglicki Aug 6, 2025
ead98f0
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 6, 2025
6056152
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 7, 2025
d77b567
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 7, 2025
74ed6bc
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 7, 2025
4895661
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 7, 2025
46c0e2f
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 8, 2025
766ad71
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 19, 2025
b7f056a
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 20, 2025
e236f60
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 21, 2025
cad5d33
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 21, 2025
410d2e2
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 21, 2025
8a574b6
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 23, 2025
b7d6543
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 23, 2025
75fb66d
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 25, 2025
eed616c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 26, 2025
cd2913a
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 26, 2025
92bf4f0
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 27, 2025
51bc25c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Aug 28, 2025
b0be84b
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 3, 2025
7fa0efa
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 4, 2025
54b5591
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 10, 2025
c95bd24
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 11, 2025
223cc5f
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 17, 2025
08d9389
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 17, 2025
0a77e0a
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 18, 2025
0bc422a
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 18, 2025
73b0663
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 23, 2025
80996a7
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 24, 2025
2708c72
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 29, 2025
4b627a3
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 30, 2025
6131a7f
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Sep 30, 2025
798c858
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 1, 2025
1f0cbf5
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 1, 2025
e7f51c9
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 1, 2025
61a5b74
Manual merge with dev
lukaszgryglicki Oct 7, 2025
a5a70e6
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 7, 2025
66e6bb8
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 8, 2025
1bd5767
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 8, 2025
5c70742
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 9, 2025
3be1bf7
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 9, 2025
3d8ef8a
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 13, 2025
42951d6
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 14, 2025
53396dc
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 16, 2025
a197846
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 21, 2025
5fa38e2
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 21, 2025
24387c7
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 22, 2025
ed89041
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 23, 2025
da5d39c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 28, 2025
a835e8c
Merge branch 'dev' into unicron-check-for-token-in-v1-v2-apis
lukaszgryglicki Oct 29, 2025
16904f3
Try 1st V3 tests
lukaszgryglicki Oct 29, 2025
b7ab422
WIP
lukaszgryglicki Oct 29, 2025
3820161
WIP V3
lukaszgryglicki Oct 29, 2025
f5e5027
One more fix?
lukaszgryglicki Oct 29, 2025
d3be008
Fixed users.cy.ts tests
lukaszgryglicki Oct 29, 2025
a22ff71
Cleanup for now
lukaszgryglicki Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cla-backend-go/users/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ func Configure(api *operations.ClaAPI, service Service, eventsService events.Ser
}

userModel, err := service.GetUser(params.UserID)
if err != nil {
log.WithFields(f).Warnf("error retrieving user for user_id: %s, error: %+v", params.UserID, err)
if err != nil || userModel == nil {
log.WithFields(f).Warnf("error retrieving user for user_id: %s, error: %+v, userModel is nil: %v", params.UserID, err, userModel == nil)
return users.NewGetUserCompatBadRequest().WithPayload(errorResponse(err))
}

Expand Down
71 changes: 56 additions & 15 deletions cla-backend/cla/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
get_log_middleware
)

# Check if authenticated user (via bearer token) is the same as user_id - if not raise exception permission denied
# LG: comment this out to tunr off this chekc added after LFID is required everywhere in EasyCLA
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling errors: 'tunr' should be 'turn' and 'chekc' should be 'check'.

Suggested change
# LG: comment this out to tunr off this chekc added after LFID is required everywhere in EasyCLA
# LG: comment this out to turn off this check added after LFID is required everywhere in EasyCLA

Copilot uses AI. Check for mistakes.
def check_user_id_is_current(auth_user, user_id):
auth_user_id = cla.controllers.user.get_or_create_user(auth_user).get_user_id()
if str(user_id) != auth_user_id:
cla.log.debug(f'request_individual_signature - auth user UUID {auth_user_id} is not the same as requested signature UUID {str(user_id)}')
raise cla.auth.AuthError('permission denied')
Comment on lines +41 to +47
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix typos and misleading context in authentication helper.

The helper has two issues:

  1. Typo in comment: "tunr off this chekc" → "turn off this check"
  2. Log message references request_individual_signature but this is a generic helper used across many endpoints

Apply this diff:

-# Check if authenticated user (via bearer token) is the same as user_id - if not raise exception permission denied
-# LG: comment this out to tunr off this chekc added after LFID is required everywhere in EasyCLA
+# Check if authenticated user (via bearer token) is the same as user_id - if not raise permission denied exception
+# LG: comment this out to turn off this check added after LFID is required everywhere in EasyCLA
 def check_user_id_is_current(auth_user, user_id):
     auth_user_id = cla.controllers.user.get_or_create_user(auth_user).get_user_id()
     if str(user_id) != auth_user_id:
-        cla.log.debug(f'request_individual_signature - auth user UUID {auth_user_id} is not the same as requested signature UUID {str(user_id)}')
+        cla.log.debug(f'check_user_id_is_current - auth user UUID {auth_user_id} is not the same as requested user UUID {str(user_id)}')
         raise cla.auth.AuthError('permission denied')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Check if authenticated user (via bearer token) is the same as user_id - if not raise exception permission denied
# LG: comment this out to tunr off this chekc added after LFID is required everywhere in EasyCLA
def check_user_id_is_current(auth_user, user_id):
auth_user_id = cla.controllers.user.get_or_create_user(auth_user).get_user_id()
if str(user_id) != auth_user_id:
cla.log.debug(f'request_individual_signature - auth user UUID {auth_user_id} is not the same as requested signature UUID {str(user_id)}')
raise cla.auth.AuthError('permission denied')
# Check if authenticated user (via bearer token) is the same as user_id - if not raise permission denied exception
# LG: comment this out to turn off this check added after LFID is required everywhere in EasyCLA
def check_user_id_is_current(auth_user, user_id):
auth_user_id = cla.controllers.user.get_or_create_user(auth_user).get_user_id()
if str(user_id) != auth_user_id:
cla.log.debug(f'check_user_id_is_current - auth user UUID {auth_user_id} is not the same as requested user UUID {str(user_id)}')
raise cla.auth.AuthError('permission denied')
🤖 Prompt for AI Agents
In cla-backend/cla/routes.py around lines 41 to 47, fix the comment typo and
misleading log context: update the comment to "turn off this check" (instead of
"tunr off this chekc") and change the debug log to a generic message that does
not reference request_individual_signature (e.g., mention "auth user UUID does
not match requested user UUID" or similar) so the helper's log accurately
reflects its generic use; keep the permission denied raise behavior unchanged.



#
# Middleware
Expand Down Expand Up @@ -103,7 +111,10 @@ def get_health(request):

# LG: This is ported to golang and no longer used in dev (still used in prod)
@hug.get("/user/{user_id}", versions=2)
def get_user(user_id: hug.types.uuid):
def get_user(
auth_user: check_auth,
user_id: hug.types.uuid
):
"""
GET: /user/{user_id}

Expand All @@ -118,6 +129,7 @@ def get_user(user_id: hug.types.uuid):
# else:
# raise auth_err

check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.get_user(user_id=user_id)


Expand All @@ -139,6 +151,7 @@ def get_user_signatures(auth_user: check_auth, user_id: hug.types.uuid):

Returns a list of signatures associated with a user.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.get_user_signatures(user_id)


Expand All @@ -156,6 +169,7 @@ def get_users_company(auth_user: check_auth, user_company_id: hug.types.uuid):
# We can't change API URL to be inclusive yet as this would break all consumers and require acs-cli and lfx-gateway updates
@hug.post("/user/{user_id}/request-company-whitelist/{company_id}", versions=2)
def request_company_allowlist(
auth_user: check_auth,
user_id: hug.types.uuid,
company_id: hug.types.uuid,
user_name: hug.types.text,
Expand All @@ -173,6 +187,7 @@ def request_company_allowlist(
Performs the necessary actions (ie: send email to manager) when the specified user requests to
be added the the specified company's allowlist.
"""
# check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.request_company_allowlist(
user_id, str(company_id), str(user_name), str(user_email), str(project_id), message,
str(recipient_name), str(recipient_email),
Expand All @@ -181,6 +196,7 @@ def request_company_allowlist(

@hug.post("/user/{user_id}/invite-company-admin", versions=2)
def invite_company_admin(
auth_user: check_auth,
user_id: hug.types.uuid,
contributor_name: hug.types.text,
contributor_email: cla.hug_types.email,
Expand All @@ -203,6 +219,7 @@ def invite_company_admin(

Sends an Email to the prospective CLA Manager to sign up through the ccla console.
"""
# check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.invite_cla_manager(
str(user_id), str(contributor_name), str(contributor_email),
str(cla_manager_name), str(cla_manager_email),
Expand All @@ -212,6 +229,7 @@ def invite_company_admin(

@hug.post("/user/{user_id}/request-company-ccla", versions=2)
def request_company_ccla(
auth_user: check_auth,
user_id: hug.types.uuid, user_email: cla.hug_types.email, company_id: hug.types.uuid,
project_id: hug.types.uuid,
):
Expand All @@ -220,6 +238,7 @@ def request_company_ccla(

Sends an Email to an admin of an existing company to sign a CCLA.
"""
# check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.request_company_ccla(str(user_id), str(user_email), str(company_id), str(project_id))


Expand All @@ -236,7 +255,10 @@ def request_company_ccla(

# LG: This is ported to golang and no longer used in dev (still used in prod)
@hug.get("/user/{user_id}/active-signature", versions=2)
def get_user_active_signature(user_id: hug.types.uuid):
def get_user_active_signature(
auth_user: check_auth,
user_id: hug.types.uuid
):
"""
GET: /user/{user_id}/active-signature

Expand All @@ -250,28 +272,35 @@ def get_user_active_signature(user_id: hug.types.uuid):

Returns null if the user does not have an active signature.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.get_active_signature(user_id)


@hug.get("/user/{user_id}/project/{project_id}/last-signature", versions=2)
def get_user_project_last_signature(user_id: hug.types.uuid, project_id: hug.types.uuid):
def get_user_project_last_signature(
auth_user: check_auth,
user_id: hug.types.uuid, project_id: hug.types.uuid
):
"""
GET: /user/{user_id}/project/{project_id}/last-signature

Returns the user's latest ICLA signature for the project specified.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.get_user_project_last_signature(user_id, project_id)


@hug.get("/user/{user_id}/project/{project_id}/last-signature/{company_id}", versions=1)
def get_user_project_company_last_signature(
auth_user: check_auth,
user_id: hug.types.uuid, project_id: hug.types.uuid, company_id: hug.types.uuid
):
"""
GET: /user/{user_id}/project/{project_id}/last-signature/{company_id}

Returns the user's latest employee signature for the project and company specified.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.user.get_user_project_company_last_signature(user_id, project_id, company_id)


Expand Down Expand Up @@ -413,6 +442,7 @@ def get_signatures_user(auth_user: check_auth, user_id: hug.types.uuid):

Get all signatures for user specified.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signature.get_user_signatures(user_id)


Expand All @@ -423,6 +453,7 @@ def get_signatures_user_project(auth_user: check_auth, user_id: hug.types.uuid,

Get all signatures for user, filtered by project_id specified.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signature.get_user_project_signatures(user_id, project_id)


Expand All @@ -438,6 +469,7 @@ def get_signatures_user_project(

Get all signatures for user, filtered by project_id and signature type specified.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signature.get_user_project_signatures(user_id, project_id, signature_type)


Expand All @@ -462,7 +494,7 @@ def get_signatures_project(auth_user: check_auth, project_id: hug.types.uuid):


@hug.get("/signatures/company/{company_id}/project/{project_id}", versions=1)
def get_signatures_project_company(company_id: hug.types.uuid, project_id: hug.types.uuid):
def get_signatures_project_company(auth_user: check_auth, company_id: hug.types.uuid, project_id: hug.types.uuid):
"""
GET: /signatures/company/{company_id}/project/{project_id}

Expand All @@ -472,7 +504,7 @@ def get_signatures_project_company(company_id: hug.types.uuid, project_id: hug.t


@hug.get("/signatures/company/{company_id}/project/{project_id}/employee", versions=1)
def get_project_employee_signatures(company_id: hug.types.uuid, project_id: hug.types.uuid):
def get_project_employee_signatures(auth_user: check_auth, company_id: hug.types.uuid, project_id: hug.types.uuid):
"""
GET: /signatures/company/{company_id}/project/{project_id}

Expand Down Expand Up @@ -625,7 +657,7 @@ def get_companies(auth_user: check_auth):


@hug.get("/company", versions=2)
def get_all_companies():
def get_all_companies(auth_user: check_auth):
"""
GET: /company

Expand All @@ -635,7 +667,7 @@ def get_all_companies():


@hug.get("/company/{company_id}", versions=2)
def get_company(company_id: hug.types.text):
def get_company(auth_user: check_auth, company_id: hug.types.text):
"""
GET: /company/{company_id}

Expand All @@ -645,7 +677,7 @@ def get_company(company_id: hug.types.text):


@hug.get("/company/{company_id}/project/unsigned", versions=1)
def get_unsigned_projects_for_company(company_id: hug.types.text):
def get_unsigned_projects_for_company(auth_user: check_auth, company_id: hug.types.text):
"""
GET: /company/{company_id}/project/unsigned

Expand Down Expand Up @@ -751,7 +783,7 @@ def put_company_allowlist_csv(body, auth_user: check_auth, company_id: hug.types


@hug.get("/companies/{manager_id}", version=1)
def get_manager_companies(manager_id: hug.types.uuid):
def get_manager_companies(auth_user: check_auth, manager_id: hug.types.uuid):
"""
GET: /companies/{manager_id}

Expand Down Expand Up @@ -780,7 +812,7 @@ def get_projects(auth_user: check_auth):

# LG: This is ported to golang and no longer used in dev (still used in prod).
@hug.get("/project/{project_id}", versions=2)
def get_project(project_id: hug.types.uuid):
def get_project(auth_user: check_auth, project_id: hug.types.uuid):
"""
GET: /project/{project_id}

Expand Down Expand Up @@ -1015,6 +1047,7 @@ def get_project_configuration_orgs_and_repos(auth_user: check_auth, project_id:

@hug.get("/project/{project_id}/document/{document_type}", versions=2)
def get_project_document(
auth_user: check_auth,
project_id: hug.types.uuid, document_type: hug.types.one_of(["individual", "corporate"]),
):
"""
Expand Down Expand Up @@ -1067,7 +1100,7 @@ def get_project_document_matching_version(


@hug.get("/project/{project_id}/companies", versions=2)
def get_project_companies(project_id: hug.types.uuid):
def get_project_companies(auth_user: check_auth, project_id: hug.types.uuid):
"""
GET: /project/{project_id}/companies
s
Expand Down Expand Up @@ -1217,7 +1250,7 @@ def delete_project_document(
'user_id': 'some-user-uuid'}",
)
def request_individual_signature(
request, project_id: hug.types.uuid, user_id: hug.types.uuid, return_url_type=None, return_url=None,
auth_user: check_auth, request, project_id: hug.types.uuid, user_id: hug.types.uuid, return_url_type=None, return_url=None,
):
"""
POST: /request-individual-signature
Expand All @@ -1240,8 +1273,10 @@ def request_individual_signature(
User should hit the provided URL to initiate the signing process through the
signing service provider.
"""
return cla.controllers.signing.request_individual_signature(project_id, user_id, return_url_type, return_url,
request=request)
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signing.request_individual_signature(
project_id, user_id, return_url_type, return_url, request=request
)


@hug.post(
Expand Down Expand Up @@ -1287,7 +1322,7 @@ def request_corporate_signature(

Returns a dict of the format:

{'company_id': <user_id>,
{'company_id': <company_id>,
'signature_id': <signature_id>,
'project_id': <project_id>,
'sign_url': <sign_url>}
Expand All @@ -1311,6 +1346,7 @@ def request_corporate_signature(

@hug.post("/request-employee-signature", versions=2)
def request_employee_signature(
auth_user: check_auth,
project_id: hug.types.uuid,
company_id: hug.types.uuid,
user_id: hug.types.uuid,
Expand All @@ -1330,13 +1366,15 @@ def request_employee_signature(
require a full DocuSign signature process, which means the sign/callback URLs and document
versions may not be populated or reliable.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signing.request_employee_signature(
project_id, company_id, user_id, return_url_type, return_url
)


@hug.post("/check-prepare-employee-signature", versions=2)
def check_and_prepare_employee_signature(
auth_user: check_auth,
project_id: hug.types.uuid, company_id: hug.types.uuid, user_id: hug.types.uuid
):
"""
Expand All @@ -1349,6 +1387,7 @@ def check_and_prepare_employee_signature(

Checks if an employee is ready to sign a CCLA for a company.
"""
check_user_id_is_current(auth_user, user_id)
return cla.controllers.signing.check_and_prepare_employee_signature(project_id, company_id, user_id)


Expand Down Expand Up @@ -1390,6 +1429,7 @@ def post_individual_signed_gitlab(
Callback URL from signing service upon ICLA signature for a Gitlab user.
"""
content = body.read()
# check_user_id_is_current(auth_user, user_id)
return cla.controllers.signing.post_individual_signed_gitlab(
content, user_id, organization_id, gitlab_repository_id, merge_request_id
)
Expand All @@ -1403,6 +1443,7 @@ def post_individual_signed_gerrit(body, user_id: hug.types.uuid):
Callback URL from signing service upon ICLA signature for a Gerrit user.
"""
content = body.read()
# check_user_id_is_current(auth_user, user_id)
return cla.controllers.signing.post_individual_signed_gerrit(content, user_id)


Expand Down
Loading
Loading