role_core 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7fe4d1e27ca682fe3bb59dce5e6eefba062053ff7cad056ea5245a09da51d68
4
- data.tar.gz: 830ea09acdfe5cc6a1cd652e39215c64eac62053d001b40885af93794a12a090
3
+ metadata.gz: 1080fa1afb5395d4570e31270ad56cd59fc637a4f008590b986219254c2ba600
4
+ data.tar.gz: 28e499fa5ef2c154c29f2df63629e9c5c5bc771b21299d761e77a4f0f9af7bb6
5
5
  SHA512:
6
- metadata.gz: 57341db8d74b769b4502ef08ac08031516f026f5d1854f8137dbc24b6f4be8553cdd6dc9472e57274d80d8a2fdafc6d971bc5e6df4f21f13fc83f1359df61547
7
- data.tar.gz: 68dcaee1798f9522c1e67045cdd2fb853d36c309f1b8157cba9017f5da0c8d50a6e042567e3884ae12ad011e17d6e4ebca6ddddf12dbb72cc3306f1e8c5df2a0
6
+ metadata.gz: 785e0ea6e99a8bcb5f0814074ea6ac8e7dac6ce0f4bb2b1193e1c673ea00e65b9bd7efefc646cdcf7e5395f5f48654ac49ef8a942dcd6c32106c5032f4ce9c33
7
+ data.tar.gz: fa735cac88ed8b1084e3f0ae79bffdeb81ffe59f25752de3bea81a56b11d899fef21be06f35759635514de49cdc1f845bcfb15950468aba43654378476ba1f2a
@@ -11,16 +11,19 @@ module RoleCore
11
11
  @model_name = options[:model_name]
12
12
  @subject = options[:subject]
13
13
  @action = options[:action] || name
14
- @options = options.except(:model, :model_name, :subject, :action, :_namespace, :_priority, :_callable)
14
+ @with_identity = options[:with]
15
+ @options = options.except(:model, :model_name, :subject, :action, :with, :_namespace, :_priority, :_callable)
15
16
  @block = block
16
17
  end
17
18
 
18
- def call(context, *args)
19
+ def call(context, user, *args)
19
20
  return unless callable
20
21
 
21
22
  subject = @subject || @model_name.constantize
22
23
  if block_attached?
23
24
  context.can @action, subject, &@block.curry[*args]
25
+ elsif @with_identity
26
+ context.can @action, subject, @options.merge(@with_identity => user)
24
27
  else
25
28
  context.can @action, subject, @options
26
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RoleCore
4
- VERSION = "0.0.29"
4
+ VERSION = "0.0.31"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: role_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-03-12 00:00:00.000000000 Z
10
+ date: 2025-02-08 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: options_model
@@ -31,7 +30,7 @@ dependencies:
31
30
  - !ruby/object:Gem::Version
32
31
  version: '1.0'
33
32
  - !ruby/object:Gem::Dependency
34
- name: rails
33
+ name: activerecord
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
36
  - - ">="
@@ -39,7 +38,7 @@ dependencies:
39
38
  version: '5'
40
39
  - - "<"
41
40
  - !ruby/object:Gem::Version
42
- version: '8'
41
+ version: '9'
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +48,7 @@ dependencies:
49
48
  version: '5'
50
49
  - - "<"
51
50
  - !ruby/object:Gem::Version
52
- version: '8'
51
+ version: '9'
53
52
  description: RoleCore is a Rails engine which could provide essential industry of
54
53
  Role-based access control.
55
54
  email:
@@ -85,7 +84,6 @@ homepage: https://github.com/rails-engine/role_core
85
84
  licenses:
86
85
  - MIT
87
86
  metadata: {}
88
- post_install_message:
89
87
  rdoc_options: []
90
88
  require_paths:
91
89
  - lib
@@ -100,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  - !ruby/object:Gem::Version
101
99
  version: '0'
102
100
  requirements: []
103
- rubygems_version: 3.5.6
104
- signing_key:
101
+ rubygems_version: 3.6.3
105
102
  specification_version: 4
106
103
  summary: RoleCore is a Rails engine which could provide essential industry of Role-based
107
104
  access control.