Packages
legendary_core
2.6.0
8.12.0
8.11.1
8.11.0
8.10.0
8.9.2
8.9.1
8.5.3
8.5.2
8.5.1
8.5.0
8.4.0
8.3.6
8.3.5
8.3.4
8.3.3
8.3.2
8.3.1
8.3.0
8.2.7
8.2.5
8.2.4
8.2.3
8.2.2
8.2.1
8.2.0
8.1.1
8.1.0
8.0.1
8.0.0
7.17.12
7.17.8
7.17.7
7.17.6
7.17.5
7.17.4
7.17.3
7.17.2
7.17.1
7.17.0
7.16.12
7.16.11
4.5.4
4.0.0
2.12.0
2.11.5
2.6.0
2.4.1
2.4.0
2.3.7
2.1.2
A PETAL-stack batteries-included boilerplate for making Phoenix apps without tedium.
Current section
Files
Jump to
Current section
Files
lib/auth/user_admin.ex
defmodule Legendary.Auth.UserAdmin do
import Ecto.Query, only: [from: 2]
alias Legendary.Auth.User
alias Legendary.Core.Repo
def custom_links(_schema) do
[
%{name: "Feature Flags", url: "/admin/feature-flags", order: 2, location: :top, icon: "flag"},
]
end
def create_changeset(schema, attrs) do
Legendary.Auth.User.admin_changeset(schema, attrs)
end
def update_changeset(schema, attrs) do
Legendary.Auth.User.admin_changeset(schema, attrs)
end
def widgets(_schema, _conn) do
user_count =
(from u in User,
select: count(u.id))
|> Repo.one()
[
%{
icon: "users",
type: "tidbit",
title: "Registered Users",
content: user_count,
width: 3
}
]
end
def index(_) do
[
id: nil,
email: nil,
roles: %{value: fn u -> Enum.join(u.roles, ", ") end},
display_name: nil,
homepage_url: nil,
email_confirmed_at: nil,
inserted_at: nil,
updated_at: nil,
]
end
def form_fields(_) do
[
email: nil,
roles: nil,
display_name: nil,
homepage_url: nil,
]
end
end