mno-enterprise-api 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mno_enterprise/config.js.coffee.erb +8 -0
- data/app/controllers/mno_enterprise/admin/invoices_controller.rb +18 -0
- data/app/controllers/mno_enterprise/impersonate_controller.rb +5 -1
- data/app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb +9 -0
- data/app/controllers/mno_enterprise/jpi/v1/admin/users_controller.rb +10 -4
- data/app/controllers/mno_enterprise/jpi/v1/audit_events_controller.rb +28 -0
- data/app/controllers/mno_enterprise/jpi/v1/base_resource_controller.rb +1 -1
- data/app/controllers/mno_enterprise/webhook/events_controller.rb +7 -0
- data/app/views/mno_enterprise/auth/confirmations/lounge.html.haml +26 -25
- data/app/views/mno_enterprise/jpi/v1/admin/audit_events/_audit_event.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/admin/audit_events/index.csv.erb +14 -0
- data/app/views/mno_enterprise/jpi/v1/admin/organizations/_invoices.json.jbuilder +1 -0
- data/app/views/mno_enterprise/jpi/v1/admin/organizations/_organization.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder +1 -0
- data/app/views/mno_enterprise/jpi/v1/audit_events/_audit_event.json.jbuilder +5 -0
- data/app/views/mno_enterprise/jpi/v1/audit_events/index.csv.erb +12 -0
- data/app/views/mno_enterprise/jpi/v1/audit_events/index.json.jbuilder +4 -0
- data/app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/impac/widgets/_widget.json.jbuilder +3 -1
- data/app/views/mno_enterprise/jpi/v1/marketplace/_app.json.jbuilder +10 -1
- data/app/views/mno_enterprise/jpi/v1/organizations/_organization.json.jbuilder +1 -1
- data/app/views/mno_enterprise/webhook/o_auth/authorize.html.haml +1 -1
- data/config/routes.rb +16 -5
- data/lib/mno_enterprise/audit_events_listener.rb +11 -6
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb +6 -1
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/impac/kpis_controller.rb +9 -10
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/impac/widgets_controller.rb +6 -3
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/marketplace_controller.rb +20 -8
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/organizations_controller.rb +12 -0
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/teams_controller.rb +13 -0
- data/lib/mno_enterprise/concerns/controllers/pages_controller.rb +2 -0
- data/lib/mno_enterprise/concerns/controllers/webhook/events_controller.rb +22 -0
- data/lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb +12 -3
- data/lib/mno_enterprise/event_logger.rb +2 -2
- data/lib/mno_enterprise/intercom_events_listener.rb +25 -30
- data/spec/controllers/mno_enterprise/admin/invoices_controller_spec.rb +38 -0
- data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +6 -0
- data/spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb +9 -0
- data/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb +3 -2
- data/spec/controllers/mno_enterprise/jpi/v1/admin/users_controller_spec.rb +2 -1
- data/spec/controllers/mno_enterprise/jpi/v1/audit_events_controller_spec.rb +49 -0
- data/spec/controllers/mno_enterprise/jpi/v1/current_users_controller_spec.rb +16 -0
- data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +124 -89
- data/spec/controllers/mno_enterprise/jpi/v1/marketplace_controller_spec.rb +83 -36
- data/spec/controllers/mno_enterprise/jpi/v1/organizations_controller_spec.rb +18 -3
- data/spec/controllers/mno_enterprise/org_invites_controller_spec.rb +3 -3
- data/spec/controllers/mno_enterprise/provision_controller_spec.rb +2 -2
- data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -1
- data/spec/lib/mno_enterprise/audit_events_listener_spec.rb +11 -0
- data/spec/lib/mno_enterprise/intercom_events_listener_spec.rb +74 -31
- data/spec/routing/devise/registrations_routing_spec.rb +43 -6
- data/spec/routing/mno_enterprise/admin/invoices_controller_routing_spec.rb +11 -0
- data/spec/routing/mno_enterprise/impersonate_controller_routing_spec.rb +30 -4
- data/spec/routing/mno_enterprise/jpi/v1/audit_events_controller_routing_spec.rb +11 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1fc05e6d511ddaa9c90ac0eadcfa98f34164be
|
4
|
+
data.tar.gz: 7cd5ece7aef6ec8bedadb102135c9e1aae7de800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50da83dcdacab9f7e2a4c51a538a00e885a4360c5bb4c40335f635e357c8e67474638c7b4fffaea4f8b13be69ef7a577173d22a3722f305ac39f5290f7aa386
|
7
|
+
data.tar.gz: 04d2713f52f2bdb25d6605b8a9243e3b313e661aebf457cf4af81976ab9d3d74ba30f7952cd054eb6181d94d261dbb9da29713d24369fc6302975e795691c72f
|
@@ -11,8 +11,16 @@ angular.module('mnoEnterprise.configuration', [])
|
|
11
11
|
.constant('PRICING_CONFIG', <%= Hash(Settings.pricing).to_json %>)
|
12
12
|
.constant('DOCK_CONFIG', <%= Hash(Settings.dock).to_json %>)
|
13
13
|
.constant('DEVELOPER_SECTION_CONFIG', <%= Hash(Settings.developer).to_json %>)
|
14
|
+
.constant('ONBOARDING_WIZARD_CONFIG', <%= Hash(Settings.onboarding_wizard).to_json %>)
|
14
15
|
.constant('REVIEWS_CONFIG', <%= Hash(Settings.reviews).to_json %>)
|
16
|
+
.constant('QUESTIONS_CONFIG', <%= Hash(Settings.questions).to_json %>)
|
15
17
|
.constant('MARKETPLACE_CONFIG', <%= Hash(Settings.marketplace).to_json %>)
|
18
|
+
.constant('ADMIN_PANEL_CONFIG', <%= Hash(Settings.admin_panel).to_json %>)
|
19
|
+
.constant('PAYMENT_CONFIG', <%= Hash(Settings.payment).to_json %>)
|
20
|
+
.constant('ORGANIZATION_MANAGEMENT', <%= Hash(Settings.organization_management).to_json %>)
|
21
|
+
.constant('USER_MANAGEMENT', <%= Hash(Settings.user_management).to_json %>)
|
22
|
+
.constant('AUDIT_LOG', <%= Hash(Settings.audit_log).to_json %>)
|
16
23
|
.constant('GOOGLE_TAG_CONTAINER_ID', <%= MnoEnterprise.google_tag_container.to_json %>)
|
17
24
|
.constant('INTERCOM_ID', <%= MnoEnterprise.intercom_app_id.to_json %>)
|
18
25
|
.constant('APP_NAME', <%= MnoEnterprise.app_name.to_json %>)
|
26
|
+
.constant('URL_CONFIG', <%= Hash(Settings.url_config).to_json %>)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MnoEnterprise
|
2
|
+
class Admin::InvoicesController < MnoEnterprise::Jpi::V1::Admin::BaseResourceController
|
3
|
+
# GET /mnoe/invoices/201504-NU4
|
4
|
+
def show
|
5
|
+
@invoice = MnoEnterprise::Invoice.where(slug: params[:id].upcase).reload.first
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
if @invoice
|
9
|
+
filename = "Invoice - #{@invoice.slug}.pdf"
|
10
|
+
pdf_view = MnoEnterprise::InvoicePdf.new(@invoice).render
|
11
|
+
format.html { send_data pdf_view, filename: filename, type: "application/pdf", disposition: 'inline' }
|
12
|
+
else
|
13
|
+
format.html { redirect_to root_path, alert: 'Sorry, the page requested could not be displayed' }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -15,7 +15,11 @@ module MnoEnterprise
|
|
15
15
|
else
|
16
16
|
flash[:notice] = "User doesn't exist"
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
|
+
path = mnoe_home_path
|
20
|
+
path = add_param_to_fragment(path, 'dhbRefId', params[:dhbRefId]) if params[:dhbRefId].present?
|
21
|
+
|
22
|
+
redirect_to path
|
19
23
|
end
|
20
24
|
|
21
25
|
# Revert the user impersonation
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'csv'
|
1
2
|
module MnoEnterprise
|
2
3
|
class Jpi::V1::Admin::AuditEventsController < Jpi::V1::Admin::BaseResourceController
|
3
4
|
|
@@ -11,6 +12,14 @@ module MnoEnterprise
|
|
11
12
|
@audit_events = @audit_events.all.fetch
|
12
13
|
|
13
14
|
response.headers['X-Total-Count'] = @audit_events.metadata[:pagination][:count]
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.json
|
18
|
+
format.csv do
|
19
|
+
headers['Content-Disposition'] = 'attachment; filename="audit-log.csv"'
|
20
|
+
headers['Content-Type'] ||= 'text/csv'
|
21
|
+
end
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
end
|
@@ -29,7 +29,6 @@ module MnoEnterprise
|
|
29
29
|
# POST /mnoe/jpi/v1/admin/users
|
30
30
|
def create
|
31
31
|
@user = MnoEnterprise::User.build(user_create_params)
|
32
|
-
@user.admin_role = params[:user][:admin_role].presence
|
33
32
|
|
34
33
|
if @user.save
|
35
34
|
render :show
|
@@ -40,6 +39,7 @@ module MnoEnterprise
|
|
40
39
|
|
41
40
|
# PATCH /mnoe/jpi/v1/admin/users/:id
|
42
41
|
def update
|
42
|
+
# TODO: replace with authorize/ability
|
43
43
|
if current_user.admin_role == "admin"
|
44
44
|
@user = MnoEnterprise::User.find(params[:id])
|
45
45
|
@user.update(user_params)
|
@@ -79,9 +79,15 @@ module MnoEnterprise
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def user_create_params
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
attrs = [:name, :surname, :email, :phone]
|
83
|
+
|
84
|
+
# TODO: replace with authorize/ability
|
85
|
+
if current_user.admin_role == "admin"
|
86
|
+
attrs << :admin_role
|
87
|
+
end
|
88
|
+
|
89
|
+
params.require(:user).permit(attrs).merge(
|
90
|
+
password: Devise.friendly_token.first(12)
|
85
91
|
)
|
86
92
|
end
|
87
93
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module MnoEnterprise
|
2
|
+
class Jpi::V1::AuditEventsController < Jpi::V1::BaseResourceController
|
3
|
+
|
4
|
+
# GET /mnoe/jpi/v1/admin/audit_events
|
5
|
+
def index
|
6
|
+
@organization = MnoEnterprise::Organization.find(params.require(:organization_id))
|
7
|
+
|
8
|
+
authorize! :administrate, @organization
|
9
|
+
|
10
|
+
@audit_events = MnoEnterprise::AuditEvent.where(organization_id: @organization.id)
|
11
|
+
@audit_events = @audit_events.limit(params[:limit]) if params[:limit]
|
12
|
+
@audit_events = @audit_events.skip(params[:offset]) if params[:offset]
|
13
|
+
@audit_events = @audit_events.order_by(params[:order_by]) if params[:order_by]
|
14
|
+
@audit_events = @audit_events.where(params[:where]) if params[:where]
|
15
|
+
@audit_events = @audit_events.all.fetch
|
16
|
+
|
17
|
+
response.headers['X-Total-Count'] = @audit_events.metadata[:pagination][:count]
|
18
|
+
|
19
|
+
respond_to do |format|
|
20
|
+
format.json
|
21
|
+
format.csv do
|
22
|
+
headers['Content-Disposition'] = 'attachment; filename="audit-log.csv"'
|
23
|
+
headers['Content-Type'] ||= 'text/csv'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module MnoEnterprise
|
2
|
+
# The object received on this controller looks like Parameters: {"event"=>"", "object"=>{}, "metadata"={}}
|
3
|
+
class Webhook::EventsController < ApplicationController
|
4
|
+
include MnoEnterprise::Concerns::Controllers::Webhook::EventsController
|
5
|
+
# You can easily overwrite/extend this concern by inserting the code here
|
6
|
+
end
|
7
|
+
end
|
@@ -1,32 +1,33 @@
|
|
1
|
-
.
|
1
|
+
.registration
|
2
2
|
.container
|
3
3
|
.row
|
4
|
-
.
|
5
|
-
.
|
6
|
-
.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
.login-box-wrapper
|
5
|
+
.login-box-title
|
6
|
+
%h2= t('mno_enterprise.auth.confirmations.lounge.title')
|
7
|
+
.login-box
|
8
|
+
.brand-logo
|
9
|
+
%form
|
10
|
+
%label{ :style => "font-weight: normal;"}= t('mno_enterprise.auth.confirmations.lounge.subtitle')
|
11
11
|
%div{ 'ng-init' => "email = '#{@resource.email}'"}
|
12
|
-
= form_for(@resource, :as => resource_name, :url => mno_enterprise.user_confirmation_path, :html => { 'name' => 'form', :
|
12
|
+
= form_for(@resource, :as => resource_name, :url => mno_enterprise.user_confirmation_path, :html => { 'name' => 'form', class: 'form-horizontal', :autocomplete => "off" }) do |f|
|
13
|
+
|
13
14
|
- unless devise_error_messages!.empty?
|
14
|
-
|
15
|
+
.row
|
15
16
|
.alert.alert-error
|
16
|
-
%button.close
|
17
|
+
%button.close ×
|
17
18
|
= devise_error_messages!
|
18
19
|
.spacer2
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
%hr
|
21
|
+
.form-horizontal
|
22
|
+
.row
|
23
|
+
.text-center
|
24
|
+
.col-sm-12
|
25
|
+
%label{ :style => "font-weight: normal;"}= t('mno_enterprise.auth.confirmations.lounge.resend.description')
|
26
|
+
.col-sm-12
|
27
|
+
= f.email_field :email, :placeholder => "Email", :required => true, 'ng-model' => 'email', :class => 'form-control'
|
28
|
+
%br
|
29
|
+
.row
|
30
|
+
.col-sm-12
|
31
|
+
.text-center
|
32
|
+
%button{ :class => "btn btn-warning", :type => "submit", 'ng-click' => 'hasClicked = true', 'ng-disabled' => 'form.$invalid', 'ng-hide' => 'hasClicked' }= t('.resend.button')
|
33
|
+
%img.ng-hide{ 'ng-src' => asset_path('mno_enterprise/loader-32x32-bg-inverse.gif'), 'ng-show' => 'hasClicked' }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%- headers = ['Date', 'User', 'User email', 'Organization', 'Organization Name', 'Action', 'Description', 'Details'] -%>
|
2
|
+
<%= CSV.generate_line headers -%>
|
3
|
+
<%- @audit_events.each do |event| -%>
|
4
|
+
<%= CSV.generate_line([
|
5
|
+
event.created_at,
|
6
|
+
event.user[:name],
|
7
|
+
event.user[:email],
|
8
|
+
event.organization_id,
|
9
|
+
event.organization[:name],
|
10
|
+
event.key,
|
11
|
+
event.description,
|
12
|
+
event.formatted_details.present? ? %{#{event.formatted_details}} : event.metadata
|
13
|
+
]).html_safe -%>
|
14
|
+
<%- end -%>
|
@@ -1 +1 @@
|
|
1
|
-
json.extract! organization, :id, :name, :uid, :soa_enabled, :created_at
|
1
|
+
json.extract! organization, :id, :name, :uid, :soa_enabled, :created_at, :account_frozen
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%- headers = ['Date', 'User', 'User email', 'Action', 'Description', 'Details'] -%>
|
2
|
+
<%= CSV.generate_line headers -%>
|
3
|
+
<%- @audit_events.each do |event| -%>
|
4
|
+
<%= CSV.generate_line([
|
5
|
+
event.created_at,
|
6
|
+
event.user[:name],
|
7
|
+
event.user[:email],
|
8
|
+
event.key,
|
9
|
+
event.description,
|
10
|
+
event.formatted_details.present? ? %{#{event.formatted_details}} : event.metadata
|
11
|
+
]).html_safe -%>
|
12
|
+
<%- end -%>
|
@@ -27,7 +27,7 @@ json.cache! ['v1', @user.cache_key] do
|
|
27
27
|
# Embed association if user is persisted
|
28
28
|
if @user.id
|
29
29
|
json.organizations do
|
30
|
-
json.array! (@user.organizations || []) do |o|
|
30
|
+
json.array! (@user.organizations.active || []) do |o|
|
31
31
|
json.id o.id
|
32
32
|
json.uid o.uid
|
33
33
|
json.name o.name
|
@@ -1,4 +1,4 @@
|
|
1
1
|
json.ignore_nil!
|
2
2
|
json.extract! kpi, :id, :element_watched, :endpoint, :source, :targets, :settings, :extra_watchables, :extra_params
|
3
3
|
|
4
|
-
json.alerts kpi.alerts, partial: 'mno_enterprise/jpi/v1/impac/alerts/alert', as: :alert
|
4
|
+
json.alerts kpi.alerts, partial: 'mno_enterprise/jpi/v1/impac/alerts/alert', as: :alert if kpi.alerts.any?
|
@@ -1,6 +1,8 @@
|
|
1
1
|
json.id widget.id
|
2
2
|
json.name widget.name
|
3
|
-
json.
|
3
|
+
json.endpoint (widget.endpoint || widget.widget_category)
|
4
4
|
json.width widget.width
|
5
5
|
json.metadata widget.settings
|
6
6
|
json.owner widget.owner
|
7
|
+
|
8
|
+
json.kpis widget.kpis, partial: 'mno_enterprise/jpi/v1/impac/kpis/kpi', as: :kpi
|
@@ -1,7 +1,9 @@
|
|
1
1
|
json.extract! app, :id, :nid, :name, :stack, :key_benefits, :categories, :tags, :tiny_description,
|
2
|
-
:testimonials, :pictures, :pricing_plans, :rank
|
2
|
+
:testimonials, :pictures, :pricing_plans, :rank, :support_url, :key_workflows, :key_features
|
3
3
|
|
4
4
|
json.description markdown(app.sanitized_description)
|
5
|
+
json.known_limitations markdown(app.known_limitations)
|
6
|
+
json.getting_started markdown(app.getting_started)
|
5
7
|
|
6
8
|
json.is_responsive app.responsive?
|
7
9
|
json.is_star_ready app.star_ready?
|
@@ -11,8 +13,15 @@ json.single_billing app.single_billing?
|
|
11
13
|
json.multi_instantiable app.multi_instantiable
|
12
14
|
json.subcategories app.subcategories
|
13
15
|
json.average_rating app.average_rating
|
16
|
+
json.add_on app.add_on?
|
14
17
|
json.running_instances_count app.running_instances_count
|
15
18
|
|
19
|
+
json.shared_entities do
|
20
|
+
json.array! app.shared_entities do |shared_entity|
|
21
|
+
json.extract! shared_entity, :shared_entity_nid, :shared_entity_name, :write, :read
|
22
|
+
end
|
23
|
+
end if app.shared_entities.any?
|
24
|
+
|
16
25
|
if app.logo
|
17
26
|
json.logo app.logo.to_s
|
18
27
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
json.extract! organization, :id, :name, :soa_enabled, :payment_restriction #, :current_support_plan
|
1
|
+
json.extract! organization, :id, :name, :soa_enabled, :payment_restriction, :account_frozen #, :current_support_plan
|
2
2
|
# json.show_new_db_features !!organization.get_meta_data(:show_new_db_features)
|
3
3
|
# if organization.support_plan
|
4
4
|
# json.custom_training_credits organization.support_plan.custom_training_credits
|
data/config/routes.rb
CHANGED
@@ -26,20 +26,27 @@ MnoEnterprise::Engine.routes.draw do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# Invoices
|
30
|
+
namespace :admin do
|
31
|
+
resources :invoices, only: [:show], constraints: { id: /[\w\-]+/ }
|
32
|
+
end
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
unless Settings.try(:admin_panel).try(:impersonation).try(:disabled)
|
35
|
+
get "/impersonate/user/:user_id", to: "impersonate#create", as: :impersonate_user
|
36
|
+
get "/impersonate/revert", to: "impersonate#destroy", as: :revert_impersonate_user
|
37
|
+
end
|
33
38
|
|
34
39
|
#============================================================
|
35
40
|
# Devise/User Configuration
|
36
41
|
#============================================================
|
37
42
|
# Main devise configuration
|
43
|
+
skipped_devise_modules = [:omniauth_callbacks]
|
44
|
+
skipped_devise_modules << :registrations if Settings.try(:devise).try(:registration).try(:disabled)
|
38
45
|
devise_for :users, {
|
39
46
|
class_name: "MnoEnterprise::User",
|
40
47
|
module: :devise,
|
41
48
|
path_prefix: 'auth',
|
42
|
-
skip:
|
49
|
+
skip: skipped_devise_modules,
|
43
50
|
controllers: {
|
44
51
|
confirmations: "mno_enterprise/auth/confirmations",
|
45
52
|
omniauth_callbacks: "mno_enterprise/auth/omniauth_callbacks",
|
@@ -84,6 +91,8 @@ MnoEnterprise::Engine.routes.draw do
|
|
84
91
|
get :sync
|
85
92
|
end
|
86
93
|
end
|
94
|
+
# Maestrano-hub events
|
95
|
+
resources :events, only: [:create]
|
87
96
|
end
|
88
97
|
|
89
98
|
#============================================================
|
@@ -95,7 +104,7 @@ MnoEnterprise::Engine.routes.draw do
|
|
95
104
|
member do
|
96
105
|
%i(app_reviews app_feedbacks app_comments app_questions app_answers).each do |name|
|
97
106
|
resources name, except: [:new, :edit], param: :review_id
|
98
|
-
end
|
107
|
+
end
|
99
108
|
end
|
100
109
|
end
|
101
110
|
resource :current_user, only: [:show, :update] do
|
@@ -125,6 +134,8 @@ MnoEnterprise::Engine.routes.draw do
|
|
125
134
|
end
|
126
135
|
|
127
136
|
resources :app_instances_sync, only: [:create, :index]
|
137
|
+
|
138
|
+
resources :audit_events, only: [:index]
|
128
139
|
end
|
129
140
|
|
130
141
|
resources :deletion_requests, only: [:show, :create, :destroy] do
|
@@ -8,21 +8,26 @@ module MnoEnterprise
|
|
8
8
|
basic_auth MnoEnterprise.tenant_id, MnoEnterprise.tenant_key
|
9
9
|
|
10
10
|
def info(key, current_user_id, description, subject_type, subject_id, metadata)
|
11
|
-
|
11
|
+
organization_id = if (subject_type == 'MnoEnterprise::Organization') then
|
12
|
+
subject_id
|
13
|
+
elsif metadata.is_a?(Hash)
|
14
|
+
metadata[:organization_id].presence
|
15
|
+
end
|
16
|
+
body = {
|
12
17
|
data: {
|
13
18
|
key: key,
|
14
19
|
user_id: current_user_id,
|
15
20
|
description: description,
|
16
21
|
metadata: metadata,
|
17
22
|
subject_type: subject_type,
|
18
|
-
subject_id: subject_id
|
19
|
-
}
|
23
|
+
subject_id: subject_id,
|
24
|
+
}
|
25
|
+
}
|
26
|
+
body[:data][:organization_id] = organization_id if organization_id
|
27
|
+
self.class.post('', body: body)
|
20
28
|
rescue Net::ReadTimeout
|
21
29
|
# Meant to fail
|
22
30
|
end
|
23
|
-
|
24
31
|
end
|
25
|
-
|
26
|
-
|
27
32
|
end
|
28
33
|
|