FIX: allow impersonation of system accounts
This commit is contained in:
Родитель
652d284ad0
Коммит
c4221c5939
|
@ -3,6 +3,7 @@ module MozillaIAM
|
|||
def check_iam_session
|
||||
begin
|
||||
return unless current_user
|
||||
return if current_user.id < 0
|
||||
|
||||
last_refresh = session[:mozilla_iam].try(:[], :last_refresh)
|
||||
no_refresh = session[:mozilla_iam].try(:[], :no_refresh)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# name: mozilla-iam
|
||||
# about: A plugin to integrate Discourse with Mozilla's Identity and Access Management (IAM) system
|
||||
# version: 1.1.3
|
||||
# version: 1.1.4
|
||||
# authors: Leo McArdle
|
||||
# url: https://github.com/mozilla/discourse-mozilla-iam
|
||||
|
||||
|
|
|
@ -167,5 +167,20 @@ describe TopicsController do
|
|||
expect(session['current_user_id']).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context "with system user" do
|
||||
let(:user) { User.find(-1) }
|
||||
before do
|
||||
authenticate_user(user)
|
||||
log_in_user(user)
|
||||
end
|
||||
|
||||
it "does nothing" do
|
||||
MozillaIAM::Profile.expects(:for).never
|
||||
MozillaIAM::Profile.expects(:refresh).never
|
||||
|
||||
get :show, params: { id: 666 }, format: :json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче