Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Получение link'а кнопки по запросу в зависимости от доступа #59

Merged
merged 7 commits into from
Jul 12, 2024
Merged
Changes from 2 commits
Commits
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
7 changes: 5 additions & 2 deletions services_backend/routes/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def get_buttons(
"id": button.id,
"icon": button.icon,
"name": button.name,
"link": button.link,
"order": button.order,
"type": button.type,
"view": view.value,
Expand All @@ -138,7 +137,10 @@ def get_buttons(
}
if view == ButtonView.ACTIVE:
to_add["scopes"] = list(scopes)
if user_scopes.issuperset(button.required_scopes):
to_add["link"] = button.link
result["buttons"].append(to_add)

return result


Expand Down Expand Up @@ -177,7 +179,6 @@ def get_button(
"id": button.id,
"icon": button.icon,
"name": button.name,
"link": button.link,
"order": button.order,
"type": button.type,
"view": view.value,
Expand All @@ -186,6 +187,8 @@ def get_button(
}
if view == ButtonView.ACTIVE:
result["scopes"] = list(scopes)
if user_scopes.issuperset(button.required_scopes):
result["link"] = button.link
return result


Expand Down
Loading