mno-enterprise-api 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35fc216add77173460114179a66177c4691895a6
|
4
|
+
data.tar.gz: 3996b0e5569c9b6cffd7fd8fcf22924fdf34976d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8937e10a9c4baf22b1625d8b9b360a7441a5a42275e92fc2b720abcc06e7d308ceacfe777ec339b933e92f22c864f3e4397680c830f2b3f107af9748676e6c91
|
7
|
+
data.tar.gz: 1c8d427beae96bb414d9750ad19b01b81e4489d82aeca1a384e752b7b4412a680dbb675d0fdee06ceb5e7ed80ca21222e778241844d6a911f5cc265f949f9bd6
|
@@ -23,7 +23,7 @@ module MnoEnterprise
|
|
23
23
|
# GET /mnoe/jpi/v1/admin/organizations/1
|
24
24
|
def show
|
25
25
|
@organization = MnoEnterprise::Organization.find(params[:id])
|
26
|
-
@organization_active_apps = @organization.app_instances.
|
26
|
+
@organization_active_apps = @organization.app_instances.active.to_a
|
27
27
|
end
|
28
28
|
|
29
29
|
# GET /mnoe/jpi/v1/admin/organizations/in_arrears
|
@@ -40,10 +40,14 @@ module MnoEnterprise
|
|
40
40
|
|
41
41
|
# PATCH /mnoe/jpi/v1/admin/users/:id
|
42
42
|
def update
|
43
|
-
|
44
|
-
|
43
|
+
if current_user.admin_role == "admin"
|
44
|
+
@user = MnoEnterprise::User.find(params[:id])
|
45
|
+
@user.update(user_params)
|
45
46
|
|
46
|
-
|
47
|
+
render :show
|
48
|
+
else
|
49
|
+
render :index, status: :unauthorized
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
# DELETE /mnoe/jpi/v1/admin/users/1
|
@@ -92,16 +92,31 @@ module MnoEnterprise
|
|
92
92
|
|
93
93
|
describe 'PUT #update' do
|
94
94
|
subject { put :update, id: user.id, user: {admin_role: 'staff'} }
|
95
|
+
let(:current_user) { build(:user, :admin) }
|
95
96
|
|
96
97
|
before do
|
97
|
-
api_stub_for(
|
98
|
+
api_stub_for(get: "/users/#{current_user.id}", response: from_api(current_user))
|
99
|
+
sign_in current_user
|
100
|
+
|
101
|
+
user.admin_role = nil
|
102
|
+
api_stub_for(put: "/users/#{user.id}", response: -> { user.admin_role = 'staff'; from_api(user) })
|
98
103
|
subject
|
99
104
|
end
|
100
105
|
|
101
|
-
|
106
|
+
context 'when admin' do
|
107
|
+
it { expect(response).to be_success }
|
108
|
+
|
109
|
+
# Test that the user is updated by testing the api endpoint was called
|
110
|
+
it { expect(user.admin_role).to eq('staff') }
|
111
|
+
end
|
102
112
|
|
103
|
-
|
104
|
-
|
113
|
+
context 'when staff' do
|
114
|
+
let(:current_user) { build(:user, :staff) }
|
115
|
+
|
116
|
+
it { expect(response).to have_http_status(:unauthorized) }
|
117
|
+
|
118
|
+
it { expect(user.admin_role).to be_nil }
|
119
|
+
end
|
105
120
|
end
|
106
121
|
|
107
122
|
describe 'DELETE #destroy' do
|
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.1.
|
4
|
+
version: 3.1.1
|
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: 2016-
|
12
|
+
date: 2016-08-30 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.1.
|
20
|
+
version: 3.1.1
|
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.1.
|
27
|
+
version: 3.1.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: jbuilder
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|