DEV: Replace deprecated sso site settings with discourse_connect (#12099)
This commit is contained in:
parent
7cad5dfa83
commit
9d7dc89d79
|
@ -337,7 +337,7 @@ class GroupsController < ApplicationController
|
|||
end
|
||||
|
||||
if emails.any?
|
||||
if SiteSetting.enable_sso?
|
||||
if SiteSetting.enable_discourse_connect?
|
||||
raise Discourse::InvalidParameters.new(I18n.t("groups.errors.no_invites_with_discourse_connect"))
|
||||
elsif !SiteSetting.enable_local_logins?
|
||||
raise Discourse::InvalidParameters.new(I18n.t("groups.errors.no_invites_without_local_logins"))
|
||||
|
|
|
@ -360,7 +360,7 @@ class Invite < ActiveRecord::Base
|
|||
def ensure_no_invalid_email_invites
|
||||
return if email.blank?
|
||||
|
||||
if SiteSetting.enable_sso?
|
||||
if SiteSetting.enable_discourse_connect?
|
||||
errors.add(:email, I18n.t("invite.disabled_errors.discourse_connect_enabled"))
|
||||
elsif !SiteSetting.enable_local_logins?
|
||||
errors.add(:email, I18n.t("invite.disabled_errors.local_logins_disabled"))
|
||||
|
|
|
@ -396,7 +396,7 @@ class Guardian
|
|||
|
||||
def can_bulk_invite_to_forum?(user)
|
||||
user.admin? &&
|
||||
!SiteSetting.enable_sso &&
|
||||
!SiteSetting.enable_discourse_connect &&
|
||||
SiteSetting.enable_local_logins
|
||||
end
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ describe Invite do
|
|||
end
|
||||
end
|
||||
|
||||
context "SSO validation" do
|
||||
it "prevents creating an email invite when SSO is enabled" do
|
||||
SiteSetting.sso_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_sso = true
|
||||
context "DiscourseConnect validation" do
|
||||
it "prevents creating an email invite when DiscourseConnect is enabled" do
|
||||
SiteSetting.discourse_connect_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_discourse_connect = true
|
||||
|
||||
invite = Fabricate.build(:invite, email: "test@mail.com")
|
||||
expect(invite).not_to be_valid
|
||||
|
|
|
@ -1363,9 +1363,9 @@ describe GroupsController do
|
|||
end
|
||||
end
|
||||
|
||||
it "adds known users by email when SSO is enabled" do
|
||||
SiteSetting.sso_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_sso = true
|
||||
it "adds known users by email when DiscourseConnect is enabled" do
|
||||
SiteSetting.discourse_connect_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_discourse_connect = true
|
||||
|
||||
expect do
|
||||
put "/groups/#{group.id}/members.json", params: { emails: other_user.email }
|
||||
|
@ -1374,9 +1374,9 @@ describe GroupsController do
|
|||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "rejects unknown emails when SSO is enabled" do
|
||||
SiteSetting.sso_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_sso = true
|
||||
it "rejects unknown emails when DiscourseConnect is enabled" do
|
||||
SiteSetting.discourse_connect_url = "https://www.example.com/sso"
|
||||
SiteSetting.enable_discourse_connect = true
|
||||
put "/groups/#{group.id}/members.json", params: { emails: "newuser@example.com" }
|
||||
|
||||
expect(response.status).to eq(400)
|
||||
|
|
Loading…
Reference in New Issue