Custom validation example
It would be very helpful to have an example validation in the docs for custom validations. I am getting hung up creating an error that implements the form error protocol. The following generates an error but is then stripped out before rending the form.
error = Ash.Error.to_ash_error("Domain or company is required")...
Log in with username and password in Phoenix app
Does ash auth Phoenix have a declarative way to log in with username instead of email address? I changed my resources but it looks like I need to change something else.
Custom Auth
Hello, I'm trying to get custom auth working but I don't know how to put the user inside the session after the login form submisison.
I created a custom live form with a phx-sumbit event called "save" the method looks like this:
```elixir
@impl true...
JSONB <=> Map fails on Array
I have a column of type
jsonb
. Let's call this column metadata
In my resource, I define the attributes as
```
attributes do...Authentication crashing
I had authentication working, and introduced some bad data in my DB and it is now crashing. The data is in a table not the user table, so I am not sure why it is blowing up when associating a user with a subject. It looks like Ash.Authentication is keeping in the mix after authentication has completed but the view has not yet rendered and is eating the error. Still investigating on my end of course.
[info] GET /admin/companies
[debug] Processing with TacitRedOTPWeb.CompanyLive.Index.index/2
Parameters: %{}...
Authentication debug help
Is there a way to watch the traffic to/from the OAuth2 provider? All I see in the browser network tab is XHR traffic and none that appers to be auth related. The error I am getting is "unknown client" which could be the client_id is not getting sent correctly (config probably on my part), or something else is wrong like the endpoint I am using for authorize_url.
Multitenancy `global?` authorization question
https://hexdocs.pm/ash/multitenancy.html#attribute-multitenancy
If you want to enable running queries without a tenant as well as queries with a tenant, the global?
option supports this. You will likely need to incorporate this ability into any authorization rules though, to ensure that users from one tenant can't access other tenant's data.
Could you please provide a brief example of what incorporating this into authorization rules would look like?...Trouble with setting up Ash.Authentication
I am getting the following compile error and have no clue what it means. "Module" does not appear in my files. I have attempted to follow the various guides to setup google to use OAuth2.
(EXIT from #PID<0.95.0>) an exception was raised:
(Spark.Error.DslError) [nil]
authentication -> api:...
Compile Error with JsonApi using related()
Hi there! 👋 I’m getting error message "(ArgumentError) Found an action of type read while looking for an action of type get_related, Perhaps you passed a changeset with the incorrect action type into your Api?" and I don’t understand how to solve it.
Here’s the code:
```...
Query
how do i translate this code for example
Helpdesk.Support.Ticket|> Ash.Query.filter(contains(subject, "2"))
into the resource's read action. Basically as part of my read action I want to filter with something similar to SQL like. i can do it on iex. but not sure how to intergrate into read action for my api.? i want to know how to use the contains(subject, "2")
inside the read action?Ecto.Multi Usage
I saw only one post about how to use
Ecto.Multi
it directed me to Ash.Flow
what I didn't find an example usage.
For context I have a record I want fetch using token provided its valid, after I get the record successfully I want to update a field on it and finally on success issue a JWT
or on error just return the error. How will this look like in the update function ?. Is this a candidate for to consider using ManualActions
?...Skip Migration for a Resource
Question: How do I skip generation of migration for a particular resource?
Context,
I have an existing ongoing project that I want to port over to STAPLE. The project
1. has existing tables and data in production. The migrations are separately maintained using LIquibase...
`Spark.Dsl.Fragment` validations
It seems that when using
Spark.Dsl.Fragment
, there are some validations that are happening on the fragment which would be preferable to have happen on the complete resource.
A couple examples:
If I define my code_interface
section in a separate file from the actions themselves, the validation fails something like:...Date time
say i want to create a resource via json api post request that has an attribute of type :utc_datetime_usec, since the value is received as a string how can i convert the string to DateTime inside the create action of the resource, i assumed there is auto cast, however it seem to not work?
add ilike filter to graphql queries
Is it possible to extend the generated filter options in AshGraphql by e.g. an
ilike
filter?ResourceValidations error
I just updated a bunch of deps and something that worked fine before just doesn't right now.
I have the following error:
```
** (EXIT from #PID<0.104.0>) an exception was raised:...
authorize_url for Google oauth
Hi @jart I was able to get github oauth to work following the getting started with Github guide, and now trying to get google oauth to work using oauth2. The doc's example for the authorize_url value is this.
If the path 'authorize' should be added to the router, I'm not sure what kind of module it should point to. Can you give me some pointers?...
authorize_url fn _, _ -> {:ok, "https://exampe.com/authorize"} end
authorize_url fn _, _ -> {:ok, "https://exampe.com/authorize"} end
Using ex_money_sql with Ash
I'm hoping to use the
Money
type defined in the ex_money
library as an attribute in Ash resources. This library has a companion, ex_money_sql
that creates a Postgres migration and creates a custom type:
```
def up do
execute("CREATE TYPE public.money_with_currency AS (currency_code varchar, amount numeric);")
end...SQLite support
Not sure if this is the right place to post this but I still wanted to open the discussion. From what I understand, a
ash_sqlite
lib is in the plans although it's not known yet when it will be available. If you're looking for help on this one, I'd love to help out for the implementation. In the meantime, what is the suggested approach to use SQLite without too much hassle? Thanks 🙂