arpa 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +42 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +138 -0
- data/Rakefile +2 -0
- data/arpa.gemspec +33 -0
- data/lib/arpa.rb +91 -0
- data/lib/arpa/additions/resource.rb +29 -0
- data/lib/arpa/assets/stylesheets/ar_accordion.scss +80 -0
- data/lib/arpa/controllers/profiles_controller.rb +106 -0
- data/lib/arpa/controllers/resources_controller.rb +47 -0
- data/lib/arpa/controllers/roles_controller.rb +106 -0
- data/lib/arpa/data_mappers/action_mapper.rb +13 -0
- data/lib/arpa/data_mappers/base.rb +117 -0
- data/lib/arpa/data_mappers/profile_mapper.rb +14 -0
- data/lib/arpa/data_mappers/resource_mapper.rb +11 -0
- data/lib/arpa/data_mappers/role_mapper.rb +14 -0
- data/lib/arpa/entities/action.rb +24 -0
- data/lib/arpa/entities/permissions.rb +35 -0
- data/lib/arpa/entities/profile.rb +22 -0
- data/lib/arpa/entities/resource.rb +58 -0
- data/lib/arpa/entities/role.rb +28 -0
- data/lib/arpa/exceptions/record_invalid.rb +13 -0
- data/lib/arpa/repositories/actions/creator.rb +18 -0
- data/lib/arpa/repositories/actions/finder.rb +23 -0
- data/lib/arpa/repositories/actions/remover.rb +22 -0
- data/lib/arpa/repositories/actions/repository_action.rb +15 -0
- data/lib/arpa/repositories/base.rb +15 -0
- data/lib/arpa/repositories/profiles/creator.rb +18 -0
- data/lib/arpa/repositories/profiles/finder.rb +29 -0
- data/lib/arpa/repositories/profiles/remover.rb +29 -0
- data/lib/arpa/repositories/profiles/repository_profile.rb +12 -0
- data/lib/arpa/repositories/profiles/updater.rb +23 -0
- data/lib/arpa/repositories/registrator.rb +44 -0
- data/lib/arpa/repositories/resources/creator.rb +18 -0
- data/lib/arpa/repositories/resources/finder.rb +45 -0
- data/lib/arpa/repositories/resources/remover.rb +22 -0
- data/lib/arpa/repositories/resources/repository_resource.rb +12 -0
- data/lib/arpa/repositories/roles/creator.rb +18 -0
- data/lib/arpa/repositories/roles/finder.rb +29 -0
- data/lib/arpa/repositories/roles/remover.rb +29 -0
- data/lib/arpa/repositories/roles/repository_role.rb +13 -0
- data/lib/arpa/repositories/roles/updater.rb +23 -0
- data/lib/arpa/services/actions/create/action_creator.rb +50 -0
- data/lib/arpa/services/actions/remove/action_remover.rb +24 -0
- data/lib/arpa/services/base.rb +41 -0
- data/lib/arpa/services/profiles/create/profile_creator.rb +32 -0
- data/lib/arpa/services/profiles/profile_manager_creator.rb +22 -0
- data/lib/arpa/services/profiles/profile_manager_remover.rb +24 -0
- data/lib/arpa/services/profiles/profile_manager_updater.rb +22 -0
- data/lib/arpa/services/profiles/remove/profile_remover.rb +25 -0
- data/lib/arpa/services/profiles/update/profile_updater.rb +32 -0
- data/lib/arpa/services/resources/create/resource_creator.rb +42 -0
- data/lib/arpa/services/resources/remove/resource_remover.rb +31 -0
- data/lib/arpa/services/resources/resource_manager_creator.rb +50 -0
- data/lib/arpa/services/roles/create/role_creator.rb +33 -0
- data/lib/arpa/services/roles/remove/role_remover.rb +25 -0
- data/lib/arpa/services/roles/role_manager_creator.rb +23 -0
- data/lib/arpa/services/roles/role_manager_remover.rb +23 -0
- data/lib/arpa/services/roles/role_manager_updater.rb +22 -0
- data/lib/arpa/services/roles/update/role_updater.rb +32 -0
- data/lib/arpa/services/verifier.rb +24 -0
- data/lib/arpa/validators/action_validator.rb +17 -0
- data/lib/arpa/validators/profile_validator.rb +19 -0
- data/lib/arpa/validators/resource_validator.rb +17 -0
- data/lib/arpa/validators/role_validator.rb +20 -0
- data/lib/arpa/version.rb +3 -0
- data/lib/arpa/views/profiles/_form.html.erb +41 -0
- data/lib/arpa/views/profiles/edit.html.erb +6 -0
- data/lib/arpa/views/profiles/index.html.erb +29 -0
- data/lib/arpa/views/profiles/new.html.erb +5 -0
- data/lib/arpa/views/profiles/show.html.erb +37 -0
- data/lib/arpa/views/resources/index.html.erb +27 -0
- data/lib/arpa/views/resources/show.html.erb +33 -0
- data/lib/arpa/views/roles/_form.html.erb +55 -0
- data/lib/arpa/views/roles/edit.html.erb +6 -0
- data/lib/arpa/views/roles/index.html.erb +29 -0
- data/lib/arpa/views/roles/new.html.erb +5 -0
- data/lib/arpa/views/roles/show.html.erb +37 -0
- data/lib/config/locales/arpa.en.yml +38 -0
- data/lib/generators/ar/install_generator.rb +74 -0
- data/lib/generators/ar/templates/migration.rb +48 -0
- data/spec/factories/repository_actions.rb +19 -0
- data/spec/factories/repository_profiles.rb +11 -0
- data/spec/factories/repository_resources.rb +15 -0
- data/spec/factories/repository_roles.rb +11 -0
- data/spec/lib/ar/additions/resource_spec.rb +34 -0
- data/spec/lib/ar/data_mappers/action_mapper_spec.rb +46 -0
- data/spec/lib/ar/data_mappers/base_spec.rb +47 -0
- data/spec/lib/ar/data_mappers/profile_mapper_spec.rb +43 -0
- data/spec/lib/ar/data_mappers/resource_mapper_spec.rb +38 -0
- data/spec/lib/ar/data_mappers/role_mapper_spec.rb +47 -0
- data/spec/lib/ar/entities/action_spec.rb +19 -0
- data/spec/lib/ar/entities/permissions_spec.rb +61 -0
- data/spec/lib/ar/entities/resource_spec.rb +35 -0
- data/spec/lib/ar/repositories/actions/finder_spec.rb +40 -0
- data/spec/lib/ar/repositories/base_spec.rb +37 -0
- data/spec/lib/ar/repositories/profiles/finder_spec.rb +43 -0
- data/spec/lib/ar/repositories/profiles/remover_spec.rb +31 -0
- data/spec/lib/ar/repositories/resources/finder_spec.rb +92 -0
- data/spec/lib/ar/repositories/resources/remover_spec.rb +38 -0
- data/spec/lib/ar/repositories/roles/finder_spec.rb +43 -0
- data/spec/lib/ar/repositories/roles/remover_spec.rb +31 -0
- data/spec/lib/ar/requests/profiles/create_request_spec.rb +51 -0
- data/spec/lib/ar/requests/profiles/remove_request_spec.rb +36 -0
- data/spec/lib/ar/requests/resources/create_request_spec.rb +107 -0
- data/spec/lib/ar/requests/roles/create_request_spec.rb +40 -0
- data/spec/lib/ar/requests/roles/remove_request_spec.rb +23 -0
- data/spec/lib/ar/requests/roles/update_request_spec.rb +50 -0
- data/spec/lib/ar/services/actions/create/action_creator_spec.rb +88 -0
- data/spec/lib/ar/services/actions/remove/action_remover_spec.rb +36 -0
- data/spec/lib/ar/services/base_spec.rb +94 -0
- data/spec/lib/ar/services/profiles/create/profile_creator_spec.rb +68 -0
- data/spec/lib/ar/services/profiles/profile_manager_creator_spec.rb +31 -0
- data/spec/lib/ar/services/profiles/profile_manager_remover_spec.rb +44 -0
- data/spec/lib/ar/services/profiles/profile_manager_updater_spec.rb +31 -0
- data/spec/lib/ar/services/profiles/remove/profile_remover_spec.rb +45 -0
- data/spec/lib/ar/services/profiles/update/profile_updater_spec.rb +68 -0
- data/spec/lib/ar/services/resources/create/resource_creator_spec.rb +87 -0
- data/spec/lib/ar/services/resources/remove/resource_remover_spec.rb +50 -0
- data/spec/lib/ar/services/resources/resource_manager_creator_spec.rb +71 -0
- data/spec/lib/ar/services/roles/create/role_creator_spec.rb +68 -0
- data/spec/lib/ar/services/roles/remove/role_remover_spec.rb +50 -0
- data/spec/lib/ar/services/roles/role_manager_creator_spec.rb +31 -0
- data/spec/lib/ar/services/roles/role_manager_remover_spec.rb +32 -0
- data/spec/lib/ar/services/roles/role_manager_updater_spec.rb +31 -0
- data/spec/lib/ar/services/roles/update/role_updater_spec.rb +68 -0
- data/spec/lib/ar/services/verifier_spec.rb +44 -0
- data/spec/lib/ar/validators/action_validator_spec.rb +15 -0
- data/spec/lib/ar/validators/profile_validator_spec.rb +16 -0
- data/spec/lib/ar/validators/resource_validator_spec.rb +15 -0
- data/spec/lib/ar/validators/role_validator_spec.rb +16 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/repositories/test_repository.rb +2 -0
- data/spec/support/schema.rb +58 -0
- metadata +380 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Services::Roles::RoleManagerCreator, type: :service, fast: true do
|
4
|
+
|
5
|
+
let(:role_creator) { double }
|
6
|
+
let(:params) { {role: {name: 'role_name', description: 'role_description', action_ids: [1, 2]}} }
|
7
|
+
let(:success_proc) { ->(r) {} }
|
8
|
+
let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
|
9
|
+
|
10
|
+
let(:setup_creators) do
|
11
|
+
allow(Arpa::Services::Roles::Create::RoleCreator).to receive(:new).and_return(role_creator)
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:setup_creators_methods) do
|
15
|
+
allow(role_creator).to receive(:create)
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:result) { subject.create params, callback }
|
19
|
+
|
20
|
+
before do
|
21
|
+
setup_creators
|
22
|
+
setup_creators_methods
|
23
|
+
allow(success_proc).to receive(:call)
|
24
|
+
result
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'role_creator should call :create with parameters' do
|
28
|
+
expect(role_creator).to have_received(:create).with(params[:role]).once
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Services::Roles::RoleManagerRemover, type: :service, fast: true do
|
4
|
+
|
5
|
+
let(:role_remover) { double }
|
6
|
+
let(:role) { double }
|
7
|
+
let(:params) { {role: role} }
|
8
|
+
let(:success_proc) { ->(r) {} }
|
9
|
+
let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
|
10
|
+
|
11
|
+
let(:setup_updaters) do
|
12
|
+
allow(Arpa::Services::Roles::Remove::RoleRemover).to receive(:new).and_return(role_remover)
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:setup_updaters_methods) do
|
16
|
+
allow(role_remover).to receive(:remove)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:result) { subject.remove params, callback }
|
20
|
+
|
21
|
+
before do
|
22
|
+
setup_updaters
|
23
|
+
setup_updaters_methods
|
24
|
+
allow(success_proc).to receive(:call)
|
25
|
+
result
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'role_remover should call :remove with role as parameter' do
|
29
|
+
expect(role_remover).to have_received(:remove).with(role).once
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Services::Roles::RoleManagerUpdater, type: :service, fast: true do
|
4
|
+
|
5
|
+
let(:role_updater) { double }
|
6
|
+
let(:params) { {role: {name: 'role_name', description: 'role_description', action_ids: [1, 2]}} }
|
7
|
+
let(:success_proc) { ->(r) {} }
|
8
|
+
let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
|
9
|
+
|
10
|
+
let(:setup_updaters) do
|
11
|
+
allow(Arpa::Services::Roles::Update::RoleUpdater).to receive(:new).and_return(role_updater)
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:setup_updaters_methods) do
|
15
|
+
allow(role_updater).to receive(:update)
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:result) { subject.update params, callback }
|
19
|
+
|
20
|
+
before do
|
21
|
+
setup_updaters
|
22
|
+
setup_updaters_methods
|
23
|
+
allow(success_proc).to receive(:call)
|
24
|
+
result
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'role_updater should call :update with parameters' do
|
28
|
+
expect(role_updater).to have_received(:update).with(params[:role]).once
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Services::Roles::Update::RoleUpdater, type: :service, fast: true do
|
4
|
+
|
5
|
+
let(:role_entity_class) { Arpa::Entities::Role }
|
6
|
+
let(:role) { double }
|
7
|
+
let(:params) { double }
|
8
|
+
|
9
|
+
let(:role_updated) { subject.update(params) }
|
10
|
+
let(:validator_class) { Arpa::Validators::RoleValidator }
|
11
|
+
let(:validator) { instance_double validator_class }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(validator_class).to receive(:new).and_return(validator)
|
15
|
+
allow(role_entity_class).to receive(:new).and_return(role)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'updating a role' do
|
19
|
+
|
20
|
+
context 'when role is invalid' do
|
21
|
+
let(:errors) { instance_double('ActiveModel::Errors') }
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow(validator).to receive(:valid?).and_return false
|
25
|
+
allow(validator).to receive(:errors).and_return(errors)
|
26
|
+
allow(errors).to receive(:messages)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should raise a Arpa::Exceptions::RecordInvalid with :errors of ActiveModel::Errors' do
|
30
|
+
expect { role_updated }.to raise_error { |error|
|
31
|
+
expect(error).to be_a Arpa::Exceptions::RecordInvalid
|
32
|
+
expect(error.errors).not_to be_nil
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when role is valid' do
|
39
|
+
let(:updater_repo_class) { Arpa::Repositories::Roles::Updater }
|
40
|
+
let(:updater_repo) { instance_double updater_repo_class }
|
41
|
+
|
42
|
+
before do
|
43
|
+
allow(validator).to receive(:valid?).and_return true
|
44
|
+
allow(updater_repo_class).to receive(:new).and_return(updater_repo)
|
45
|
+
allow(updater_repo).to receive(:update).with(role)
|
46
|
+
role_updated
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'updater repository should call :new' do
|
50
|
+
expect(updater_repo_class).to have_received(:new)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'updater_repo should call update method with role as parameter' do
|
54
|
+
expect(updater_repo).to have_received(:update).with(role).once
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when build the role' do
|
58
|
+
|
59
|
+
it 'entity role should call new method' do
|
60
|
+
expect(role_entity_class).to have_received(:new).once
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Services::Verifier do
|
4
|
+
let(:session) { {} }
|
5
|
+
let(:current_user) { double profile_ids: [1,2,3] }
|
6
|
+
|
7
|
+
subject(:verifier) { Arpa::Services::Verifier.new(session, current_user) }
|
8
|
+
|
9
|
+
describe '#has_access?' do
|
10
|
+
context 'when pass a free action which begin with "_"' do
|
11
|
+
it 'should has access' do
|
12
|
+
expect(subject.has_access?('home', '_some_action')).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when pass a non free action' do
|
17
|
+
let(:resource_finder_class) { Arpa::Repositories::Resources::Finder }
|
18
|
+
let(:resource_finder) { instance_double resource_finder_class }
|
19
|
+
let(:entity_permissions) { double }
|
20
|
+
|
21
|
+
before do
|
22
|
+
allow(resource_finder_class).to receive(:new).and_return(resource_finder)
|
23
|
+
allow(resource_finder).to receive(:permissions).with([1,2,3]).and_return(entity_permissions)
|
24
|
+
allow(entity_permissions).to receive(:has_permission?).with('users', 'index')
|
25
|
+
|
26
|
+
subject.has_access?('users', 'index')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should be called :new from Arpa::Repositories::Resources::Finder' do
|
30
|
+
expect(resource_finder_class).to have_received(:new).once
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should be called :permissions from Arpa::Repositories::Resources::Finder' do
|
34
|
+
expect(resource_finder).to have_received(:permissions).with([1,2,3]).once
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should be called :has_permission? from session[:entity_permissions]' do
|
38
|
+
expect(entity_permissions).to have_received(:has_permission?).with('users', 'index').once
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Validators::ActionValidator, type: :validator, fast: true do
|
4
|
+
let(:action) { double name: '', resource_id: nil }
|
5
|
+
|
6
|
+
subject { Arpa::Validators::ActionValidator.new action }
|
7
|
+
|
8
|
+
before { subject.valid? }
|
9
|
+
|
10
|
+
context 'when require' do
|
11
|
+
it { expect(subject.errors).to be_added(:name, :blank) }
|
12
|
+
it { expect(subject.errors).to be_added(:resource_id, :blank) }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Validators::ProfileValidator, type: :validator, fast: true do
|
4
|
+
let(:profile) { double name: '', description: '', role_ids: [] }
|
5
|
+
|
6
|
+
subject { Arpa::Validators::ProfileValidator.new profile }
|
7
|
+
|
8
|
+
before { subject.valid? }
|
9
|
+
|
10
|
+
context 'when require' do
|
11
|
+
it { expect(subject.errors).to be_added(:name, :blank) }
|
12
|
+
it { expect(subject.errors).to be_added(:description, :blank) }
|
13
|
+
it { expect(subject.errors).to be_added(:role_ids, :many_blank) }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Validators::ResourceValidator, type: :validator, fast: true do
|
4
|
+
let(:resource) { double full_name: '', name: '' }
|
5
|
+
|
6
|
+
subject { Arpa::Validators::ResourceValidator.new resource }
|
7
|
+
|
8
|
+
before { subject.valid? }
|
9
|
+
|
10
|
+
context 'when require' do
|
11
|
+
it { expect(subject.errors).to be_added(:full_name, :blank) }
|
12
|
+
it { expect(subject.errors).to be_added(:name, :blank) }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arpa::Validators::RoleValidator, type: :validator, fast: true do
|
4
|
+
let(:role) { double name: '', description: '', action_ids: '' }
|
5
|
+
|
6
|
+
subject { Arpa::Validators::RoleValidator.new role }
|
7
|
+
|
8
|
+
before { subject.valid? }
|
9
|
+
|
10
|
+
context 'when require' do
|
11
|
+
it { expect(subject.errors).to be_added(:name, :blank) }
|
12
|
+
it { expect(subject.errors).to be_added(:description, :blank) }
|
13
|
+
it { expect(subject.errors).to be_added(:action_ids, :many_blank) }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'arpa'
|
3
|
+
require 'database_cleaner'
|
4
|
+
require 'factory_girl'
|
5
|
+
require 'support/repositories/test_repository'
|
6
|
+
require 'i18n'
|
7
|
+
|
8
|
+
ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
|
9
|
+
database: "#{File.dirname(__FILE__)}/arpa.sqlite3")
|
10
|
+
|
11
|
+
load File.dirname(__FILE__) + '/support/schema.rb'
|
12
|
+
|
13
|
+
I18n.config.enforce_available_locales = true
|
14
|
+
I18n.load_path << File.expand_path('../../lib/config/locales/arpa.en.yml', __FILE__)
|
15
|
+
I18n.reload!
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
|
19
|
+
config.include FactoryGirl::Syntax::Methods
|
20
|
+
FactoryGirl.find_definitions
|
21
|
+
|
22
|
+
config.before(:suite) do
|
23
|
+
DatabaseCleaner.strategy = :transaction
|
24
|
+
DatabaseCleaner.clean_with(:truncation)
|
25
|
+
end
|
26
|
+
|
27
|
+
config.around(:each) do |example|
|
28
|
+
DatabaseCleaner.cleaning do
|
29
|
+
example.run
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
self.verbose = false
|
3
|
+
|
4
|
+
create_table :test_repositories, :force => true do |t|
|
5
|
+
t.string :name
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table :repository_resources, :force => true do |t|
|
10
|
+
t.string :name
|
11
|
+
t.string :full_name
|
12
|
+
t.timestamps null: false
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :repository_actions, :force => true do |t|
|
16
|
+
t.string :name
|
17
|
+
t.references :repository_resource, index: true
|
18
|
+
t.timestamps null: false
|
19
|
+
end
|
20
|
+
|
21
|
+
add_foreign_key :repository_actions, :repository_resources
|
22
|
+
|
23
|
+
create_table :repository_roles, :force => true do |t|
|
24
|
+
t.string :name
|
25
|
+
t.string :description
|
26
|
+
t.boolean :removed, default: false
|
27
|
+
t.timestamps null: false
|
28
|
+
end
|
29
|
+
|
30
|
+
create_join_table :repository_actions, :repository_roles, :force => true do |t|
|
31
|
+
t.index :repository_action_id, name: 'action_role_id'
|
32
|
+
t.index :repository_role_id, name: 'role_action_id'
|
33
|
+
end
|
34
|
+
|
35
|
+
create_table :repository_profiles, :force => true do |t|
|
36
|
+
t.string :name
|
37
|
+
t.string :description
|
38
|
+
t.boolean :removed, default: false
|
39
|
+
t.timestamps null: false
|
40
|
+
end
|
41
|
+
|
42
|
+
create_join_table :repository_roles, :repository_profiles, :force => true do |t|
|
43
|
+
t.index :repository_role_id, name: 'role_profile_id'
|
44
|
+
t.index :repository_profile_id, name: 'profile_role_ids'
|
45
|
+
end
|
46
|
+
|
47
|
+
create_table :users, :force => true do |t|
|
48
|
+
t.string :name
|
49
|
+
t.string :email
|
50
|
+
t.timestamps null: false
|
51
|
+
end
|
52
|
+
|
53
|
+
create_join_table :repository_profiles, :users, :force => true do |t|
|
54
|
+
t.index :repository_profile_id, name: 'profile_user_id'
|
55
|
+
t.index :user_id, name: 'user_profile_id'
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,380 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arpa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rachid Calazans
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: factory_girl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: database_cleaner
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activerecord
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.2.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.2.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: railties
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 4.2.0
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '5'
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 4.2.0
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '5'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: responders
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '2.0'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '2.0'
|
159
|
+
description: Authorization Gem for Ruby and Ruby on Rails projects
|
160
|
+
email:
|
161
|
+
- rachidcalazans@gmail.com
|
162
|
+
executables: []
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- ".gitignore"
|
167
|
+
- ".ruby-gemset"
|
168
|
+
- ".ruby-version"
|
169
|
+
- Gemfile
|
170
|
+
- LICENSE.txt
|
171
|
+
- README.md
|
172
|
+
- Rakefile
|
173
|
+
- arpa.gemspec
|
174
|
+
- lib/arpa.rb
|
175
|
+
- lib/arpa/additions/resource.rb
|
176
|
+
- lib/arpa/assets/stylesheets/ar_accordion.scss
|
177
|
+
- lib/arpa/controllers/profiles_controller.rb
|
178
|
+
- lib/arpa/controllers/resources_controller.rb
|
179
|
+
- lib/arpa/controllers/roles_controller.rb
|
180
|
+
- lib/arpa/data_mappers/action_mapper.rb
|
181
|
+
- lib/arpa/data_mappers/base.rb
|
182
|
+
- lib/arpa/data_mappers/profile_mapper.rb
|
183
|
+
- lib/arpa/data_mappers/resource_mapper.rb
|
184
|
+
- lib/arpa/data_mappers/role_mapper.rb
|
185
|
+
- lib/arpa/entities/action.rb
|
186
|
+
- lib/arpa/entities/permissions.rb
|
187
|
+
- lib/arpa/entities/profile.rb
|
188
|
+
- lib/arpa/entities/resource.rb
|
189
|
+
- lib/arpa/entities/role.rb
|
190
|
+
- lib/arpa/exceptions/record_invalid.rb
|
191
|
+
- lib/arpa/repositories/actions/creator.rb
|
192
|
+
- lib/arpa/repositories/actions/finder.rb
|
193
|
+
- lib/arpa/repositories/actions/remover.rb
|
194
|
+
- lib/arpa/repositories/actions/repository_action.rb
|
195
|
+
- lib/arpa/repositories/base.rb
|
196
|
+
- lib/arpa/repositories/profiles/creator.rb
|
197
|
+
- lib/arpa/repositories/profiles/finder.rb
|
198
|
+
- lib/arpa/repositories/profiles/remover.rb
|
199
|
+
- lib/arpa/repositories/profiles/repository_profile.rb
|
200
|
+
- lib/arpa/repositories/profiles/updater.rb
|
201
|
+
- lib/arpa/repositories/registrator.rb
|
202
|
+
- lib/arpa/repositories/resources/creator.rb
|
203
|
+
- lib/arpa/repositories/resources/finder.rb
|
204
|
+
- lib/arpa/repositories/resources/remover.rb
|
205
|
+
- lib/arpa/repositories/resources/repository_resource.rb
|
206
|
+
- lib/arpa/repositories/roles/creator.rb
|
207
|
+
- lib/arpa/repositories/roles/finder.rb
|
208
|
+
- lib/arpa/repositories/roles/remover.rb
|
209
|
+
- lib/arpa/repositories/roles/repository_role.rb
|
210
|
+
- lib/arpa/repositories/roles/updater.rb
|
211
|
+
- lib/arpa/services/actions/create/action_creator.rb
|
212
|
+
- lib/arpa/services/actions/remove/action_remover.rb
|
213
|
+
- lib/arpa/services/base.rb
|
214
|
+
- lib/arpa/services/profiles/create/profile_creator.rb
|
215
|
+
- lib/arpa/services/profiles/profile_manager_creator.rb
|
216
|
+
- lib/arpa/services/profiles/profile_manager_remover.rb
|
217
|
+
- lib/arpa/services/profiles/profile_manager_updater.rb
|
218
|
+
- lib/arpa/services/profiles/remove/profile_remover.rb
|
219
|
+
- lib/arpa/services/profiles/update/profile_updater.rb
|
220
|
+
- lib/arpa/services/resources/create/resource_creator.rb
|
221
|
+
- lib/arpa/services/resources/remove/resource_remover.rb
|
222
|
+
- lib/arpa/services/resources/resource_manager_creator.rb
|
223
|
+
- lib/arpa/services/roles/create/role_creator.rb
|
224
|
+
- lib/arpa/services/roles/remove/role_remover.rb
|
225
|
+
- lib/arpa/services/roles/role_manager_creator.rb
|
226
|
+
- lib/arpa/services/roles/role_manager_remover.rb
|
227
|
+
- lib/arpa/services/roles/role_manager_updater.rb
|
228
|
+
- lib/arpa/services/roles/update/role_updater.rb
|
229
|
+
- lib/arpa/services/verifier.rb
|
230
|
+
- lib/arpa/validators/action_validator.rb
|
231
|
+
- lib/arpa/validators/profile_validator.rb
|
232
|
+
- lib/arpa/validators/resource_validator.rb
|
233
|
+
- lib/arpa/validators/role_validator.rb
|
234
|
+
- lib/arpa/version.rb
|
235
|
+
- lib/arpa/views/profiles/_form.html.erb
|
236
|
+
- lib/arpa/views/profiles/edit.html.erb
|
237
|
+
- lib/arpa/views/profiles/index.html.erb
|
238
|
+
- lib/arpa/views/profiles/new.html.erb
|
239
|
+
- lib/arpa/views/profiles/show.html.erb
|
240
|
+
- lib/arpa/views/resources/index.html.erb
|
241
|
+
- lib/arpa/views/resources/show.html.erb
|
242
|
+
- lib/arpa/views/roles/_form.html.erb
|
243
|
+
- lib/arpa/views/roles/edit.html.erb
|
244
|
+
- lib/arpa/views/roles/index.html.erb
|
245
|
+
- lib/arpa/views/roles/new.html.erb
|
246
|
+
- lib/arpa/views/roles/show.html.erb
|
247
|
+
- lib/config/locales/arpa.en.yml
|
248
|
+
- lib/generators/ar/install_generator.rb
|
249
|
+
- lib/generators/ar/templates/migration.rb
|
250
|
+
- spec/factories/repository_actions.rb
|
251
|
+
- spec/factories/repository_profiles.rb
|
252
|
+
- spec/factories/repository_resources.rb
|
253
|
+
- spec/factories/repository_roles.rb
|
254
|
+
- spec/lib/ar/additions/resource_spec.rb
|
255
|
+
- spec/lib/ar/data_mappers/action_mapper_spec.rb
|
256
|
+
- spec/lib/ar/data_mappers/base_spec.rb
|
257
|
+
- spec/lib/ar/data_mappers/profile_mapper_spec.rb
|
258
|
+
- spec/lib/ar/data_mappers/resource_mapper_spec.rb
|
259
|
+
- spec/lib/ar/data_mappers/role_mapper_spec.rb
|
260
|
+
- spec/lib/ar/entities/action_spec.rb
|
261
|
+
- spec/lib/ar/entities/permissions_spec.rb
|
262
|
+
- spec/lib/ar/entities/resource_spec.rb
|
263
|
+
- spec/lib/ar/repositories/actions/finder_spec.rb
|
264
|
+
- spec/lib/ar/repositories/base_spec.rb
|
265
|
+
- spec/lib/ar/repositories/profiles/finder_spec.rb
|
266
|
+
- spec/lib/ar/repositories/profiles/remover_spec.rb
|
267
|
+
- spec/lib/ar/repositories/resources/finder_spec.rb
|
268
|
+
- spec/lib/ar/repositories/resources/remover_spec.rb
|
269
|
+
- spec/lib/ar/repositories/roles/finder_spec.rb
|
270
|
+
- spec/lib/ar/repositories/roles/remover_spec.rb
|
271
|
+
- spec/lib/ar/requests/profiles/create_request_spec.rb
|
272
|
+
- spec/lib/ar/requests/profiles/remove_request_spec.rb
|
273
|
+
- spec/lib/ar/requests/resources/create_request_spec.rb
|
274
|
+
- spec/lib/ar/requests/roles/create_request_spec.rb
|
275
|
+
- spec/lib/ar/requests/roles/remove_request_spec.rb
|
276
|
+
- spec/lib/ar/requests/roles/update_request_spec.rb
|
277
|
+
- spec/lib/ar/services/actions/create/action_creator_spec.rb
|
278
|
+
- spec/lib/ar/services/actions/remove/action_remover_spec.rb
|
279
|
+
- spec/lib/ar/services/base_spec.rb
|
280
|
+
- spec/lib/ar/services/profiles/create/profile_creator_spec.rb
|
281
|
+
- spec/lib/ar/services/profiles/profile_manager_creator_spec.rb
|
282
|
+
- spec/lib/ar/services/profiles/profile_manager_remover_spec.rb
|
283
|
+
- spec/lib/ar/services/profiles/profile_manager_updater_spec.rb
|
284
|
+
- spec/lib/ar/services/profiles/remove/profile_remover_spec.rb
|
285
|
+
- spec/lib/ar/services/profiles/update/profile_updater_spec.rb
|
286
|
+
- spec/lib/ar/services/resources/create/resource_creator_spec.rb
|
287
|
+
- spec/lib/ar/services/resources/remove/resource_remover_spec.rb
|
288
|
+
- spec/lib/ar/services/resources/resource_manager_creator_spec.rb
|
289
|
+
- spec/lib/ar/services/roles/create/role_creator_spec.rb
|
290
|
+
- spec/lib/ar/services/roles/remove/role_remover_spec.rb
|
291
|
+
- spec/lib/ar/services/roles/role_manager_creator_spec.rb
|
292
|
+
- spec/lib/ar/services/roles/role_manager_remover_spec.rb
|
293
|
+
- spec/lib/ar/services/roles/role_manager_updater_spec.rb
|
294
|
+
- spec/lib/ar/services/roles/update/role_updater_spec.rb
|
295
|
+
- spec/lib/ar/services/verifier_spec.rb
|
296
|
+
- spec/lib/ar/validators/action_validator_spec.rb
|
297
|
+
- spec/lib/ar/validators/profile_validator_spec.rb
|
298
|
+
- spec/lib/ar/validators/resource_validator_spec.rb
|
299
|
+
- spec/lib/ar/validators/role_validator_spec.rb
|
300
|
+
- spec/spec_helper.rb
|
301
|
+
- spec/support/repositories/test_repository.rb
|
302
|
+
- spec/support/schema.rb
|
303
|
+
homepage: https://github.com/rachidcalazans/arpa
|
304
|
+
licenses:
|
305
|
+
- MIT
|
306
|
+
metadata: {}
|
307
|
+
post_install_message:
|
308
|
+
rdoc_options: []
|
309
|
+
require_paths:
|
310
|
+
- lib
|
311
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
312
|
+
requirements:
|
313
|
+
- - ">="
|
314
|
+
- !ruby/object:Gem::Version
|
315
|
+
version: '0'
|
316
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - ">="
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0'
|
321
|
+
requirements: []
|
322
|
+
rubyforge_project:
|
323
|
+
rubygems_version: 2.4.5
|
324
|
+
signing_key:
|
325
|
+
specification_version: 4
|
326
|
+
summary: Authorization Gem for Ruby and Ruby on Rails projects
|
327
|
+
test_files:
|
328
|
+
- spec/factories/repository_actions.rb
|
329
|
+
- spec/factories/repository_profiles.rb
|
330
|
+
- spec/factories/repository_resources.rb
|
331
|
+
- spec/factories/repository_roles.rb
|
332
|
+
- spec/lib/ar/additions/resource_spec.rb
|
333
|
+
- spec/lib/ar/data_mappers/action_mapper_spec.rb
|
334
|
+
- spec/lib/ar/data_mappers/base_spec.rb
|
335
|
+
- spec/lib/ar/data_mappers/profile_mapper_spec.rb
|
336
|
+
- spec/lib/ar/data_mappers/resource_mapper_spec.rb
|
337
|
+
- spec/lib/ar/data_mappers/role_mapper_spec.rb
|
338
|
+
- spec/lib/ar/entities/action_spec.rb
|
339
|
+
- spec/lib/ar/entities/permissions_spec.rb
|
340
|
+
- spec/lib/ar/entities/resource_spec.rb
|
341
|
+
- spec/lib/ar/repositories/actions/finder_spec.rb
|
342
|
+
- spec/lib/ar/repositories/base_spec.rb
|
343
|
+
- spec/lib/ar/repositories/profiles/finder_spec.rb
|
344
|
+
- spec/lib/ar/repositories/profiles/remover_spec.rb
|
345
|
+
- spec/lib/ar/repositories/resources/finder_spec.rb
|
346
|
+
- spec/lib/ar/repositories/resources/remover_spec.rb
|
347
|
+
- spec/lib/ar/repositories/roles/finder_spec.rb
|
348
|
+
- spec/lib/ar/repositories/roles/remover_spec.rb
|
349
|
+
- spec/lib/ar/requests/profiles/create_request_spec.rb
|
350
|
+
- spec/lib/ar/requests/profiles/remove_request_spec.rb
|
351
|
+
- spec/lib/ar/requests/resources/create_request_spec.rb
|
352
|
+
- spec/lib/ar/requests/roles/create_request_spec.rb
|
353
|
+
- spec/lib/ar/requests/roles/remove_request_spec.rb
|
354
|
+
- spec/lib/ar/requests/roles/update_request_spec.rb
|
355
|
+
- spec/lib/ar/services/actions/create/action_creator_spec.rb
|
356
|
+
- spec/lib/ar/services/actions/remove/action_remover_spec.rb
|
357
|
+
- spec/lib/ar/services/base_spec.rb
|
358
|
+
- spec/lib/ar/services/profiles/create/profile_creator_spec.rb
|
359
|
+
- spec/lib/ar/services/profiles/profile_manager_creator_spec.rb
|
360
|
+
- spec/lib/ar/services/profiles/profile_manager_remover_spec.rb
|
361
|
+
- spec/lib/ar/services/profiles/profile_manager_updater_spec.rb
|
362
|
+
- spec/lib/ar/services/profiles/remove/profile_remover_spec.rb
|
363
|
+
- spec/lib/ar/services/profiles/update/profile_updater_spec.rb
|
364
|
+
- spec/lib/ar/services/resources/create/resource_creator_spec.rb
|
365
|
+
- spec/lib/ar/services/resources/remove/resource_remover_spec.rb
|
366
|
+
- spec/lib/ar/services/resources/resource_manager_creator_spec.rb
|
367
|
+
- spec/lib/ar/services/roles/create/role_creator_spec.rb
|
368
|
+
- spec/lib/ar/services/roles/remove/role_remover_spec.rb
|
369
|
+
- spec/lib/ar/services/roles/role_manager_creator_spec.rb
|
370
|
+
- spec/lib/ar/services/roles/role_manager_remover_spec.rb
|
371
|
+
- spec/lib/ar/services/roles/role_manager_updater_spec.rb
|
372
|
+
- spec/lib/ar/services/roles/update/role_updater_spec.rb
|
373
|
+
- spec/lib/ar/services/verifier_spec.rb
|
374
|
+
- spec/lib/ar/validators/action_validator_spec.rb
|
375
|
+
- spec/lib/ar/validators/profile_validator_spec.rb
|
376
|
+
- spec/lib/ar/validators/resource_validator_spec.rb
|
377
|
+
- spec/lib/ar/validators/role_validator_spec.rb
|
378
|
+
- spec/spec_helper.rb
|
379
|
+
- spec/support/repositories/test_repository.rb
|
380
|
+
- spec/support/schema.rb
|