SSO 使用中のユーザーのプログラムによる追加

Discourse の内部コピーを、SSO の使用が必須となるように設定し、LDAP サーバーに接続しています。つまり、スタッフ全員は共通のユーザー名とパスワードで簡単にログインできますが、アカウントが作成されるのは初めてログインした際のみです。

社内でスタッフ間の社会的な交流を促進しようという議論はありますが、多くのスタッフがメール以外の手段を使うことをためらっています。

そこで、Discourse を活用してこの課題を解決する方法を検討しています。すでにメール関連の実装(カテゴリごとに受信用メールアドレスを設定するなど)は完了しましたが、以下の 2 つの課題について解決策が思いつきません。

  1. 理想としては、Discourse へのログイン前に全員のアカウントを作成しておきたいと考えています。その理由は、アカウント未所持のまま Discourse にメールを送信した場合でも、匿名扱いではなくユーザーの詳細情報が反映されるようにするためです。

  2. 全員のアカウントが作成されていることを前提に、Discourse からの要約メールを受信できるようにしたいと考えています。これにより、Discourse を訪れなくてもスレッドの作成に気づけるようになります。

どのような解決策が考えられるでしょうか?SSO と連携させて、プログラムで Discourse のアカウントを自動作成する方法はあるでしょうか?

よろしくお願いいたします。

「いいね!」 1

You can do it via the API. Here’s an example: GitHub - pfaffman/discourse-user-creator: Create an activated user, optionally assigning to group

「いいね!」 3

Thanks … one issue I can think of is that I have to supply a password when creating the user. Presumably, if SSO is being enforced, Discourse actually ignores the password I’ve provided? (Testing would prove that, I guess!)

「いいね!」 1

Yeah. Since you’re using SSO the password won’t matter, or can be omitted. Testing would be the way to prove it! If you’d like help and have a budget, my contact info is in my profile.

You can create users with the sync_sso route. There is some PHP code in this post that gives an example of how to do it: If someone changes their email in WordPress, change it in Discourse - sso_sync. In that code, it’s being used to update a user’s email, but the same idea will work to create a new user.

「いいね!」 5