para-acl 0.1.0 → 0.2.0.a

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: 0a6f8ccbd2b45f78fc1fb17f84464e56af2ef5fe
4
- data.tar.gz: 4dc1ee03783d2b2ae5aa6baf81950e50a2fee90e
3
+ metadata.gz: 7247c40349650b922ab484aa17f4b6147f345819
4
+ data.tar.gz: 568f9572af8b918f2989a5c61a3cfb0447aba148
5
5
  SHA512:
6
- metadata.gz: f17e1cd3fad5343e919a9a1f0ad31f579cb32b77248c682af8125879a68cc2d0ea5f122bf21378ad64d50d4c545221bafae4d132f0a143976b807e31a2caac21
7
- data.tar.gz: 970284fadfc0c818410b7605c1191361d8ce77d5d9523996e09355f6cecd70deeb524086d60952db374a78df4fb5a7d3e46ba70e1551e7d937eea91c3bd75f49
6
+ metadata.gz: 8c2f9809fe55b65e1065cf3cdac5d8690ddfdc418a41b1e503520b31bc50f40bb87226bd0c12914be5a1cd1bdbd19f27657aeac7d517dd33ee753080c4559147
7
+ data.tar.gz: f943c36fe06b38c145b6a71e101cd1bb28ea1aab6cbd13bed832fbcef2f9cb7a39774b101c32acd3327f6e31fc74bacd97f0fd3d73adbc6d75ac8fdf74a24b20
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
@@ -0,0 +1,8 @@
1
+ module Admin
2
+ module Para
3
+ module Acl
4
+ class RoleResourcesController < ::Para::Admin::CrudResourcesController
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,31 @@
1
+ module Admin
2
+ module Para
3
+ module Acl
4
+ class RolesComponentController < ::Para::Admin::ComponentController
5
+ def show
6
+ @components_roles = ::Para::Acl::ComponentRolesCollection.new
7
+ end
8
+
9
+ def update
10
+ @components_roles = ::Para::Acl::ComponentRolesCollection.new
11
+
12
+ if @components_roles.update(component_roles_params)
13
+ flash_message(:success, @components_roles)
14
+ redirect_to @component.path
15
+ else
16
+ flash_message(:error, @components_roles)
17
+ render 'show'
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def component_roles_params
24
+ params.require(:components_roles).permit(
25
+ resources_attributes: [:id, :allow]
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,6 +1,10 @@
1
1
  module AclRolesComponentDecorator
2
2
  include Para::Component::CrudDecorator
3
3
 
4
+ def path(options = {})
5
+ find_path([:admin, self], options)
6
+ end
7
+
4
8
  def name
5
9
  I18n.t('admin.acl_roles.name')
6
10
  end
@@ -2,13 +2,13 @@
2
2
  = form.tabs do |tabs|
3
3
  = tabs.tab :role do
4
4
  = form.input :name
5
- = form.input :authorize_new_components, hint: t('simple_form.hints.para/acl/role.authorize_new_components')
5
+ = form.input :authorize_new_components, wrapper: :horizontal_radio_and_checkboxes, hint: t('simple_form.hints.para/acl/role.authorize_new_components')
6
6
  = form.input :users, as: :selectize
7
7
 
8
8
  - if resource.persisted?
9
9
  = tabs.tab :destroy_role do
10
10
  = form.input :id, label: t('para.shared.destroy') do
11
- = link_to @component.relation_path(resource), method: :delete, confirm: t('para.confirmation.shared.destroy'), class: 'btn btn-danger' do
11
+ = link_to @component.relation_path(resource), method: :delete, class: 'btn btn-danger', data: { confirm: t('admin.acl_roles.destroy', role: resource.name) } do
12
12
  = fa_icon 'times'
13
13
  = t('para.shared.destroy')
14
14
 
@@ -31,5 +31,4 @@
31
31
  .checkbox{ class: ('disabled' if disabled) }
32
32
  = component_role_fields.input_field :allow, disabled: disabled
33
33
 
34
-
35
34
  = form.actions(only: [:submit, :cancel])
@@ -7,6 +7,7 @@ fr:
7
7
  groupes d'administrateurs aux différentes sections de le console
8
8
  d'administration.
9
9
  Cochez les cases nécessaires puis cliquez sur "Enregistrer"
10
+ destroy: "Êtes-vous sûrs de vouloir supprimer le rôle %{role} ?"
10
11
 
11
12
  forms:
12
13
  tabs:
@@ -14,19 +15,21 @@ fr:
14
15
  role: "Modification"
15
16
  destroy_role: "Suppression"
16
17
 
17
- activemodel:
18
+ activerecord: &models_translations
18
19
  models:
19
20
  para/acl/component_roles_collection:
20
21
  one: "Droits d'accès"
21
22
  other: "Droits d'accès"
22
23
 
23
- activerecord:
24
24
  attributes:
25
25
  para/acl/role:
26
26
  name: "Nom"
27
27
  authorize_new_components: "Donner automatiquement accès au nouveaux composant de l'administration"
28
28
  users: "Administrateurs concernés"
29
29
 
30
+ activemodel:
31
+ <<: *models_translations
32
+
30
33
  simple_form:
31
34
  hints:
32
35
  para/acl/role:
@@ -1,19 +1,26 @@
1
- require 'para/acl/rails/active_record_extension'
1
+ require 'para/acl/ext/active_record_extension'
2
+ require 'para/acl/ext/components_extension'
2
3
 
3
4
  module Para
4
5
  module Acl
5
6
  class Engine < ::Rails::Engine
6
- initializer 'Set para ability class' do
7
+ initializer 'para.acl.set_para_ability_class_name' do
7
8
  config.to_prepare do
8
9
  Para.config.ability_class_name = 'Para::Acl::Ability'
9
10
  end
10
11
  end
11
12
 
12
- initializer 'Add extension to ActiveRecord' do
13
+ initializer 'para.acl.add_has_admin_role_extension_to_active_record' do
13
14
  ActiveSupport.on_load(:active_record) do
14
15
  include Para::Acl::ActiveRecordExtension
15
16
  end
16
17
  end
18
+
19
+ initializer 'para.acl.add_para_components_extension' do
20
+ ActiveSupport.on_load(:active_record) do
21
+ Para::Component::Base.send(:include, Para::Acl::ComponentsExtension)
22
+ end
23
+ end
17
24
  end
18
25
  end
19
26
  end
@@ -0,0 +1,17 @@
1
+ module Para
2
+ module Acl
3
+ module ComponentsExtension
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_destroy :clean_role_components
8
+ end
9
+
10
+ private
11
+
12
+ def clean_role_components
13
+ ::Para::Acl::RoleComponent.where(component: self).destroy_all
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,13 +3,9 @@ module Para
3
3
  class Routes < Para::Plugins::Routes
4
4
  def draw
5
5
  plugin :acl do
6
- component :acl_roles do
7
- scope ':model' do
8
- resources :crud_resources, path: '/'
9
- end
10
- end
11
-
12
- patch "acl_roles/:component_id" => "acl_roles_component#update"
6
+ component :roles, path: :roles
7
+ crud_component :roles, path: :roles
8
+ patch "roles/:component_id" => "roles_component#update"
13
9
  end
14
10
  end
15
11
  end
@@ -1,5 +1,5 @@
1
1
  module Para
2
2
  module Acl
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0.a"
4
4
  end
5
5
  end
data/para-acl.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_dependency "para", ">= 0.4", "<= 1.0"
32
- spec.add_dependency "rails", ">= 4.0", "<= 5.0"
32
+ spec.add_dependency "rails", ">= 4.0", "<= 6.0"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 1.7"
35
35
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para-acl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0.a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-08 00:00:00.000000000 Z
11
+ date: 2016-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: para
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '4.0'
40
40
  - - "<="
41
41
  - !ruby/object:Gem::Version
42
- version: '5.0'
42
+ version: '6.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '4.0'
50
50
  - - "<="
51
51
  - !ruby/object:Gem::Version
52
- version: '5.0'
52
+ version: '6.0'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +92,14 @@ files:
92
92
  - README.md
93
93
  - Rakefile
94
94
  - app/components/acl_roles_component.rb
95
- - app/controllers/admin/acl/acl_roles_component_controller.rb
96
- - app/controllers/admin/acl/crud_resources_controller.rb
95
+ - app/controllers/admin/para/acl/role_resources_controller.rb
96
+ - app/controllers/admin/para/acl/roles_component_controller.rb
97
97
  - app/decorators/acl_roles_component_decorator.rb
98
98
  - app/models/para/acl/role.rb
99
99
  - app/models/para/acl/role_component.rb
100
100
  - app/models/para/acl/user_role.rb
101
- - app/views/admin/acl/acl_roles_component/show.html.haml
102
101
  - app/views/admin/para/acl/roles/_form.html.haml
102
+ - app/views/admin/para/acl/roles_component/show.html.haml
103
103
  - bin/rails
104
104
  - config/locales/fr.yml
105
105
  - db/migrate/20151215160816_create_para_acl_roles.rb
@@ -111,7 +111,8 @@ files:
111
111
  - lib/para/acl/ability.rb
112
112
  - lib/para/acl/component_roles_collection.rb
113
113
  - lib/para/acl/engine.rb
114
- - lib/para/acl/rails/active_record_extension.rb
114
+ - lib/para/acl/ext/active_record_extension.rb
115
+ - lib/para/acl/ext/components_extension.rb
115
116
  - lib/para/acl/routes.rb
116
117
  - lib/para/acl/version.rb
117
118
  - lib/tasks/authorize_admins.rake
@@ -137,12 +138,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
138
  version: '0'
138
139
  required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  requirements:
140
- - - ">="
141
+ - - ">"
141
142
  - !ruby/object:Gem::Version
142
- version: '0'
143
+ version: 1.3.1
143
144
  requirements: []
144
145
  rubyforge_project:
145
- rubygems_version: 2.4.3
146
+ rubygems_version: 2.5.1
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Para plugin to allow admins access management
@@ -1,29 +0,0 @@
1
- module Admin
2
- module Acl
3
- class AclRolesComponentController < Para::Admin::ComponentController
4
- def show
5
- @components_roles = Para::Acl::ComponentRolesCollection.new
6
- end
7
-
8
- def update
9
- @components_roles = Para::Acl::ComponentRolesCollection.new
10
-
11
- if @components_roles.update(component_roles_params)
12
- flash_message(:success, @components_roles)
13
- redirect_to @component.path
14
- else
15
- flash_message(:error, @components_roles)
16
- render 'show'
17
- end
18
- end
19
-
20
- private
21
-
22
- def component_roles_params
23
- params.require(:components_roles).permit(
24
- resources_attributes: [:id, :allow]
25
- )
26
- end
27
- end
28
- end
29
- end
@@ -1,6 +0,0 @@
1
- module Admin
2
- module Acl
3
- class CrudResourcesController < Para::Admin::CrudResourcesController
4
- end
5
- end
6
- end