Skip to content

Commit 2c977c9

Browse files
Remove JaResouce and Canary
1 parent 3b51807 commit 2c977c9

File tree

6 files changed

+28
-138
lines changed

6 files changed

+28
-138
lines changed

config/config.exs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ config :guardian, Guardian,
3838
secret_key: System.get_env("GUARDIAN_SECRET_KEY"),
3939
serializer: CodeCorpsWeb.GuardianSerializer
4040

41-
config :canary, repo: CodeCorps.Repo
42-
config :canary, unauthorized_handler: {CodeCorpsWeb.AuthenticationHelpers, :handle_unauthorized}
43-
config :canary, not_found_handler: {CodeCorpsWeb.AuthenticationHelpers, :handle_not_found}
44-
4541
# Configures ex_aws with credentials
4642
config :ex_aws, :code_corps,
4743
access_key_id: [System.get_env("AWS_ACCESS_KEY_ID"), :instance_role],
@@ -86,9 +82,6 @@ config :sentry,
8682
included_environments: ~w(prod staging)a,
8783
use_error_logger: true
8884

89-
config :ja_resource,
90-
repo: CodeCorps.Repo
91-
9285
# Import environment specific config. This must remain at the bottom
9386
# of this file so it overrides the configuration defined above.
9487
import_config "#{Mix.env}.exs"

lib/code_corps/policy/policy.ex

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defmodule CodeCorps.Policy do
66
alias CodeCorps.{Category, Comment, DonationGoal, GithubAppInstallation, Organization, OrganizationInvite, OrganizationGithubAppInstallation, Preview, Project, ProjectCategory, ProjectGithubRepo, ProjectSkill, ProjectUser, Role, RoleSkill, Skill, StripeConnectAccount, StripeConnectPlan, StripeConnectSubscription, StripePlatformCard, StripePlatformCustomer, Task, TaskSkill, User, UserCategory, UserRole, UserSkill, UserTask}
77

88
alias CodeCorps.Policy
9-
alias Ecto.Changeset
109

1110
@doc ~S"""
1211
Determines if the specified user can perform the specified action on the
@@ -90,19 +89,4 @@ defmodule CodeCorps.Policy do
9089
defp can?(%User{} = current_user, :show, %StripePlatformCustomer{} = stripe_platform_customer, %{}),
9190
do: Policy.StripePlatformCustomer.show?(current_user, stripe_platform_customer)
9291
defp can?(%User{} = user, :create, %GithubAppInstallation{}, %{} = params), do: Policy.GithubAppInstallation.create?(user, params)
93-
94-
defimpl Canada.Can, for: User do
95-
# NOTE: Canary sets an :unauthorized and a :not_found handler on a config level
96-
# The problem is, it will still go through the authorization process first and only call the
97-
# not found handler after the unauthorized handler does its thing. This means that our
98-
# unauthorized handler will halt the connection and respond, so the not_found handler
99-
# will never do anything
100-
#
101-
# The only solution is to have a catch_all match for the resource being nil, which returns true
102-
103-
# NOTE: other tests are using the User policy for the time being.
104-
def can?(%User{}, _action, nil), do: true
105-
106-
def can?(%User{} = user, :create, Role), do: Policy.Role.create?(user)
107-
end
10892
end

lib/code_corps_web.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ defmodule CodeCorpsWeb do
3838
import CodeCorpsWeb.Router.Helpers
3939
import CodeCorpsWeb.Gettext
4040

41-
import Canary.Plugs
42-
import CodeCorpsWeb.AuthenticationHelpers, only: [load_and_authorize_changeset: 2]
43-
4441
alias CodeCorps.{Repo, Policy}
4542
alias Plug.Conn
4643
end

lib/code_corps_web/helpers/authentication_helpers.ex

Lines changed: 0 additions & 78 deletions
This file was deleted.

mix.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ defmodule CodeCorps.Mixfile do
5050
{:cowboy, "~> 1.0"},
5151
{:benchfella, "~> 0.3.0", only: :dev},
5252
{:bypass, "~> 0.8.1", only: :test},
53-
{:canary, "~> 1.1.1"}, # Authorization
5453
{:cloudex, "~> 0.1.17"},
5554
{:comeonin, "~> 3.1"},
5655
{:corsica, "~> 1.0"}, # CORS
@@ -65,7 +64,6 @@ defmodule CodeCorps.Mixfile do
6564
{:hackney, ">= 1.4.4"},
6665
{:inch_ex, "~> 0.5", only: [:dev, :test]}, # Inch CI
6766
{:inflex, "~> 1.8.1"},
68-
{:ja_resource, "~> 0.2"},
6967
{:ja_serializer, "~> 0.12"}, # JSON API
7068
{:joken, "~> 1.5"}, # JWT encoding
7169
{:money, "~> 1.2.1"},

0 commit comments

Comments
 (0)