1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 17:42:48 +00:00

thread update/insert changeset fixed - auth permissions done

This commit is contained in:
2018-01-03 23:04:29 -06:00
parent 11eaa3565b
commit 148bde8f99
9 changed files with 120 additions and 48 deletions

View File

@@ -1,5 +1,6 @@
defmodule MyApp.Guardian do
use Guardian, otp_app: :myapp
use Guardian.Permissions.Bitwise
def subject_for_token(resource, _claims) do
# You can use any value for the subject of your token but
@@ -11,10 +12,6 @@ defmodule MyApp.Guardian do
{:ok, sub}
end
# def subject_for_token(_, _) do
# {:error, :reason_for_error}
# end
def resource_from_claims(claims) do
# Here we'll look up our resource from the claims, the subject can be
# found in the `"sub"` key. In `above subject_for_token/2` we returned
@@ -25,8 +22,10 @@ defmodule MyApp.Guardian do
{:ok, resource}
end
# def resource_from_claims(_claims) do
# {:error, :reason_for_error}
# end
@spec add_permissions(map, map) :: map
def add_permissions(claims, permissions) do
claims
|> encode_permissions_into_claims!(permissions)
end
end