can_can_dry 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/can_can_dry.rb +1 -0
- data/lib/can_can_dry/ability_mapping_sets/active_scaffold.rb +19 -0
- data/lib/can_can_dry/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b5f57ba600a70ecebc6b97f31416bf65f2e77140b9d7782a38f20e94f36a52
|
4
|
+
data.tar.gz: 2268863133f1485f707fc9636d2e5415a5acac46cba7fb53027905ae6742d4ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d4e4832c2be237136b371d127a25d5167fd2db514b394d901f31e4761795a987f792c5ba5ba6c8af956bccf5cd4b2bdff2438bddd41b76dacf9bbdb2e93ba29
|
7
|
+
data.tar.gz: 6e0f2009afda013043e980b650b007e128a9bc8e856a3dcec13ea73253f0ceaeda748d200d38679878c704c7565471e6150563ebeb199d1918212df461e74d89
|
data/lib/can_can_dry.rb
CHANGED
@@ -4,6 +4,7 @@ require 'cancancan'
|
|
4
4
|
module CanCanDry
|
5
5
|
require 'can_can_dry/railtie'
|
6
6
|
require_dependency 'can_can_dry/controller_authorization'
|
7
|
+
require_dependency 'can_can_dry/ability_mapping_sets/active_scaffold'
|
7
8
|
require_dependency 'can_can_dry/ability_mapping_sets/devise'
|
8
9
|
require_dependency 'can_can_dry/ability_mapping_sets/devise_invitable'
|
9
10
|
require_dependency 'can_can_dry/ability_mapping'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module CanCanDry
|
3
|
+
module AbilityMappingSets
|
4
|
+
module ActiveScaffold
|
5
|
+
ACTIVE_SCAFFOLD_MAPPING = {
|
6
|
+
read: [:browse, :index, :mark, :render_field, :show, :show_search],
|
7
|
+
create: [:create, :new],
|
8
|
+
update: [:add_existing, :edit, :edit_associated, :new_existing, :update, :update_column],
|
9
|
+
destroy: [:destroy, :destroy_existing]
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
def map_active_scaffold(controller, entity)
|
13
|
+
ACTIVE_SCAFFOLD_MAPPING.each do |can_action, actions|
|
14
|
+
actions.each { |action| map_action controller, action.to_s, can_action, entity }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/can_can_dry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: can_can_dry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/can_can_dry/ability_mapping.rb
|
64
64
|
- lib/can_can_dry/ability_mapping/action_mapping_not_found.rb
|
65
65
|
- lib/can_can_dry/ability_mapping/path_mapping_not_found.rb
|
66
|
+
- lib/can_can_dry/ability_mapping_sets/active_scaffold.rb
|
66
67
|
- lib/can_can_dry/ability_mapping_sets/devise.rb
|
67
68
|
- lib/can_can_dry/ability_mapping_sets/devise_invitable.rb
|
68
69
|
- lib/can_can_dry/controller_authorization.rb
|