kairos0ne
How do I set permissions for Guardian from a DB table. In my app users can create tables in the database and I need a way update or provide the base permissions for Guardian at runtime
Problem Statement
I tried to get the permissions structured correctly for Guardian in my Guardian module like so.
defmodule Dynamic.Guardian do
alias Dynamic.BaseContent
alias Dynamic.BaseStructures
alias Dynamic.Repo
use Guardian, otp_app: :dynamic,
permissions: BaseStructures.get_table_permissions!()
However I get this error:
(RuntimeError) could not lookup Ecto repo Dynamic.Repo because it was not started or it does not exist
Stacktrace:
│ (ecto 3.8.4) lib/ecto/repo/registry.ex:22: Ecto.Repo.Registry.lookup/1
│ (ecto 3.8.4) lib/ecto/repo/supervisor.ex:159: Ecto.Repo.Supervisor.tuplet/2
│ (dynamic 0.1.0) lib/dynamic/repo.ex:2: Dynamic.Repo.all/2
│ (dynamic 0.1.0) lib/dynamic/base_structures.ex:145: Dynamic.BaseStructures.get_table_permissions!/0
│ lib/dynamic/guardian.ex:9: (module)Elixir
Solution Brainstorm
Any thoughts on how to support this or if Im in fact missing something fundamental.
Popular in Questions
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dep...
New
Student & New to elixir. Nice language.
I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Hi all
I want to have a unix time, from the current time plus 1 hour.
DateTime.now + 1 hour
How to get it in elixir?
Thanks
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
Other popular topics
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New







