jonmbake / discourse-ldap-auth

Discourse plugin to enable LDAP/Active Directory authentication.
MIT License
70 stars 53 forks source link

Override invite only with LDAP login #57

Open ziima opened 3 years ago

ziima commented 3 years ago

I setup a Discourse server on Yunohost and I'd like only a Yunohost (LDAP) users to login. I would like to set Discourse to "invite only" mode to disable public registration (and the "Registration" button) itself, but I'd like users to be created using LDAP. Would it be possible to override "invite only" setting for LDAP users?

jonmbake commented 3 years ago

I am not super familar with Discourse's "invite only" mode. It seems like it is set at the user group level. Is that correct?

The plugin does allow specify user groups on a per-user basis when using the list user account creation mode, e.g.:

- :name: Example User
  :email: example_user@gmail.com
  :username: example_user
  :groups: ['Discourse Invite Only Group']

It sounds like this doesn't meet your use case since this has to be declared on a per-user basis, and you want this behavior for all LDAP users created w/ the auto user creation mode. The plugin currently doesn't allow this, but we could easily add a plugin config to allow declaring a default user group for all LDAP users by udpating this bit of the plugin code: https://github.com/jonmbake/discourse-ldap-auth/blob/master/lib/ldap_user.rb#L9.

ziima commented 3 years ago

"invite only" is part of a Login section settings. I'm not very familiar with Discourse, but I haven't found any other solution.

To the proposed fix: indeed, I'd like all user from LDAP to be created, so a change that would allow this would be welcome.