Skip to content
Snippets Groups Projects
Commit a6b0defd authored by Vasilii Iakliushin's avatar Vasilii Iakliushin :two:
Browse files

Fix undefined method error 'assigned_to_duo_enterprise?'

Contributes to #507263

**Problem**

User object can be `nil` and the code raises an exception.

**Solution**

Add a handler for this case.

Changelog: fixed
EE: true
parent f46324f3
No related branches found
No related tags found
1 merge request!174345Fix undefined method error 'assigned_to_duo_enterprise?'
......@@ -69,7 +69,7 @@ def has_duo_enterprise_access?
return false unless @route
namespace = Namespace.find_by_full_path(@route[:namespace_id])
namespace && @user.assigned_to_duo_enterprise?(namespace)
namespace && @user&.assigned_to_duo_enterprise?(namespace)
end
def can_access_job?
......
......@@ -38,6 +38,12 @@
it_behaves_like 'returns only base commands'
end
context 'when user is not authorized' do
let(:user) { nil }
it_behaves_like 'returns only base commands'
end
end
context 'when ActionController::RoutingError is raised' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment