Merge branch 'list-users' into 'develop'

Add CLI list users command

See merge request pleroma/pleroma!1990
This commit is contained in:
rinpatch 2019-11-21 20:33:11 +00:00
commit c2ad9fd5f9
3 changed files with 24 additions and 0 deletions

View file

@ -364,6 +364,24 @@ defmodule Mix.Tasks.Pleroma.User do
end
end
def run(["list"]) do
start_pleroma()
Pleroma.User.Query.build(%{local: true})
|> Pleroma.RepoStreamer.chunk_stream(500)
|> Stream.each(fn users ->
users
|> Enum.each(fn user ->
shell_info(
"#{user.nickname} moderator: #{user.info.is_moderator}, admin: #{user.info.is_admin}, locked: #{
user.info.locked
}, deactivated: #{user.info.deactivated}"
)
end)
end)
|> Stream.run()
end
defp set_moderator(user, value) do
{:ok, user} =
user