feat(cli): allow the mobilizon.users.delete command to delete multiple users by email domain or ip
Also allow to delete groups the user's actors are admins of Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -97,6 +97,21 @@ defmodule Mobilizon.Users do
|
||||
end
|
||||
end
|
||||
|
||||
@spec get_users_by_email_domain(String.t()) :: list(User.t())
|
||||
def get_users_by_email_domain(email_domain) do
|
||||
User
|
||||
|> where([u], like(u.email, ^"%#{email_domain}%"))
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@spec get_users_by_ip_address(String.t()) :: list(User.t())
|
||||
def get_users_by_ip_address(ip_address) do
|
||||
User
|
||||
|> where([u], u.current_sign_in_ip == ^ip_address)
|
||||
|> or_where([u], u.last_sign_in_ip == ^ip_address)
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Get an user by its activation token.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user