maestrano-connector-rails 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/maestrano/account/group_users_controller.rb +2 -2
- data/app/controllers/maestrano/account/groups_controller.rb +3 -3
- data/maestrano-connector-rails.gemspec +4 -2
- data/spec/controllers/group_users_controller_spec.rb +39 -0
- data/spec/controllers/groups_controller_spec.rb +36 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10545da2fb0a9de8fdd05ee7fced909eee0ba976
|
4
|
+
data.tar.gz: d5b49147ff797a4a120c66a7d7508f968d03fed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9768a574a8b656df7b32893759bcfd6f9564ec1e1e75e29b2fcc7f3313b22f3f07a9c11984e004298746cb7890aec36c3f07d441897667f16888eee7b66b999b
|
7
|
+
data.tar.gz: 5e064f3e79676cb28125dc3e0accc57f86a1c18cf0f6cae7016fea4c7814c406c4f0e9c7c150d09612c3fd8ede3119aa5c0f80b958e78851d9714465c8738bf9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.8
|
@@ -9,8 +9,8 @@ class Maestrano::Account::GroupUsersController < Maestrano::Rails::WebHookContro
|
|
9
9
|
group_uid = params[:group_id]
|
10
10
|
|
11
11
|
# Get the entities
|
12
|
-
user = User.
|
13
|
-
organization = Organization.
|
12
|
+
user = Maestrano::Connector::Rails::User.find_by_uid_and_tenant(user_uid, params[:tenant] || 'default')
|
13
|
+
organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(group_uid, params[:tenant] || 'default')
|
14
14
|
|
15
15
|
# Remove the user from the organization
|
16
16
|
organization.remove_member(user)
|
@@ -5,13 +5,13 @@ class Maestrano::Account::GroupsController < Maestrano::Rails::WebHookController
|
|
5
5
|
# Delete an entire group
|
6
6
|
def destroy
|
7
7
|
# id
|
8
|
-
|
8
|
+
org_uid = params[:id]
|
9
9
|
|
10
10
|
# Get entity
|
11
|
-
organization = Organization.
|
11
|
+
organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, params[:tenant] || 'default')
|
12
12
|
|
13
13
|
# Delete all relations
|
14
|
-
organization.
|
14
|
+
organization.user_organization_rels.delete_all
|
15
15
|
|
16
16
|
# Delete the organization
|
17
17
|
organization.destroy
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: maestrano-connector-rails 0.3.
|
5
|
+
# stub: maestrano-connector-rails 0.3.8 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "maestrano-connector-rails"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.8"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -98,6 +98,8 @@ Gem::Specification.new do |s|
|
|
98
98
|
"pkg/maestrano-connector-rails-0.2.16.gem",
|
99
99
|
"pkg/maestrano-connector-rails-0.2.4.gem",
|
100
100
|
"spec/controllers/connec_controller_spec.rb",
|
101
|
+
"spec/controllers/group_users_controller_spec.rb",
|
102
|
+
"spec/controllers/groups_controller_spec.rb",
|
101
103
|
"spec/dummy/README.md",
|
102
104
|
"spec/dummy/Rakefile",
|
103
105
|
"spec/dummy/app/assets/images/.keep",
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Maestrano::Account::GroupUsersController, type: :controller do
|
4
|
+
routes { Maestrano::Connector::Rails::Engine.routes }
|
5
|
+
|
6
|
+
describe "destroy" do
|
7
|
+
let!(:organization) { create(:organization, uid: 'cld-abc', tenant: 'abc') }
|
8
|
+
let!(:user) { create(:user, tenant: 'abc', uid: 'usr-nnc') }
|
9
|
+
let(:params) { {tenant: organization.tenant, group_id: organization.uid, id: user.uid} }
|
10
|
+
subject { delete :destroy, params }
|
11
|
+
|
12
|
+
before {
|
13
|
+
controller.class.skip_before_filter :authenticate_maestrano!
|
14
|
+
organization.add_member(user)
|
15
|
+
}
|
16
|
+
|
17
|
+
it 'is successful' do
|
18
|
+
subject
|
19
|
+
expect(response).to be_success
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'destroys the user_organization_rels' do
|
23
|
+
expect{ subject }.to change{ Maestrano::Connector::Rails::UserOrganizationRel.count }.by(-1)
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'with default tenant' do
|
27
|
+
before {
|
28
|
+
organization.update(tenant: 'default')
|
29
|
+
user.update(tenant: 'default')
|
30
|
+
}
|
31
|
+
let(:params) { {group_id: organization.uid, id: user.uid} }
|
32
|
+
|
33
|
+
it 'destroys the organization' do
|
34
|
+
expect{ subject }.to change{ Maestrano::Connector::Rails::UserOrganizationRel.count }.by(-1)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Maestrano::Account::GroupsController, type: :controller do
|
4
|
+
routes { Maestrano::Connector::Rails::Engine.routes }
|
5
|
+
|
6
|
+
describe "destroy" do
|
7
|
+
let!(:organization) { create(:organization, uid: 'cld-abc', tenant: 'abc') }
|
8
|
+
let(:params) { {tenant: organization.tenant, id: organization.uid} }
|
9
|
+
subject { delete :destroy, params }
|
10
|
+
|
11
|
+
before {
|
12
|
+
controller.class.skip_before_filter :authenticate_maestrano!
|
13
|
+
}
|
14
|
+
|
15
|
+
it 'is successful' do
|
16
|
+
subject
|
17
|
+
expect(response).to be_success
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'destroys the organization' do
|
21
|
+
expect{ subject }.to change{ Maestrano::Connector::Rails::Organization.count }.by(-1)
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with default tenant' do
|
25
|
+
before {
|
26
|
+
organization.update(tenant: 'default')
|
27
|
+
}
|
28
|
+
let(:params) { {id: organization.uid} }
|
29
|
+
|
30
|
+
it 'destroys the organization' do
|
31
|
+
expect{ subject }.to change{ Maestrano::Connector::Rails::Organization.count }.by(-1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maestrano-connector-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Berard
|
@@ -308,6 +308,8 @@ files:
|
|
308
308
|
- pkg/maestrano-connector-rails-0.2.16.gem
|
309
309
|
- pkg/maestrano-connector-rails-0.2.4.gem
|
310
310
|
- spec/controllers/connec_controller_spec.rb
|
311
|
+
- spec/controllers/group_users_controller_spec.rb
|
312
|
+
- spec/controllers/groups_controller_spec.rb
|
311
313
|
- spec/dummy/README.md
|
312
314
|
- spec/dummy/Rakefile
|
313
315
|
- spec/dummy/app/assets/images/.keep
|