legacy-knowledge-base
公開されました Jun. 30, 2025

パスワードの大量リセット方法

written-by

Peter Schwarcz

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • 全ユーザーのパスワードをリセットする必要があります。 ユーザー数が多いため、手作業で行うのは困難です。 この機能はすぐに使えるのか、それとも最善の方法があるのか?

Environment

  • Liferay DXP 7.3+

解決策

  • 残念ながら、パスワードの大量リセットはOOTB Liferayでは利用できません。
  • しかし、これはgroovyスクリプトを使うことで実現できる。 Liferay DXP 7.3環境用に作成された proof of concept スクリプトを以下に掲載します。

    import com.liferay.portal.kernel.model.User;
    import com.liferay.portal.kernel.service.UserLocalServiceUtil;

    long companyId = 12345;

    List<User> users = UserLocalServiceUtil.getCompanyUsers(companyId, -1, -1);

    for (User user : users) {
    out.println("This user will get a password reset mail: " + user.getUserId())
    // UserLocalServiceUtil.sendPasswordByUserId(user.getUserId());
    }
  • userIdsを取得するために、以前は getCompanyUsers() メソッドを使用しました。 最初に、このスクリプトはパスワードリセットメールを受け取るユーザの userIds を出力します。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base