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,45 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Resources
|
4
|
+
class Finder
|
5
|
+
include Arpa::Repositories::Base
|
6
|
+
|
7
|
+
def find(id)
|
8
|
+
record = repository_class.find(id)
|
9
|
+
mapper_instance.map_to_entity(record)
|
10
|
+
end
|
11
|
+
|
12
|
+
def all
|
13
|
+
repository_class.all.collect do |record|
|
14
|
+
mapper_instance.map_to_entity(record)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def by_full_name(full_name)
|
19
|
+
record = repository_class.where(full_name: full_name).first
|
20
|
+
mapper_instance.map_to_entity(record) if record
|
21
|
+
end
|
22
|
+
|
23
|
+
def permissions(profile_ids)
|
24
|
+
records = repository_class.joins(actions: [roles: :profiles])
|
25
|
+
.where(repository_profiles: {id: profile_ids})
|
26
|
+
|
27
|
+
resources = records.collect do |record|
|
28
|
+
mapper_instance.map_to_entity(record)
|
29
|
+
end
|
30
|
+
|
31
|
+
Arpa::Entities::Permissions.new(resources)
|
32
|
+
end
|
33
|
+
|
34
|
+
def mapper_instance
|
35
|
+
Arpa::DataMappers::ResourceMapper.instance
|
36
|
+
end
|
37
|
+
|
38
|
+
def repository_class
|
39
|
+
RepositoryResource
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Resources
|
4
|
+
class Remover
|
5
|
+
include Arpa::Repositories::Base
|
6
|
+
|
7
|
+
def destroy(entity)
|
8
|
+
repository_class.destroy(entity.id)
|
9
|
+
end
|
10
|
+
|
11
|
+
def mapper_instance
|
12
|
+
Arpa::DataMappers::ResourceMapper.instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def repository_class
|
16
|
+
RepositoryResource
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Resources
|
4
|
+
class RepositoryResource < ActiveRecord::Base
|
5
|
+
default_scope {order(name: :asc)}
|
6
|
+
|
7
|
+
has_many :actions, dependent: :destroy, class_name: 'Arpa::Repositories::Actions::RepositoryAction'
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Roles
|
4
|
+
class Creator
|
5
|
+
include Arpa::Repositories::Registrator
|
6
|
+
|
7
|
+
def mapper_instance
|
8
|
+
Arpa::DataMappers::RoleMapper.instance
|
9
|
+
end
|
10
|
+
|
11
|
+
def repository_class
|
12
|
+
RepositoryRole
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Roles
|
4
|
+
class Finder
|
5
|
+
include Arpa::Repositories::Base
|
6
|
+
|
7
|
+
def find(id)
|
8
|
+
record = repository_class.find(id)
|
9
|
+
mapper_instance.map_to_entity(record)
|
10
|
+
end
|
11
|
+
|
12
|
+
def all
|
13
|
+
repository_class.all.collect do |record|
|
14
|
+
mapper_instance.map_to_entity(record)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def mapper_instance
|
19
|
+
Arpa::DataMappers::RoleMapper.instance
|
20
|
+
end
|
21
|
+
|
22
|
+
def repository_class
|
23
|
+
RepositoryRole
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Roles
|
4
|
+
class Remover
|
5
|
+
include Arpa::Repositories::Base
|
6
|
+
|
7
|
+
def destroy(entity)
|
8
|
+
repository_class.destroy(entity.id)
|
9
|
+
end
|
10
|
+
|
11
|
+
def disable(entity)
|
12
|
+
record = mapper_instance.map_to_record(entity)
|
13
|
+
repository_class.update(record.id, removed: true)
|
14
|
+
record.reload
|
15
|
+
mapper_instance.map_to_entity(record)
|
16
|
+
end
|
17
|
+
|
18
|
+
def mapper_instance
|
19
|
+
Arpa::DataMappers::RoleMapper.instance
|
20
|
+
end
|
21
|
+
|
22
|
+
def repository_class
|
23
|
+
RepositoryRole
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Roles
|
4
|
+
class RepositoryRole < ActiveRecord::Base
|
5
|
+
default_scope {where(removed: false).order(name: :asc)}
|
6
|
+
|
7
|
+
has_and_belongs_to_many :actions, class_name: 'Arpa::Repositories::Actions::RepositoryAction'
|
8
|
+
has_and_belongs_to_many :profiles, class_name: 'Arpa::Repositories::Profiles::RepositoryProfile'
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Repositories
|
3
|
+
module Roles
|
4
|
+
class Updater
|
5
|
+
include Arpa::Repositories::Registrator
|
6
|
+
|
7
|
+
def post_update(entity, record)
|
8
|
+
record.action_ids = entity.action_ids
|
9
|
+
record.save!
|
10
|
+
end
|
11
|
+
|
12
|
+
def mapper_instance
|
13
|
+
Arpa::DataMappers::RoleMapper.instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def repository_class
|
17
|
+
RepositoryRole
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Actions
|
4
|
+
module Create
|
5
|
+
class ActionCreator
|
6
|
+
|
7
|
+
def create_many(params)
|
8
|
+
params[:actions_names].collect do |action_name|
|
9
|
+
create(action_params(params, action_name))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
action = action_instance(params)
|
15
|
+
|
16
|
+
action_found = finder_repo.by_name_and_resource(params[:name], params[:resource_id])
|
17
|
+
return action_found if action_found
|
18
|
+
|
19
|
+
validate_action(action)
|
20
|
+
creator_repo.create(action)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def action_params(params, action_name)
|
26
|
+
{name: action_name, resource_id: params[:resource].id}
|
27
|
+
end
|
28
|
+
|
29
|
+
def action_instance(params)
|
30
|
+
Arpa::Entities::Action.new(params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def validate_action(action)
|
34
|
+
validator = Arpa::Validators::ActionValidator.new(action)
|
35
|
+
raise Arpa::Exceptions::RecordInvalid.new(message: validator.errors.messages, errors: validator.errors) unless validator.valid?
|
36
|
+
end
|
37
|
+
|
38
|
+
def finder_repo
|
39
|
+
@finder_repo ||= Arpa::Repositories::Actions::Finder.new
|
40
|
+
end
|
41
|
+
|
42
|
+
def creator_repo
|
43
|
+
@creator_repo ||= Arpa::Repositories::Actions::Creator.new
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Actions
|
4
|
+
module Remove
|
5
|
+
class ActionRemover
|
6
|
+
|
7
|
+
def remove_nonexistent_actions(params)
|
8
|
+
params[:resource].actions.each do |action|
|
9
|
+
exist = params[:actions_names].include?(action.name)
|
10
|
+
remover_repo.destroy(action) unless exist
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def remover_repo
|
17
|
+
@remover_repo ||= Arpa::Repositories::Actions::Remover.new
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Base
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.extend ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
def manager_action callback, &block
|
10
|
+
begin_transaction do
|
11
|
+
begin
|
12
|
+
result = block.call
|
13
|
+
callback[:success].call result
|
14
|
+
rescue => e
|
15
|
+
callback[:fail].call e
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def begin_transaction
|
23
|
+
self.class._repository_transaction.transaction do
|
24
|
+
yield
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module ClassMethods
|
29
|
+
def repository_transaction repository_transaction_class
|
30
|
+
@repository_transaction = repository_transaction_class
|
31
|
+
end
|
32
|
+
|
33
|
+
def _repository_transaction
|
34
|
+
@repository_transaction ||= 'ActiveRecord::Base'
|
35
|
+
@repository_transaction.constantize
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Profiles
|
4
|
+
module Create
|
5
|
+
class ProfileCreator
|
6
|
+
|
7
|
+
def create(params)
|
8
|
+
profile = profile_instance(params)
|
9
|
+
validate_profile(profile)
|
10
|
+
creator_repo.create(profile)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def profile_instance(params)
|
16
|
+
Arpa::Entities::Profile.new(params)
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate_profile(profile)
|
20
|
+
validator = Arpa::Validators::ProfileValidator.new(profile)
|
21
|
+
raise Arpa::Exceptions::RecordInvalid.new(message: validator.errors.messages, errors: validator.errors) unless validator.valid?
|
22
|
+
end
|
23
|
+
|
24
|
+
def creator_repo
|
25
|
+
@creator_repo ||= Arpa::Repositories::Profiles::Creator.new
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Profiles
|
4
|
+
class ProfileManagerCreator
|
5
|
+
include Arpa::Services::Base
|
6
|
+
|
7
|
+
def create(params, callback)
|
8
|
+
manager_action callback do
|
9
|
+
profile_creator.create(params[:profile])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def profile_creator
|
16
|
+
@profile_creator ||= Arpa::Services::Profiles::Create::ProfileCreator.new
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Profiles
|
4
|
+
class ProfileManagerRemover
|
5
|
+
include Arpa::Services::Base
|
6
|
+
|
7
|
+
def remove(params, callback)
|
8
|
+
manager_action callback do
|
9
|
+
role = params[:profile]
|
10
|
+
disable = params[:disable]
|
11
|
+
profile_remover.remove(role, disable)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def profile_remover
|
18
|
+
@profile_remover ||= Arpa::Services::Profiles::Remove::ProfileRemover.new
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Profiles
|
4
|
+
class ProfileManagerUpdater
|
5
|
+
include Arpa::Services::Base
|
6
|
+
|
7
|
+
def update(params, callback)
|
8
|
+
manager_action callback do
|
9
|
+
profile_updater.update(params[:profile])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def profile_updater
|
16
|
+
@profile_updater ||= Arpa::Services::Profiles::Update::ProfileUpdater.new
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Arpa
|
2
|
+
module Services
|
3
|
+
module Profiles
|
4
|
+
module Remove
|
5
|
+
class ProfileRemover
|
6
|
+
|
7
|
+
def remove(entity, disable = false)
|
8
|
+
if disable
|
9
|
+
remover_repo.disable(entity)
|
10
|
+
else
|
11
|
+
remover_repo.destroy(entity)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def remover_repo
|
18
|
+
@remover_repo ||= Arpa::Repositories::Profiles::Remover.new
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|