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
 
| 
         @@ -6,6 +6,8 @@ module MnoEnterprise 
     | 
|
| 
       6 
6 
     | 
    
         
             
                routes { MnoEnterprise::Engine.routes }
         
     | 
| 
       7 
7 
     | 
    
         
             
                before { request.env["HTTP_ACCEPT"] = 'application/json' }
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                include MnoEnterprise::ApplicationHelper # For #avatar_url
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       9 
11 
     | 
    
         
             
                def json_for(res)
         
     | 
| 
       10 
12 
     | 
    
         
             
                  json_hash_for(res).to_json
         
     | 
| 
       11 
13 
     | 
    
         
             
                end
         
     | 
| 
         @@ -28,7 +30,8 @@ module MnoEnterprise 
     | 
|
| 
       28 
30 
     | 
    
         
             
                      'country_code' => res.geo_country_code || 'US',
         
     | 
| 
       29 
31 
     | 
    
         
             
                      'website' => res.website,
         
     | 
| 
       30 
32 
     | 
    
         
             
                      'sso_session' => res.sso_session,
         
     | 
| 
       31 
     | 
    
         
            -
                      'admin_role' => res.admin_role
         
     | 
| 
      
 33 
     | 
    
         
            +
                      'admin_role' => res.admin_role,
         
     | 
| 
      
 34 
     | 
    
         
            +
                      'avatar_url' => avatar_url(res)
         
     | 
| 
       32 
35 
     | 
    
         
             
                  }
         
     | 
| 
       33 
36 
     | 
    
         | 
| 
       34 
37 
     | 
    
         
             
                  if res.id
         
     | 
| 
         @@ -46,7 +46,7 @@ module MnoEnterprise 
     | 
|
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                describe 'PUT #update' do
         
     | 
