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:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user