Skip to content

Commit

Permalink
fix: permission check logic for pats
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed Nov 1, 2024
1 parent f3e2b41 commit e643a9d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/api/views/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ def get(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)

if not user_has_permission(
account,
"read",
Expand Down Expand Up @@ -143,6 +145,7 @@ def post(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)
if not user_has_permission(
Expand Down Expand Up @@ -255,6 +258,7 @@ def put(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)

Expand Down Expand Up @@ -382,6 +386,7 @@ def delete(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)
if not user_has_permission(
Expand Down Expand Up @@ -453,8 +458,10 @@ def get(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)

if not user_has_permission(
account,
"read",
Expand Down Expand Up @@ -534,6 +541,7 @@ def post(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)
if not user_has_permission(
Expand Down Expand Up @@ -667,6 +675,7 @@ def put(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)

Expand Down Expand Up @@ -825,6 +834,7 @@ def delete(self, request):
account = (
request.auth["service_account"]
if "service_account" in request.auth
and request.auth["service_account"] is not None
else request.auth["org_member"].user
)
if not user_has_permission(
Expand Down

0 comments on commit e643a9d

Please sign in to comment.