mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:01:18 +08:00
FEATURE: Experimental support for group membership via google auth (#14835)
This commit introduces a new site setting "google_oauth2_hd_groups". If enabled, group information will be fetched from Google during authentication, and stored in the Discourse database. These 'associated groups' can be connected to a Discourse group via the "Membership" tab of the group preferences UI. The majority of the implementation is generic, so we will be able to add support to more authentication methods in the near future. https://meta.discourse.org/t/managing-group-membership-via-authentication/175950
This commit is contained in:
15
lib/validators/google_oauth2_hd_groups_validator.rb
Normal file
15
lib/validators/google_oauth2_hd_groups_validator.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class GoogleOauth2HdGroupsValidator
|
||||
def initialize(opts = {})
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def valid_value?(value)
|
||||
@valid = value == "f" || SiteSetting.google_oauth2_hd.present?
|
||||
end
|
||||
|
||||
def error_message
|
||||
I18n.t("site_settings.errors.google_oauth2_hd_groups") if !@valid
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user