Commit 99238a7e authored by Toon Claes's avatar Toon Claes Committed by Toon Claes

Only show/enable Audit Events when feature is available

parent 4b6ac32f
class Groups::AuditEventsController < Groups::ApplicationController
before_action :authorize_admin_group!
before_action :check_audit_events_available!
layout 'group_settings'
......
class Projects::AuditEventsController < Projects::ApplicationController
before_action :authorize_admin_project!
before_action :check_audit_events_available!
layout 'project_settings'
......
......@@ -10,10 +10,11 @@
%span
Webhooks
= nav_link(path: 'audit_events#index') do
= link_to group_audit_events_path(@group), title: 'Audit Events' do
%span
Audit Events
- if @group.feature_available?(:audit_events)
= nav_link(path: 'audit_events#index') do
= link_to group_audit_events_path(@group), title: 'Audit Events' do
%span
Audit Events
- if @group.shared_runners_enabled? && @group.shared_runners_minutes_limit_enabled?
= nav_link(path: 'pipeline_quota#index') do
......
......@@ -29,7 +29,4 @@
%span
Pages
= nav_link(controller: :audit_events) do
= link_to project_audit_events_path(@project), title: "Audit Events" do
%span
Audit Events
= render 'projects/settings/ee/nav'
- if @project.feature_available?(:audit_events)
= nav_link(controller: :audit_events) do
= link_to project_audit_events_path(@project), title: "Audit Events" do
%span
Audit Events
---
title: Namespace license checks Audit Events & Admin Audit Log
merge_request: 2326
author:
......@@ -11,6 +11,30 @@ feature 'Groups > Audit Events', js: true, feature: true do
sign_in(user)
end
context 'unlicensed' do
before do
stub_licensed_features(audit_events: false)
end
it 'returns 404' do
visit group_audit_events_path(group)
expect(page.status_code).to eq(404)
end
it 'does not have Audit Events button in head nav bar' do
visit edit_group_path(group)
expect(page).not_to have_link('Audit Events')
end
end
it 'has Audit Events button in head nav bar' do
visit edit_group_path(group)
expect(page).to have_link('Audit Events')
end
describe 'changing a user access level' do
it "appears in the group's audit events" do
visit group_group_members_path(group)
......
......@@ -10,8 +10,34 @@ feature 'Projects > Audit Events', js: true, feature: true do
sign_in(user)
end
context 'unlicensed' do
before do
stub_licensed_features(audit_events: false)
end
it 'returns 404' do
visit project_audit_events_path(project)
expect(page.status_code).to eq(404)
end
it 'does not have Audit Events button in head nav bar' do
visit edit_project_path(project)
expect(page).not_to have_link('Audit Events')
end
end
it 'has Audit Events button in head nav bar' do
visit edit_project_path(project)
expect(page).to have_link('Audit Events')
end
describe 'adding an SSH key' do
it "appears in the project's audit events" do
stub_licensed_features(audit_events: true)
visit new_project_deploy_key_path(project)
fill_in 'deploy_key_title', with: 'laptop'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment