-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(CE): add audit logs serializer and audit log permission (#426)
Co-authored-by: TivonB-AI2 <[email protected]>
- Loading branch information
1 parent
d7ec9c9
commit 7a2fdfa
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
# app/serializers/audit_logs_serializer.rb | ||
class AuditLogsSerializer < ActiveModel::Serializer | ||
attributes :id, :user_id, :action, :resource_type, :resource_id, :resource, :workspace_id, | ||
:metadata | ||
end |
63 changes: 63 additions & 0 deletions
63
server/db/data/20241022143042_add_audit_logs_permission_to_roles.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddAuditLogsPermissionToRoles < ActiveRecord::Migration[7.1] | ||
def change # rubocop:disable Metrics/MethodLength | ||
admin_role = Role.find_by(role_name: "Admin") | ||
member_role = Role.find_by(role_name: "Member") | ||
viewer_role = Role.find_by(role_name: "Viewer") | ||
|
||
admin_role&.update!( | ||
policies: { | ||
permissions: { | ||
connector_definition: { create: true, read: true, update: true, delete: true }, | ||
connector: { create: true, read: true, update: true, delete: true }, | ||
model: { create: true, read: true, update: true, delete: true }, | ||
report: { create: true, read: true, update: true, delete: true }, | ||
sync_record: { create: true, read: true, update: true, delete: true }, | ||
sync_run: { create: true, read: true, update: true, delete: true }, | ||
sync: { create: true, read: true, update: true, delete: true }, | ||
user: { create: true, read: true, update: true, delete: true }, | ||
workspace: { create: true, read: true, update: true, delete: true }, | ||
data_app: { create: true, read: true, update: true, delete: true }, | ||
audit_logs: { create: true, read: true, update: true, delete: true } | ||
} | ||
} | ||
) | ||
|
||
member_role&.update!( | ||
policies: { | ||
permissions: { | ||
connector_definition: { create: true, read: true, update: true, delete: true }, | ||
connector: { create: true, read: true, update: true, delete: true }, | ||
model: { create: true, read: true, update: true, delete: true }, | ||
report: { create: true, read: true, update: true, delete: true }, | ||
sync_record: { create: true, read: true, update: true, delete: true }, | ||
sync_run: { create: true, read: true, update: true, delete: true }, | ||
sync: { create: true, read: true, update: true, delete: true }, | ||
user: { create: false, read: true, update: false, delete: false }, | ||
workspace: { create: false, read: true, update: false, delete: false }, | ||
data_app: { create: true, read: true, update: true, delete: true }, | ||
audit_logs: { create: true, read: true, update: true, delete: true } | ||
} | ||
} | ||
) | ||
|
||
viewer_role&.update!( | ||
policies: { | ||
permissions: { | ||
connector_definition: { create: false, read: true, update: false, delete: false }, | ||
connector: { create: false, read: true, update: false, delete: false }, | ||
model: { create: false, read: true, update: false, delete: false }, | ||
report: { create: false, read: true, update: false, delete: false }, | ||
sync_record: { create: false, read: true, update: false, delete: false }, | ||
sync_run: { create: false, read: true, update: false, delete: false }, | ||
sync: { create: false, read: true, update: false, delete: false }, | ||
user: { create: false, read: true, update: false, delete: false }, | ||
workspace: { create: false, read: true, update: false, delete: false }, | ||
data_app: { create: false, read: true, update: false, delete: false }, | ||
audit_logs: { create: false, read: false, update: false, delete: false } | ||
} | ||
} | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
DataMigrate::Data.define(version: 20_240_903_055_705) | ||
DataMigrate::Data.define(version: 20_241_022_143_042) |