| 
       49 
     | 
    
         
            -
                  let(:kpi_hash) { from_api(kpi)[:data].except(:dashboard).merge( 
     | 
| 
      
 49 
     | 
    
         
            +
                  let(:kpi_hash) { from_api(kpi)[:data].except(:dashboard).merge(name: 'New Name') }
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                  subject { put :update, id: kpi.id, kpi: kpi_hash }
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
         @@ -59,7 +59,7 @@ module MnoEnterprise 
     | 
|
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                  it "updates the kpi" do
         
     | 
| 
       61 
61 
     | 
    
         
             
                    subject
         
     | 
| 
       62 
     | 
    
         
            -
                    expect(assigns(:kpi). 
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(assigns(:kpi).name).to eq('New Name')
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                  it { subject; expect(response.code).to eq('200') }
         
     | 
| 
         @@ -7,7 +7,7 @@ module MnoEnterprise 
     | 
|
| 
       7 
7 
     | 
    
         
             
                before { request.env["HTTP_ACCEPT"] = 'application/json' }
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                let!(:app) { build(:app) }
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
       11 
11 
     | 
    
         
             
                def markdown(text)
         
     | 
| 
       12 
12 
     | 
    
         
             
                  return text unless text.present?
         
     | 
| 
       13 
13 
     | 
    
         
             
                  HtmlProcessor.new(text, format: :markdown).html.html_safe
         
     | 
| 
         @@ -32,7 +32,8 @@ module MnoEnterprise 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    'description' => markdown(app.sanitized_description),
         
     | 
| 
       33 
33 
     | 
    
         
             
                    'testimonials' => app.testimonials,
         
     | 
| 
       34 
34 
     | 
    
         
             
                    'pictures' => app.pictures,
         
     | 
| 
       35 
     | 
    
         
            -
                    'pricing_plans' => app.pricing_plans
         
     | 
| 
      
 35 
     | 
    
         
            +
                    'pricing_plans' => app.pricing_plans,
         
     | 
| 
      
 36 
     | 
    
         
            +
                    'rank' => app.rank
         
     | 
| 
       36 
37 
     | 
    
         
             
                  }
         
     | 
| 
       37 
38 
     | 
    
         
             
                end
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
         @@ -111,5 +112,45 @@ module MnoEnterprise 
     | 
|
| 
       111 
112 
     | 
    
         
             
                    expect(JSON.parse(response.body)).to eq(JSON.parse(hash_for_app(app).to_json))
         
     | 
| 
       112 
113 
     | 
    
         
             
                  end
         
     | 
| 
       113 
114 
     | 
    
         
             
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
                 
         
     | 
| 
      
 116 
     | 
    
         
            +
                describe 'GET #index' do
         
     | 
| 
      
 117 
     | 
    
         
            +
                  subject { get :index }
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                  context 'when multiples apps' do 
         
     | 
| 
      
 120 
     | 
    
         
            +
                    let(:app1) { build(:app, rank: 5 ) }
         
     | 
| 
      
 121 
     | 
    
         
            +
                    let(:app2) { build(:app, rank: 0 ) }
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                    before do  
         
     | 
| 
      
 124 
     | 
    
         
            +
                      MnoEnterprise.marketplace_listing = nil
         
     | 
| 
      
 125 
     | 
    
         
            +
                      api_stub_for(get: '/apps', response: from_api([app1,app2]))
         
     | 
| 
      
 126 
     | 
    
         
            +
                    end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    it 'is successful' do
         
     | 
| 
      
 129 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 130 
     | 
    
         
            +
                      expect(response).to be_success
         
     | 
| 
      
 131 
     | 
    
         
            +
                    end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                    it 'returns the right response' do
         
     | 
| 
      
 134 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 135 
     | 
    
         
            +
                      expect(JSON.parse(response.body)).to eq(JSON.parse(hash_for_apps([app2, app1]).to_json))
         
     | 
| 
      
 136 
     | 
    
         
            +
                    end 
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
      
 138 
     | 
    
         
            +
                  
         
     | 
| 
      
 139 
     | 
    
         
            +
                  context 'when multiples apps and attributes nil' do 
         
     | 
| 
      
 140 
     | 
    
         
            +
                    let(:app1) { build(:app, rank: 5 ) }
         
     | 
| 
      
 141 
     | 
    
         
            +
                    let(:app2) { build(:app, rank: 0 ) }
         
     | 
| 
      
 142 
     | 
    
         
            +
                    let(:app3) { build(:app, rank: nil ) }
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
                    before do  
         
     | 
| 
      
 145 
     | 
    
         
            +
                      MnoEnterprise.marketplace_listing = nil
         
     | 
| 
      
 146 
     | 
    
         
            +
                      api_stub_for(get: '/apps', response: from_api([app1,app3,app2]))
         
     | 
| 
      
 147 
     | 
    
         
            +
                    end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                    it 'returns the right response' do
         
     | 
| 
      
 150 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 151 
     | 
    
         
            +
                      expect(JSON.parse(response.body)).to eq(JSON.parse(hash_for_apps([app2, app1, app3]).to_json))
         
     | 
| 
      
 152 
     | 
    
         
            +
                    end   
         
     | 
| 
      
 153 
     | 
    
         
            +
                  end
         
     | 
| 
      
 154 
     | 
    
         
            +
                end
         
     | 
| 
       114 
155 
     | 
    
         
             
              end
         
     | 
| 
       115 
156 
     | 
    
         
             
            end
         
     | 
| 
         @@ -9,10 +9,6 @@ module MnoEnterprise 
     | 
|
| 
       9 
9 
     | 
    
         
             
                render_views
         
     | 
| 
       10 
10 
     | 
    
         
             
                routes { MnoEnterprise::Engine.routes }
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                # Freeze time (JWT are time dependent)
         
     | 
| 
       13 
     | 
    
         
            -
                before { Timecop.freeze }
         
     | 
| 
       14 
     | 
    
         
            -
                after { Timecop.return }
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
12 
     | 
    
         
             
                # Stub controller ability
         
     | 
| 
       17 
13 
     | 
    
         
             
                let!(:ability) { stub_ability }
         
     | 
| 
       18 
14 
     | 
    
         
             
                let(:extra_params) { {some: 'param'} }
         
     | 
| 
         @@ -37,7 +33,7 @@ module MnoEnterprise 
     | 
|
| 
       37 
33 
     | 
    
         
             
                  it_behaves_like 'a user protected resource'
         
     | 
| 
       38 
34 
     | 
    
         | 
| 
       39 
35 
     | 
    
         
             
                  it { subject; expect(response).to be_success }
         
     | 
| 
       40 
     | 
    
         
            -
                  it { subject; expect(assigns(:redirect_to)).to eq(redirect_url) }
         
     | 
| 
      
 36 
     | 
    
         
            +
                  it { Timecop.freeze { subject; expect(assigns(:redirect_to)).to eq(redirect_url) } }
         
     | 
| 
       41 
37 
     | 
    
         | 
| 
       42 
38 
     | 
    
         
             
                  Webhook::OAuthController::PROVIDERS_WITH_OPTIONS.each do |provider|
         
     | 
| 
       43 
39 
     | 
    
         
             
                    describe "#{provider.capitalize} provider" do
         
     | 
| 
         @@ -13,10 +13,10 @@ module MnoEnterprise 
     | 
|
| 
       13 
13 
     | 
    
         
             
                def user_vars(user)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  { first_name: user.name, last_name: user.surname, full_name: "#{user.name} #{user.surname}".strip }
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       17 
17 
     | 
    
         
             
                def invite_vars(org_invite)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  new_user = !org_invite.user.confirmed?
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       20 
20 
     | 
    
         
             
                  {
         
     | 
| 
       21 
21 
     | 
    
         
             
                    organization: org_invite.organization.name,
         
     | 
| 
       22 
22 
     | 
    
         
             
                    team: org_invite.team ? org_invite.team.name : nil,
         
     | 
| 
         @@ -30,11 +30,11 @@ module MnoEnterprise 
     | 
|
| 
       30 
30 
     | 
    
         
             
                    invitee_email: org_invite.user.email,
         
     | 
| 
       31 
31 
     | 
    
         
             
                  }
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       34 
34 
     | 
    
         
             
                describe 'confirmation_instructions' do
         
     | 
| 
       35 
35 
     | 
    
         
             
                  describe 'new user' do
         
     | 
| 
       36 
36 
     | 
    
         
             
                    it 'sends the right email' do
         
     | 
| 
       37 
     | 
    
         
            -
                      expect( 
     | 
| 
      
 37 
     | 
    
         
            +
                      expect(MnoEnterprise::MailClient).to receive(:deliver).with('confirmation-instructions',
         
     | 
| 
       38 
38 
     | 
    
         
             
                        SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       39 
39 
     | 
    
         
             
                        { name: "#{user.name} #{user.surname}".strip, email: user.email },
         
     | 
| 
       40 
40 
     | 
    
         
             
                        user_vars(user).merge(confirmation_link: routes.user_confirmation_url(confirmation_token: token))
         
     | 
| 
         @@ -49,7 +49,7 @@ module MnoEnterprise 
     | 
|
| 
       49 
49 
     | 
    
         
             
                    before { allow_any_instance_of(MnoEnterprise::User).to receive(:unconfirmed_email?).and_return(true) }
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                    it 'sends the right email' do
         
     | 
| 
       52 
     | 
    
         
            -
                      expect( 
     | 
| 
      
 52 
     | 
    
         
            +
                      expect(MnoEnterprise::MailClient).to receive(:deliver).with('reconfirmation-instructions',
         
     | 
| 
       53 
53 
     | 
    
         
             
                        SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       54 
54 
     | 
    
         
             
                        { name: "#{user.name} #{user.surname}".strip, email: user.email },
         
     | 
| 
       55 
55 
     | 
    
         
             
                        user_vars(user).merge(confirmation_link: routes.user_confirmation_url(confirmation_token: token))
         
     | 
| 
         @@ -58,12 +58,11 @@ module MnoEnterprise 
     | 
|
| 
       58 
58 
     | 
    
         
             
                      subject.confirmation_instructions(user,token).deliver_now
         
     | 
| 
       59 
59 
     | 
    
         
             
                    end
         
     | 
| 
       60 
60 
     | 
    
         
             
                  end
         
     | 
| 
       61 
     | 
    
         
            -
                  
         
     | 
| 
       62 
61 
     | 
    
         
             
                end
         
     | 
| 
       63 
62 
     | 
    
         | 
| 
       64 
63 
     | 
    
         
             
                describe 'reset_password_instructions' do
         
     | 
| 
       65 
64 
     | 
    
         
             
                  it 'sends the right email' do
         
     | 
| 
       66 
     | 
    
         
            -
                    expect( 
     | 
| 
      
 65 
     | 
    
         
            +
                    expect(MnoEnterprise::MailClient).to receive(:deliver).with('reset-password-instructions',
         
     | 
| 
       67 
66 
     | 
    
         
             
                      SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       68 
67 
     | 
    
         
             
                      { name: "#{user.name} #{user.surname}".strip, email: user.email },
         
     | 
| 
       69 
68 
     | 
    
         
             
                      user_vars(user).merge(reset_password_link: routes.edit_user_password_url(reset_password_token: token))
         
     | 
| 
         @@ -75,7 +74,7 @@ module MnoEnterprise 
     | 
|
| 
       75 
74 
     | 
    
         | 
| 
       76 
75 
     | 
    
         
             
                describe 'unlock_instructions' do
         
     | 
| 
       77 
76 
     | 
    
         
             
                  it 'sends the right email' do
         
     | 
| 
       78 
     | 
    
         
            -
                    expect( 
     | 
| 
      
 77 
     | 
    
         
            +
                    expect(MnoEnterprise::MailClient).to receive(:deliver).with('unlock-instructions',
         
     | 
| 
       79 
78 
     | 
    
         
             
                      SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       80 
79 
     | 
    
         
             
                      { name: "#{user.name} #{user.surname}".strip, email: user.email },
         
     | 
| 
       81 
80 
     | 
    
         
             
                      user_vars(user).merge(unlock_link: routes.user_unlock_url(unlock_token: token))
         
     | 
| 
         @@ -91,7 +90,7 @@ module MnoEnterprise 
     | 
|
| 
       91 
90 
     | 
    
         | 
| 
       92 
91 
     | 
    
         
             
                  context 'when invitee is a confirmed user' do
         
     | 
| 
       93 
92 
     | 
    
         
             
                    it 'sends the right email' do
         
     | 
| 
       94 
     | 
    
         
            -
                      expect( 
     | 
| 
      
 93 
     | 
    
         
            +
                      expect(MnoEnterprise::MailClient).to receive(:deliver).with('organization-invite-existing-user',
         
     | 
| 
       95 
94 
     | 
    
         
             
                        SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       96 
95 
     | 
    
         
             
                        { name: "#{invitee.name} #{invitee.surname}".strip, email: invitee.email },
         
     | 
| 
       97 
96 
     | 
    
         
             
                        invite_vars(org_invite).merge(confirmation_link: routes.org_invite_url(id: org_invite.id, token: org_invite.token))
         
     | 
| 
         @@ -105,7 +104,7 @@ module MnoEnterprise 
     | 
|
| 
       105 
104 
     | 
    
         
             
                    let(:invitee) { build(:user, :unconfirmed) }
         
     | 
| 
       106 
105 
     | 
    
         | 
| 
       107 
106 
     | 
    
         
             
                    it 'sends the right email' do
         
     | 
| 
       108 
     | 
    
         
            -
                      expect( 
     | 
| 
      
 107 
     | 
    
         
            +
                      expect(MnoEnterprise::MailClient).to receive(:deliver).with('organization-invite-new-user',
         
     | 
| 
       109 
108 
     | 
    
         
             
                        SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       110 
109 
     | 
    
         
             
                        { email: invitee.email },
         
     | 
| 
       111 
110 
     | 
    
         
             
                        invite_vars(org_invite).merge(confirmation_link: routes.user_confirmation_url(confirmation_token: invitee.confirmation_token))
         
     | 
| 
         @@ -119,7 +118,7 @@ module MnoEnterprise 
     | 
|
| 
       119 
118 
     | 
    
         | 
| 
       120 
119 
     | 
    
         
             
                describe 'deletion_request_instructions' do
         
     | 
| 
       121 
120 
     | 
    
         
             
                  it 'sends the correct email' do
         
     | 
| 
       122 
     | 
    
         
            -
                    expect( 
     | 
| 
      
 121 
     | 
    
         
            +
                    expect(MnoEnterprise::MailClient).to receive(:deliver).with('deletion-request-instructions',
         
     | 
| 
       123 
122 
     | 
    
         
             
                      SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
       124 
123 
     | 
    
         
             
                      { name: "#{user.name} #{user.surname}".strip, email: user.email },
         
     | 
| 
       125 
124 
     | 
    
         
             
                      user_vars(user).merge(terminate_account_link: routes.deletion_request_url(deletion_request))
         
     | 
| 
         @@ -128,5 +127,18 @@ module MnoEnterprise 
     | 
|
| 
       128 
127 
     | 
    
         
             
                    subject.deletion_request_instructions(user,deletion_request).deliver_now
         
     | 
| 
       129 
128 
     | 
    
         
             
                  end
         
     | 
| 
       130 
129 
     | 
    
         
             
                end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                describe 'registration_instructions' do
         
     | 
| 
      
 132 
     | 
    
         
            +
                  it 'sends the correct email' do
         
     | 
| 
      
 133 
     | 
    
         
            +
                    expect(MnoEnterprise::MailClient).to receive(:deliver).with(
         
     | 
| 
      
 134 
     | 
    
         
            +
                        'registration-instructions',
         
     | 
| 
      
 135 
     | 
    
         
            +
                        SystemNotificationMailer::DEFAULT_SENDER,
         
     | 
| 
      
 136 
     | 
    
         
            +
                        { email: 'test@example.com' },
         
     | 
| 
      
 137 
     | 
    
         
            +
                        { registration_link: routes.new_user_registration_url }
         
     | 
| 
      
 138 
     | 
    
         
            +
                    )
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                    subject.registration_instructions('test@example.com').deliver_now
         
     | 
| 
      
 141 
     | 
    
         
            +
                  end
         
     | 
| 
      
 142 
     | 
    
         
            +
                end
         
     | 
| 
       131 
143 
     | 
    
         
             
              end
         
     | 
| 
       132 
144 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module MnoEnterprise
         
     | 
| 
      
 4 
     | 
    
         
            +
              RSpec.describe Jpi::V1::Admin::InvitesController do
         
     | 
| 
      
 5 
     | 
    
         
            +
                routes { MnoEnterprise::Engine.routes }
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                it 'routes to #create' do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(post('/jpi/v1/admin/organizations/1/users/2/invites')).to route_to('mno_enterprise/jpi/v1/admin/invites#create', organization_id: '1', user_id: '2', format: 'json')
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -19,5 +19,13 @@ module MnoEnterprise 
     | 
|
| 
       19 
19 
     | 
    
         
             
                it 'routes to #count' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                  expect(get('/jpi/v1/admin/organizations/count')).to route_to("mno_enterprise/jpi/v1/admin/organizations#count", format: 'json')
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                it 'routes to #create' do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(post('/jpi/v1/admin/organizations')).to route_to("mno_enterprise/jpi/v1/admin/organizations#create", format: 'json')
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                it 'routes to #invite_member' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect(post('/jpi/v1/admin/organizations/1/users')).to route_to("mno_enterprise/jpi/v1/admin/organizations#invite_member", id: '1', format: 'json')
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
       22 
30 
     | 
    
         
             
              end
         
     | 
| 
       23 
31 
     | 
    
         
             
            end
         
     | 
| 
         @@ -23,5 +23,9 @@ module MnoEnterprise 
     | 
|
| 
       23 
23 
     | 
    
         
             
                it 'routes to #count' do
         
     | 
| 
       24 
24 
     | 
    
         
             
                  expect(get('/jpi/v1/admin/users/count')).to route_to("mno_enterprise/jpi/v1/admin/users#count", format: 'json')
         
     | 
| 
       25 
25 
     | 
    
         
             
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                it 'routes to #signup_email' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect(post('/jpi/v1/admin/users/signup_email')).to route_to("mno_enterprise/jpi/v1/admin/users#signup_email", format: 'json')
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
       26 
30 
     | 
    
         
             
              end
         
     | 
| 
       27 
31 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mno-enterprise-api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Arnaud Lachaume
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2016-07-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: mno-enterprise-core
         
     | 
| 
         @@ -17,14 +17,14 @@ dependencies: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                requirements:
         
     | 
| 
       18 
18 
     | 
    
         
             
                - - '='
         
     | 
| 
       19 
19 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       20 
     | 
    
         
            -
                    version: 3.0 
     | 
| 
      
 20 
     | 
    
         
            +
                    version: 3.1.0
         
     | 
| 
       21 
21 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       22 
22 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       23 
23 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       24 
24 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
25 
     | 
    
         
             
                - - '='
         
     | 
| 
       26 
26 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version: 3.0 
     | 
| 
      
 27 
     | 
    
         
            +
                    version: 3.1.0
         
     | 
| 
       28 
28 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       29 
29 
     | 
    
         
             
              name: jbuilder
         
     | 
| 
       30 
30 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -73,14 +73,14 @@ dependencies: 
     | 
|
| 
       73 
73 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
74 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       75 
75 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       76 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 76 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
       77 
77 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       78 
78 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       79 
79 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       80 
80 
     | 
    
         
             
                requirements:
         
     | 
| 
       81 
81 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       82 
82 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       83 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 83 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
       84 
84 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       85 
85 
     | 
    
         
             
              name: httparty
         
     | 
| 
       86 
86 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -133,6 +133,7 @@ files: 
     | 
|
| 
       133 
133 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb
         
     | 
| 
       134 
134 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/base_resource_controller.rb
         
     | 
| 
       135 
135 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - app/controllers/mno_enterprise/jpi/v1/admin/invites_controller.rb
         
     | 
| 
       136 
137 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb
         
     | 
| 
       137 
138 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb
         
     | 
| 
       138 
139 
     | 
    
         
             
            - app/controllers/mno_enterprise/jpi/v1/admin/tenant_invoices_controller.rb
         
     | 
| 
         @@ -173,11 +174,11 @@ files: 
     | 
|
| 
       173 
174 
     | 
    
         
             
            - app/views/mno_enterprise/auth/sessions/_form.html.haml
         
     | 
| 
       174 
175 
     | 
    
         
             
            - app/views/mno_enterprise/auth/sessions/new.html.haml
         
     | 
| 
       175 
176 
     | 
    
         
             
            - app/views/mno_enterprise/auth/shared/_links.html.haml
         
     | 
| 
       176 
     | 
    
         
            -
            - app/views/mno_enterprise/auth/unlocks/_form.html.haml
         
     | 
| 
       177 
177 
     | 
    
         
             
            - app/views/mno_enterprise/auth/unlocks/new.html.haml
         
     | 
| 
       178 
178 
     | 
    
         
             
            - app/views/mno_enterprise/deletion_requests/show.html.haml
         
     | 
| 
       179 
179 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/audit_events/_audit_event.json.jbuilder
         
     | 
| 
       180 
180 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/audit_events/index.json.jbuilder
         
     | 
| 
      
 181 
     | 
    
         
            +
            - app/views/mno_enterprise/jpi/v1/admin/base_resource/_member.json.jbuilder
         
     | 
| 
       181 
182 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/cloud_apps/_cloud_app.json.jbuilder
         
     | 
| 
       182 
183 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/cloud_apps/index.json.jbuilder
         
     | 
| 
       183 
184 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/cloud_apps/show.json.jbuilder
         
     | 
| 
         @@ -186,10 +187,10 @@ files: 
     | 
|
| 
       186 
187 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/invoices/show.json.jbuilder
         
     | 
| 
       187 
188 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/_credit_card.json.jbuilder
         
     | 
| 
       188 
189 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/_invoices.json.jbuilder
         
     | 
| 
       189 
     | 
    
         
            -
            - app/views/mno_enterprise/jpi/v1/admin/organizations/_member.json.jbuilder
         
     | 
| 
       190 
190 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/_organization.json.jbuilder
         
     | 
| 
       191 
191 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/in_arrears.json.jbuilder
         
     | 
| 
       192 
192 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/index.json.jbuilder
         
     | 
| 
      
 193 
     | 
    
         
            +
            - app/views/mno_enterprise/jpi/v1/admin/organizations/invite_member.json.jbuilder
         
     | 
| 
       193 
194 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/organizations/show.json.jbuilder
         
     | 
| 
       194 
195 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/tenant_invoices/_tenant_invoice.json.jbuilder
         
     | 
| 
       195 
196 
     | 
    
         
             
            - app/views/mno_enterprise/jpi/v1/admin/tenant_invoices/index.json.jbuilder
         
     | 
| 
         @@ -269,6 +270,7 @@ files: 
     | 
|
| 
       269 
270 
     | 
    
         
             
            - spec/controllers/mno_enterprise/impersonate_controller_spec.rb
         
     | 
| 
       270 
271 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
         
     | 
| 
       271 
272 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller_spec.rb
         
     | 
| 
      
 273 
     | 
    
         
            +
            - spec/controllers/mno_enterprise/jpi/v1/admin/invites_controller_spec.rb
         
     | 
| 
       272 
274 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/invoices_controller_spec.rb
         
     | 
| 
       273 
275 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb
         
     | 
| 
       274 
276 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/tenant_invoices_controller_spec.rb
         
     | 
| 
         @@ -299,6 +301,7 @@ files: 
     | 
|
| 
       299 
301 
     | 
    
         
             
            - spec/routing/mno_enterprise/impersonate_controller_routing_spec.rb
         
     | 
| 
       300 
302 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/audit_events_controller_routing_spec.rb
         
     | 
| 
       301 
303 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/cloud_apps_controller_routing_spec.rb
         
     | 
| 
      
 304 
     | 
    
         
            +
            - spec/routing/mno_enterprise/jpi/v1/admin/invites_controller_routing_spec.rb
         
     | 
| 
       302 
305 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/invoices_controller_routing_spec.rb
         
     | 
| 
       303 
306 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/organizations_controller_routing_spec.rb
         
     | 
| 
       304 
307 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/tenant_invoices_controller_routing_spec.rb
         
     | 
| 
         @@ -355,6 +358,7 @@ test_files: 
     | 
|
| 
       355 
358 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/audit_events_controller_routing_spec.rb
         
     | 
| 
       356 
359 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/theme_controller_routing_spec.rb
         
     | 
| 
       357 
360 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/invoices_controller_routing_spec.rb
         
     | 
| 
      
 361 
     | 
    
         
            +
            - spec/routing/mno_enterprise/jpi/v1/admin/invites_controller_routing_spec.rb
         
     | 
| 
       358 
362 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/users_controller_routing_spec.rb
         
     | 
| 
       359 
363 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/admin/cloud_apps_controller_routing_spec.rb
         
     | 
| 
       360 
364 
     | 
    
         
             
            - spec/routing/mno_enterprise/jpi/v1/current_users_controller_routing_spec.rb
         
     | 
| 
         @@ -385,6 +389,7 @@ test_files: 
     | 
|
| 
       385 
389 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
         
     | 
| 
       386 
390 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller_spec.rb
         
     | 
| 
       387 
391 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb
         
     | 
| 
      
 392 
     | 
    
         
            +
            - spec/controllers/mno_enterprise/jpi/v1/admin/invites_controller_spec.rb
         
     | 
| 
       388 
393 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/invoices_controller_spec.rb
         
     | 
| 
       389 
394 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/tenant_invoices_controller_spec.rb
         
     | 
| 
       390 
395 
     | 
    
         
             
            - spec/controllers/mno_enterprise/jpi/v1/admin/users_controller_spec.rb
         
     | 
| 
         @@ -1,10 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
         
     | 
| 
       2 
     | 
    
         
            -
              = devise_error_messages!
         
     | 
| 
       3 
     | 
    
         
            -
              %div
         
     | 
| 
       4 
     | 
    
         
            -
                = f.email_field :email, :placeholder => "Email", :required => true, 'ng-model' => 'email', :class => 'form-control'
         
     | 
| 
       5 
     | 
    
         
            -
              %br
         
     | 
| 
       6 
     | 
    
         
            -
              %br/
         
     | 
| 
       7 
     | 
    
         
            -
              %div
         
     | 
| 
       8 
     | 
    
         
            -
                %button{ :class => "btn btn-warning btn-login", :type => "submit", 'ng-click' => 'hasClicked = true', 'ng-hide' => 'hasClicked' }
         
     | 
| 
       9 
     | 
    
         
            -
                  = t('mno_enterprise.auth.unlocks.new.unlock')
         
     | 
| 
       10 
     | 
    
         
            -
                %img.ng-hide{ 'ng-src' => asset_path('mno_enterprise/loader-32x32-bg-inverse.gif'), 'ng-show' => 'hasClicked' }
         
     | 
| 
         @@ -1,14 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            if member.is_a?(MnoEnterprise::User)
         
     | 
| 
       2 
     | 
    
         
            -
              json.id member.id
         
     | 
| 
       3 
     | 
    
         
            -
              json.uid member.uid
         
     | 
| 
       4 
     | 
    
         
            -
              json.entity 'User'
         
     | 
| 
       5 
     | 
    
         
            -
              json.name member.name
         
     | 
| 
       6 
     | 
    
         
            -
              json.surname member.surname
         
     | 
| 
       7 
     | 
    
         
            -
              json.email member.email
         
     | 
| 
       8 
     | 
    
         
            -
              json.role member.role(organization)
         
     | 
| 
       9 
     | 
    
         
            -
            elsif member.is_a?(MnoEnterprise::OrgInvite)
         
     | 
| 
       10 
     | 
    
         
            -
              json.id member.id
         
     | 
| 
       11 
     | 
    
         
            -
              json.entity 'OrgInvite'
         
     | 
| 
       12 
     | 
    
         
            -
              json.email member.user_email
         
     | 
| 
       13 
     | 
    
         
            -
              json.role member.user_role
         
     | 
| 
       14 
     | 
    
         
            -
            end
         
     |