Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: audit logs #2703

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1167828
WIP
Paul-Bob Jan 10, 2024
8c4c54a
wip
Paul-Bob Jan 10, 2024
fc9720b
WIP
Paul-Bob Jan 13, 2024
04e7d7f
wip
Paul-Bob Jan 15, 2024
2f6dbc3
typo
Paul-Bob Jan 15, 2024
9826cdc
Merge branch 'main' into feature/audit_logs
Paul-Bob Jan 17, 2024
0070b19
WIP
Paul-Bob Jan 17, 2024
f64dfb8
WIP
Paul-Bob Jan 19, 2024
8d9248c
wip
Paul-Bob Jan 22, 2024
0771d63
Merge branch 'main' into feature/audit_logs
Paul-Bob Feb 15, 2024
2c9b896
wip
Paul-Bob Feb 16, 2024
361120a
wip
Paul-Bob Feb 16, 2024
0db29ba
Merge branch 'main' into feature/audit_logs
Paul-Bob Apr 2, 2024
4986af8
dont break if db do not exist
Paul-Bob Apr 2, 2024
16c3019
wip
Paul-Bob Apr 3, 2024
f88a17f
Merge branch 'main' into feature/audit_logs
Paul-Bob Apr 4, 2024
496f42d
rename package
Paul-Bob Apr 9, 2024
cdde642
Merge branch 'main' into feature/audit_logs
Paul-Bob Apr 11, 2024
da5f08f
Merge branch 'main' into feature/audit_logs
Paul-Bob May 13, 2024
58210f7
extract audit method and safe_call it
Paul-Bob May 13, 2024
53221df
register all activity
Paul-Bob May 14, 2024
70cd62c
Update app/components/avo/sidebar_component.html.erb
Paul-Bob May 14, 2024
f0ab0a2
Update lib/avo/configuration.rb
Paul-Bob May 14, 2024
f3c5e1c
Update lib/avo/configuration.rb
Paul-Bob May 14, 2024
8840724
Merge branch 'main' into feature/audit_logs
Paul-Bob May 14, 2024
5e614a4
Merge branch 'main' into feature/audit_logs
Paul-Bob Jun 20, 2024
bd07682
rename to avo-audit_logging
Paul-Bob Jun 20, 2024
dc2f288
feature: log attach and detach
Paul-Bob Jun 21, 2024
019ca76
Merge branch 'main' into feature/audit_logs
Paul-Bob Sep 11, 2024
6745d11
Merge branch 'main' into feature/audit_logs
Paul-Bob Sep 11, 2024
cf57fe1
Merge branch 'main' into feature/audit_logs
Paul-Bob Sep 13, 2024
6fc5c46
unbundle audits from enterprise license
Paul-Bob Sep 13, 2024
80b049a
implement gem configuration
Paul-Bob Sep 13, 2024
9595046
rm unused config attribute
Paul-Bob Sep 13, 2024
02d3595
clear template
Paul-Bob Sep 13, 2024
cefc4dd
extract direct call
Paul-Bob Sep 23, 2024
4dca585
remove direct audit call
Paul-Bob Sep 23, 2024
f03c4cc
rm set_paper_trail_whodunnit
Paul-Bob Sep 23, 2024
0d28364
revert safe_call enhancement
Paul-Bob Sep 23, 2024
415c940
Merge branch 'main' into feature/audit_logs
Paul-Bob Sep 23, 2024
d582db0
temporary solution for not defined audit
Paul-Bob Sep 23, 2024
8ed38be
Merge branch 'feature/audit_logs' of github.com:avo-hq/avo into featu…
Paul-Bob Sep 23, 2024
4d8728f
wip
Paul-Bob Sep 23, 2024
bc71d7a
.
Paul-Bob Sep 23, 2024
9db0654
lint
Paul-Bob Sep 23, 2024
e7f14ae
extract audit call
Paul-Bob Sep 24, 2024
6ecaf15
rm activity
Paul-Bob Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions app/controllers/avo/actions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ActionsController < ApplicationController
end
before_action :set_action, only: [:show, :handle]
before_action :verify_authorization, only: [:show, :handle]
before_action :set_query, :set_fields, only: :handle

layout :choose_layout

Expand Down Expand Up @@ -47,14 +48,11 @@ def build_background_url
end

def handle
resource_ids = action_params[:fields][:avo_resource_ids].split(",")

performed_action = @action.handle_action(
fields: action_params[:fields].except(:avo_resource_ids, :avo_selected_query),
fields: @fields,
current_user: _current_user,
resource: @resource,
query: decrypted_query ||
(resource_ids.any? ? @resource.find_record(resource_ids, params: params) : [])
query: @query
)

@response = performed_action.response
Expand All @@ -63,6 +61,16 @@ def handle

private

def set_query
resource_ids = action_params[:fields][:avo_resource_ids].split(",")

@query = decrypted_query || (resource_ids.any? ? @resource.find_record(resource_ids, params: params) : [])
end

def set_fields
@fields = action_params[:fields].except(:avo_resource_ids, :avo_selected_query)
end

def action_params
@action_params ||= params.permit(:id, :authenticity_token, :resource_name, :action_id, :button, fields: {})
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/avo_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ task "avo:sym_link" do

gem_paths = `bundle list --paths 2>/dev/null`.split("\n")

["avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu", "avo-kanban"].each do |gem|
["avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu", "avo-kanban", "avo-audit_logging"].each do |gem|
path = gem_paths.find { |gem_path| gem_path.include?("/#{gem}-") }

# If path is nil we check if package is defined outside of root (on release process it is)
Expand Down
Loading