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

fix: unecessary company CVs controller check #398

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion lib/safira_web/controllers/cv_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use SafiraWeb, controller: "1.6"

alias Safira.Accounts
alias Safira.Accounts.Staff

Check warning on line 5 in lib/safira_web/controllers/cv_controller.ex

View workflow job for this annotation

GitHub Actions / OTP 25.x / Elixir 1.14.x

unused alias Staff

alias Safira.CV

Expand Down Expand Up @@ -47,7 +47,7 @@

company = Accounts.get_company!(company_id)

if Accounts.is_admin(conn) or (curr_company_id == company.id and company.has_cv_access) do
if Accounts.is_admin(conn) or curr_company_id == company.id do
zip =
Accounts.list_company_attendees(company_id)
|> Enum.concat(Accounts.list_staffs())
Expand Down
14 changes: 0 additions & 14 deletions test/safira_web/controllers/cv_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ defmodule SafiraWeb.CVControllerTest do
(attendee.nickname <> ".pdf") |> String.to_charlist()
end

test "company does not have access to CV", %{
user_company_no_access: user_company,
company_no_access: company,
attendee_with_badge: _attendee
} do
%{conn: conn, user: _user} = api_authenticate(user_company)

conn =
conn
|> get(Routes.cv_path(conn, :company_cvs, company.id))

assert response(conn, 403)
end

test "admin downloads the CVs of a company's attendees", %{
company: company,
attendee_with_badge: attendee
Expand Down
Loading