alias Mix.Tasks.Pleroma.Common
alias Pleroma.User
alias Pleroma.UserInviteToken
+ alias Pleroma.Web.OAuth
@shortdoc "Manages Pleroma users"
@moduledoc """
mix pleroma.user delete_activities NICKNAME
+ ## Sign user out from all applications (delete user's OAuth tokens and authorizations).
+
+ mix pleroma.user sign_out NICKNAME
+
## Deactivate or activate the user's account.
mix pleroma.user toggle_activated NICKNAME
end
end
+ def run(["sign_out", nickname]) do
+ Common.start_pleroma()
+
+ with %User{} = user <- User.get_cached_by_nickname(nickname) do
+ OAuth.Token.delete_user_tokens(user)
+ OAuth.Authorization.delete_user_authorizations(user)
+
+ Common.shell_info("#{nickname} signed out from all apps.")
+ else
+ _ ->
+ Common.shell_error("No local user #{nickname}")
+ end
+ end
+
defp set_moderator(user, value) do
info_cng = User.Info.admin_api_update(user.info, %{is_moderator: value})