1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 09:32:51 +00:00

server - support for admin/mod users

This commit is contained in:
2018-01-16 21:48:46 -06:00
parent 744874ce4f
commit b30af0cd09
7 changed files with 77 additions and 5 deletions

View File

@@ -11,6 +11,10 @@ defmodule MyApp.Repo.Migrations.CreateUser do
add :character_class, :string
add :character_realm, :string
add :character_avatar, :string
# for admin purposes
add :username, :string
add :password, :string
timestamps()
end

View File

@@ -194,3 +194,18 @@ Enum.each(Category.get_seed(), fn(cat) ->
end
end)
end)
# insert admin user
accounts = Application.get_env(:myapp, :admin_accounts)
Enum.each(accounts, fn (user) ->
Repo.transaction(fn ->
exists = Repo.get_by(Data.User, %{username: Map.get(user, "username")}) != nil
if !exists do
MyApp.Data.User.insert_admin_user(user)
end
end)
end)