mno-enterprise-api 3.0.7 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mno_enterprise/config.js.coffee.erb +2 -0
- data/app/controllers/mno_enterprise/impersonate_controller.rb +1 -2
- data/app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb +2 -2
- data/app/controllers/mno_enterprise/jpi/v1/admin/invites_controller.rb +50 -0
- data/app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb +13 -27
- data/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb +82 -1
- data/app/controllers/mno_enterprise/jpi/v1/admin/users_controller.rb +9 -1
- data/app/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller.rb +2 -2
- data/app/controllers/mno_enterprise/jpi/v1/marketplace_controller.rb +1 -1
- data/app/controllers/mno_enterprise/status_controller.rb +2 -4
- data/app/views/mno_enterprise/auth/confirmations/_form.html.haml +2 -2
- data/app/views/mno_enterprise/auth/registrations/_form.html.haml +1 -1
- data/app/views/mno_enterprise/auth/unlocks/new.html.haml +11 -11
- data/app/views/mno_enterprise/jpi/v1/admin/base_resource/_member.json.jbuilder +28 -0
- data/app/views/mno_enterprise/jpi/v1/admin/organizations/invite_member.json.jbuilder +3 -0
- data/app/views/mno_enterprise/jpi/v1/admin/organizations/show.json.jbuilder +2 -2
- data/app/views/mno_enterprise/jpi/v1/admin/users/_user.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder +2 -1
- data/app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder +1 -0
- data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/marketplace/_app.json.jbuilder +1 -1
- data/app/views/mno_enterprise/jpi/v1/organizations/_credit_card.json.jbuilder +2 -2
- data/config/initializers/health_check.rb +5 -3
- data/config/routes.rb +8 -1
- data/lib/mno_enterprise/concerns/controllers/jpi/v1/organizations_controller.rb +0 -1
- data/lib/mno_enterprise/concerns/mailers/system_notification_mailer.rb +19 -5
- data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +4 -14
- data/spec/controllers/mno_enterprise/jpi/v1/admin/invites_controller_spec.rb +63 -0
- data/spec/controllers/mno_enterprise/jpi/v1/admin/invoices_controller_spec.rb +4 -14
- data/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb +65 -0
- data/spec/controllers/mno_enterprise/jpi/v1/admin/users_controller_spec.rb +16 -16
- data/spec/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller_spec.rb +14 -22
- data/spec/controllers/mno_enterprise/jpi/v1/current_users_controller_spec.rb +4 -1
- data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +2 -2
- data/spec/controllers/mno_enterprise/jpi/v1/marketplace_controller_spec.rb +43 -2
- data/spec/controllers/mno_enterprise/pages_controller_spec.rb +0 -4
- data/spec/controllers/mno_enterprise/status_controller_spec.rb +0 -4
- data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -5
- data/spec/mailer/mno_enterprise/system_notification_mailer_spec.rb +23 -11
- data/spec/routing/mno_enterprise/jpi/v1/admin/invites_controller_routing_spec.rb +11 -0
- data/spec/routing/mno_enterprise/jpi/v1/admin/organizations_controller_routing_spec.rb +8 -0
- data/spec/routing/mno_enterprise/jpi/v1/admin/users_controller_routing_spec.rb +4 -0
- metadata +13 -8
- data/app/views/mno_enterprise/auth/unlocks/_form.html.haml +0 -10
- data/app/views/mno_enterprise/jpi/v1/admin/organizations/_member.json.jbuilder +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0b34731abb419f0c73fd4df71ebb069e531efe0
|
4
|
+
data.tar.gz: 3e20d7533d0c64aef461de97bb9559d31f894929
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b2d455051e5434e13bdef392524ec18b8d576e55ddc325ebde46df41b55858a103b9a8749853281740570e1da42739505f34ffe7becbb302983cca932618f2
|
7
|
+
data.tar.gz: 42f2b1aab4920f54304191e9fad4f39e98128afd74a99a71dd2a2b50acfa0c500fbd93476488ac5a58d9c26d3343f5921b2f65ada23f8cc2d31993ae7293d41f
|
@@ -8,3 +8,5 @@ angular.module('mnoEnterprise.configuration', [])
|
|
8
8
|
enabled: <%= MnoEnterprise.i18n_enabled %>,
|
9
9
|
available_locales: <%= I18n.available_locales.to_json %>
|
10
10
|
})
|
11
|
+
.constant('PRICING_CONFIG', <%= Settings.pricing.to_json %>)
|
12
|
+
.constant('GOOGLE_TAG_CONTAINER_ID', <%= MnoEnterprise.google_tag_container.to_json %>)
|
@@ -8,7 +8,6 @@ module MnoEnterprise
|
|
8
8
|
# Perform the user impersonate action
|
9
9
|
# GET /impersonate/user/123
|
10
10
|
def create
|
11
|
-
session[:impersonator_redirect_path] = params[:redirect_path].presence
|
12
11
|
@user = MnoEnterprise::User.find(params[:user_id])
|
13
12
|
if @user.present?
|
14
13
|
impersonate(@user)
|
@@ -25,7 +24,7 @@ module MnoEnterprise
|
|
25
24
|
# user = current_user
|
26
25
|
revert_impersonate
|
27
26
|
end
|
28
|
-
redirect_to
|
27
|
+
redirect_to '/admin/'
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module MnoEnterprise
|
2
2
|
class Jpi::V1::Admin::AuditEventsController < Jpi::V1::Admin::BaseResourceController
|
3
|
-
|
3
|
+
|
4
4
|
# GET /mnoe/jpi/v1/admin/audit_events
|
5
5
|
def index
|
6
6
|
@audit_events = MnoEnterprise::AuditEvent
|
@@ -8,7 +8,7 @@ module MnoEnterprise
|
|
8
8
|
@audit_events = @audit_events.skip(params[:offset]) if params[:offset]
|
9
9
|
@audit_events = @audit_events.order_by(params[:order_by]) if params[:order_by]
|
10
10
|
@audit_events = @audit_events.where(params[:where]) if params[:where]
|
11
|
-
@audit_events = @audit_events.all
|
11
|
+
@audit_events = @audit_events.all
|
12
12
|
|
13
13
|
response.headers['X-Total-Count'] = @audit_events.metadata[:pagination][:count]
|
14
14
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module MnoEnterprise::Jpi::V1::Admin
|
2
|
+
# Manage invitation sending
|
3
|
+
class InvitesController < BaseResourceController
|
4
|
+
def create
|
5
|
+
@organization = MnoEnterprise::Organization.find(params[:organization_id])
|
6
|
+
user = MnoEnterprise::User.find(params[:user_id])
|
7
|
+
return render json: {error: 'Could not find account or user'}, status: :not_found unless @organization && user
|
8
|
+
|
9
|
+
if user.confirmation_required?
|
10
|
+
user.resend_confirmation_instructions
|
11
|
+
else
|
12
|
+
invite = find_org_invite(@organization, user)
|
13
|
+
return render json: {error: 'No active invitation found'}, status: :not_found unless invite
|
14
|
+
send_org_invite(invite)
|
15
|
+
end
|
16
|
+
|
17
|
+
MnoEnterprise::EventLogger.info('user_invite', current_user.id, 'User invited', {user_email: user.email, account_name: @organization.name}, user)
|
18
|
+
|
19
|
+
@user = user.confirmed? ? invite : user.reload
|
20
|
+
|
21
|
+
render 'mno_enterprise/jpi/v1/admin/organizations/invite_member'
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Invite for unconfirmed users are automatically accepted
|
27
|
+
def find_org_invite(organization, user)
|
28
|
+
if user.confirmed?
|
29
|
+
status_scope = { 'status.in' => %w(staged pending) }
|
30
|
+
else
|
31
|
+
status_scope = { status: 'accepted' }
|
32
|
+
end
|
33
|
+
organization.org_invites.where(status_scope.merge(user_id: user.id)).first
|
34
|
+
end
|
35
|
+
|
36
|
+
# Send the org invite and update the status
|
37
|
+
def send_org_invite(invite)
|
38
|
+
user = invite.user
|
39
|
+
# Generate token if not generated
|
40
|
+
user.send(:generate_confirmation_token!) if !user.confirmed? && user.confirmation_token.blank?
|
41
|
+
|
42
|
+
MnoEnterprise::SystemNotificationMailer.organization_invite(invite).deliver_later
|
43
|
+
|
44
|
+
# Update staged invite status
|
45
|
+
return unless invite.status == 'staged'
|
46
|
+
invite.status = 'pending'
|
47
|
+
invite.save
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -13,49 +13,35 @@ module MnoEnterprise
|
|
13
13
|
|
14
14
|
# GET /mnoe/jpi/v1/admin/invoices/current_billing_amount
|
15
15
|
def current_billing_amount
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
render json:
|
16
|
+
data = Rails.cache.fetch('tenant_admin/current_billing_amount', expires_in: ADMIN_CACHE_DURATION) do
|
17
|
+
billing = MnoEnterprise::Organization.all.map(&:current_billing).sum(Money.new(0))
|
18
|
+
{current_billing_amount: {amount: billing.amount, currency: billing.currency_as_string}}
|
19
|
+
end
|
20
|
+
render json: data
|
21
21
|
end
|
22
22
|
|
23
23
|
# GET /mnoe/jpi/v1/admin/invoices/last_invoicing_amount
|
24
24
|
def last_invoicing_amount
|
25
|
-
tenant_billing = tenant.last_customers_invoicing_amount
|
26
|
-
render json: {last_invoicing_amount:
|
25
|
+
tenant_billing = MnoEnterprise::Tenant.get('tenant').last_customers_invoicing_amount
|
26
|
+
render json: {last_invoicing_amount: {amount: tenant_billing.amount, currency: tenant_billing.currency_as_string}}
|
27
27
|
end
|
28
28
|
|
29
29
|
# GET /mnoe/jpi/v1/admin/invoices/outstanding_amount
|
30
30
|
def outstanding_amount
|
31
|
-
tenant_billing = tenant.last_customers_outstanding_amount
|
32
|
-
render json: {outstanding_amount:
|
31
|
+
tenant_billing = MnoEnterprise::Tenant.get('tenant').last_customers_outstanding_amount
|
32
|
+
render json: {outstanding_amount: {amount: tenant_billing.amount, currency: tenant_billing.currency_as_string}}
|
33
33
|
end
|
34
34
|
|
35
35
|
# GET /mnoe/jpi/v1/admin/invoices/last_portfolio_amount
|
36
36
|
def last_portfolio_amount
|
37
|
-
tenant_billing = tenant.last_portfolio_amount
|
38
|
-
render json: {last_portfolio_amount:
|
37
|
+
tenant_billing = MnoEnterprise::Tenant.get('tenant').last_portfolio_amount
|
38
|
+
render json: {last_portfolio_amount: {amount: tenant_billing.amount, currency: tenant_billing.currency_as_string}}
|
39
39
|
end
|
40
40
|
|
41
41
|
# GET /mnoe/jpi/v1/admin/invoices/last_commission_amount
|
42
42
|
def last_commission_amount
|
43
|
-
tenant_billing = tenant.last_commission_amount
|
44
|
-
render json: {last_commission_amount:
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def tenant
|
50
|
-
@tenant ||= MnoEnterprise::Tenant.show
|
51
|
-
end
|
52
|
-
|
53
|
-
def format_money(money)
|
54
|
-
if money
|
55
|
-
{amount: money.amount, currency: money.currency_as_string}
|
56
|
-
else
|
57
|
-
{amount: 'N/A', currency: ''}
|
58
|
-
end
|
43
|
+
tenant_billing = MnoEnterprise::Tenant.get('tenant').last_commission_amount
|
44
|
+
render json: {last_commission_amount: {amount: tenant_billing.amount, currency: tenant_billing.currency_as_string}}
|
59
45
|
end
|
60
46
|
end
|
61
47
|
end
|
@@ -15,7 +15,7 @@ module MnoEnterprise
|
|
15
15
|
@organizations = @organizations.skip(params[:offset]) if params[:offset]
|
16
16
|
@organizations = @organizations.order_by(params[:order_by]) if params[:order_by]
|
17
17
|
@organizations = @organizations.where(params[:where]) if params[:where]
|
18
|
-
@organizations = @organizations.all
|
18
|
+
@organizations = @organizations.all
|
19
19
|
response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count]
|
20
20
|
end
|
21
21
|
end
|
@@ -36,5 +36,86 @@ module MnoEnterprise
|
|
36
36
|
organizations_count = MnoEnterprise::Tenant.get('tenant').organizations_count
|
37
37
|
render json: {count: organizations_count }
|
38
38
|
end
|
39
|
+
|
40
|
+
# POST /mnoe/jpi/v1/admin/organizations
|
41
|
+
def create
|
42
|
+
# Create new organization
|
43
|
+
@organization = MnoEnterprise::Organization.create(organization_update_params)
|
44
|
+
|
45
|
+
# OPTIMIZE: move this into a delayed job?
|
46
|
+
update_app_list
|
47
|
+
|
48
|
+
@organization_active_apps = @organization.app_instances
|
49
|
+
|
50
|
+
render 'show'
|
51
|
+
end
|
52
|
+
|
53
|
+
# POST /mnoe/jpi/v1/admin/organizations/1/users
|
54
|
+
# Invite a user to the organization (and create it if needed)
|
55
|
+
# This does not send any emails (emails are manually triggered later)
|
56
|
+
def invite_member
|
57
|
+
@organization = MnoEnterprise::Organization.find(params[:id])
|
58
|
+
|
59
|
+
# Find or create a new user - We create it in the frontend as MnoHub will send confirmation instructions for newly
|
60
|
+
# created users
|
61
|
+
user = MnoEnterprise::User.find_by(email: user_params[:email]) || create_unconfirmed_user(user_params)
|
62
|
+
|
63
|
+
# Create the invitation
|
64
|
+
invite = @organization.org_invites.create(
|
65
|
+
user_email: user.email,
|
66
|
+
user_role: params[:user][:role],
|
67
|
+
referrer_id: current_user.id,
|
68
|
+
status: 'staged' # Will be updated to 'accepted' for unconfirmed users
|
69
|
+
)
|
70
|
+
|
71
|
+
@user = user.confirmed? ? invite : user.reload
|
72
|
+
end
|
73
|
+
|
74
|
+
protected
|
75
|
+
def organization_permitted_update_params
|
76
|
+
[:name]
|
77
|
+
end
|
78
|
+
|
79
|
+
def organization_update_params
|
80
|
+
params.fetch(:organization, {}).permit(*organization_permitted_update_params)
|
81
|
+
end
|
82
|
+
|
83
|
+
def user_params
|
84
|
+
params.require(:user).permit(:email, :name, :surname, :phone)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Create an unconfirmed user and skip the confirmation notification
|
88
|
+
# TODO: monkey patch User#confirmation_required? to simplify this? Use refinements?
|
89
|
+
def create_unconfirmed_user(user_params)
|
90
|
+
user = MnoEnterprise::User.new(user_params)
|
91
|
+
user.skip_confirmation_notification!
|
92
|
+
user.save
|
93
|
+
|
94
|
+
# Reset the confirmation field so we can track when the invite is send - #confirmation_sent_at is when the confirmation_token was generated (not sent)
|
95
|
+
# Not ideal as we do 2 saves, and the previous save trigger a call to the backend to validate the token uniqueness
|
96
|
+
user.assign_attributes(confirmation_sent_at: nil, confirmation_token: nil)
|
97
|
+
user.save
|
98
|
+
user
|
99
|
+
end
|
100
|
+
|
101
|
+
# Update App List to match the list passed in params
|
102
|
+
def update_app_list
|
103
|
+
# Differentiate between a null app_nids params and no app_nids params
|
104
|
+
if params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))
|
105
|
+
|
106
|
+
existing_apps = @organization.app_instances.active
|
107
|
+
|
108
|
+
existing_apps.each do |app_instance|
|
109
|
+
desired_nids.delete(app_instance.app.nid) || app_instance.terminate
|
110
|
+
end
|
111
|
+
|
112
|
+
desired_nids.each do |nid|
|
113
|
+
@organization.app_instances.create(product: nid)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Force reload
|
117
|
+
existing_apps.reload
|
118
|
+
end
|
119
|
+
end
|
39
120
|
end
|
40
121
|
end
|
@@ -15,7 +15,7 @@ module MnoEnterprise
|
|
15
15
|
@users = @users.skip(params[:offset]) if params[:offset]
|
16
16
|
@users = @users.order_by(params[:order_by]) if params[:order_by]
|
17
17
|
@users = @users.where(params[:where]) if params[:where]
|
18
|
-
@users = @users.all
|
18
|
+
@users = @users.all
|
19
19
|
response.headers['X-Total-Count'] = @users.metadata[:pagination][:count]
|
20
20
|
end
|
21
21
|
end
|
@@ -60,6 +60,14 @@ module MnoEnterprise
|
|
60
60
|
render json: {count: users_count }
|
61
61
|
end
|
62
62
|
|
63
|
+
# POST /mnoe/jpi/v1/admin/users/signup_email
|
64
|
+
# Send an email to a user with the link to the registration page
|
65
|
+
def signup_email
|
66
|
+
MnoEnterprise::SystemNotificationMailer.registration_instructions(params.require(:user).require(:email)).deliver_later
|
67
|
+
|
68
|
+
head :no_content
|
69
|
+
end
|
70
|
+
|
63
71
|
private
|
64
72
|
|
65
73
|
def user_params
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module MnoEnterprise
|
2
2
|
class Jpi::V1::AppInstancesSyncController < Jpi::V1::BaseResourceController
|
3
|
-
CONNECTOR_STATUS_RUNNING = ['PENDING', 'RUNNING']
|
4
3
|
|
5
4
|
# GET /mnoe/jpi/v1/organization/org-fbba/app_instances_sync
|
6
5
|
def index
|
@@ -29,8 +28,9 @@ module MnoEnterprise
|
|
29
28
|
def results(connectors)
|
30
29
|
{
|
31
30
|
connectors: connectors,
|
32
|
-
is_syncing: connectors.any?
|
31
|
+
is_syncing: connectors.any?{|c| c[:status]=="RUNNING" }
|
33
32
|
}
|
34
33
|
end
|
34
|
+
|
35
35
|
end
|
36
36
|
end
|
@@ -9,7 +9,7 @@ module MnoEnterprise
|
|
9
9
|
else
|
10
10
|
MnoEnterprise::App.all.to_a
|
11
11
|
end
|
12
|
-
|
12
|
+
@apps.sort_by! { |app| [app.rank ? 0 : 1 , app.rank] } # the nil ranks will appear at the end
|
13
13
|
@categories = MnoEnterprise::App.categories(@apps)
|
14
14
|
@categories.delete('Most Popular')
|
15
15
|
end
|
@@ -13,15 +13,13 @@ module MnoEnterprise
|
|
13
13
|
# {
|
14
14
|
# 'app-version': '9061048-6811c4a',
|
15
15
|
# 'mno-enterprise-version': '0.0.1',
|
16
|
-
# 'env': 'test'
|
17
|
-
# 'mno-api-host': 'https://uat.maestrano.io'
|
16
|
+
# 'env': 'test'
|
18
17
|
# }
|
19
18
|
def version
|
20
19
|
data = {
|
21
20
|
'app-version' => MnoEnterprise::APP_VERSION,
|
22
21
|
'mno-enteprise-version' => MnoEnterprise::VERSION,
|
23
|
-
'env' => Rails.env
|
24
|
-
'mno-api-host' => MnoEnterprise.mno_api_host
|
22
|
+
'env' => Rails.env
|
25
23
|
}
|
26
24
|
render json: data
|
27
25
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%div{ 'ng-init' => "user = { $pwdScore: {}, name: '#{resource.name}', surname: '#{resource.surname}'
|
1
|
+
%div{ 'ng-init' => "user = { $pwdScore: {}, name: '#{resource.name}', surname: '#{resource.surname}' }" }
|
2
2
|
|
3
3
|
= form_for(resource, as: resource_name, :url => mno_enterprise.user_confirmation_finalize_path, :html => { 'name' => 'loginForm', :class => 'autofill-detect text-center' }) do |f|
|
4
4
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
.col-sm-12
|
19
19
|
.phone
|
20
20
|
= f.select :phone_country_code, options_for_select(Country.all.map { |country,code| c = Country.new(code); ["#{c.alpha2} +#{c.country_code}", code]}, MnoEnterprise.app_country), {}, class: 'form-control unstyled'
|
21
|
-
= f.text_field :phone, placeholder: "*Phone", required: true, 'ng-model' => 'user.
|
21
|
+
= f.text_field :phone, placeholder: "*Phone", required: true, 'ng-model' => 'user.phone_number', class: 'form-control'
|
22
22
|
|
23
23
|
%br
|
24
24
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
.checkbox-section.text-center
|
26
26
|
= check_box_tag 'tos', 'accept', false, :required => true, :style => "margin-top: -3px;", 'ng-model' => 'acceptTos'
|
27
27
|
%label{for: 'tos'}= t('mno_enterprise.auth.registrations.new.user_accept')
|
28
|
-
= link_to t('
|
28
|
+
= link_to t('.tos'), MnoEnterprise.router.terms_url, target: '_blank'
|
29
29
|
|
30
30
|
%br
|
31
31
|
.row
|
@@ -1,11 +1,11 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
%h2= t('.title')
|
2
|
+
= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
|
3
|
+
= devise_error_messages!
|
4
|
+
.field
|
5
|
+
= f.label :email
|
6
|
+
%br/
|
7
|
+
= f.email_field :email, autofocus: true
|
8
|
+
.actions
|
9
|
+
= f.submit t('.unlock')
|
10
|
+
|
11
|
+
= render "devise/shared/links"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
if member.is_a?(MnoEnterprise::User)
|
2
|
+
json.uid member.uid
|
3
|
+
json.entity 'User'
|
4
|
+
json.role member.role(organization) if organization
|
5
|
+
|
6
|
+
status = case
|
7
|
+
when member.confirmed? then 'active'
|
8
|
+
when member.confirmation_sent_at.nil? then 'pending'
|
9
|
+
when member.confirmation_sent_at.present? then 'invited'
|
10
|
+
end
|
11
|
+
|
12
|
+
user = member
|
13
|
+
|
14
|
+
elsif member.is_a?(MnoEnterprise::OrgInvite)
|
15
|
+
json.entity 'OrgInvite'
|
16
|
+
json.role member.user_role
|
17
|
+
|
18
|
+
status = case member.status
|
19
|
+
when 'staged' then 'pending'
|
20
|
+
when 'pending' then 'invited'
|
21
|
+
when 'accepted' then 'active'
|
22
|
+
end
|
23
|
+
|
24
|
+
user = member.user
|
25
|
+
end
|
26
|
+
|
27
|
+
json.extract! user, :id, :created_at, :email, :name, :surname
|
28
|
+
json.status status
|
@@ -1,10 +1,10 @@
|
|
1
1
|
json.organization do
|
2
2
|
json.partial! 'organization', organization: @organization
|
3
|
-
json.members @organization.members, partial: 'member', as: :member, organization: @organization
|
3
|
+
json.members @organization.members(true), partial: 'member', as: :member, organization: @organization
|
4
4
|
json.partial! 'credit_card', credit_card: @organization.credit_card
|
5
5
|
json.partial! 'invoices', organization: @organization
|
6
6
|
json.active_apps @organization_active_apps do |instance|
|
7
|
-
json.extract! instance, :id, :name, :stack, :uid
|
7
|
+
json.extract! instance, :id, :name, :stack, :uid, :status, :oauth_keys_valid
|
8
8
|
json.app_name instance.app.name
|
9
9
|
json.app_logo instance.app.logo
|
10
10
|
end
|
@@ -1 +1 @@
|
|
1
|
-
json.extract! user, :id, :uid, :email, :name, :surname, :admin_role, :created_at
|
1
|
+
json.extract! user, :id, :uid, :email, :phone, :name, :surname, :admin_role, :created_at, :confirmed_at, :last_sign_in_at
|