permission_settings 0.1.0 → 1.0.0
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 +4 -4
- data/.rubocop.yml +16 -1
- data/CHANGELOG.md +24 -0
- data/README.md +167 -11
- data/config/custom_permissions/user.yml +56 -0
- data/config/initializers/permission_settings.rb +6 -0
- data/config/permissions/user.yml +56 -0
- data/lib/permission_settings/configuration.rb +42 -0
- data/lib/permission_settings/patcher.rb +48 -0
- data/lib/permission_settings/verify.rb +60 -0
- data/lib/permission_settings/verify_instance.rb +15 -0
- data/lib/permission_settings/version.rb +1 -1
- data/lib/permission_settings.rb +20 -2
- data/permission_settings.gemspec +4 -6
- metadata +40 -7
- data/.idea/.gitignore +0 -8
- data/sig/permission_settings.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1029e7171c15a82d09d7bcfadb14d8e45aded629e8e2f81874a238282b1bc0c4
|
4
|
+
data.tar.gz: 40ef5214fc0b39459f828d33a5a3c475357c1af575d7fc7cd2d5a02642fbb7ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d400451434a9c263bccca2ed9c5a127f10c9fbebb46fbc9929a5becb6b207c5c1b299662f0d34a7ae904e45fbaf5079fccb4559c6e619b2887f9b01bc6a63834
|
7
|
+
data.tar.gz: fefcf3d7553b8939c3e3010dfcd0322161d87cc33c5e2738924c3a2b5fde98250a553caf221fbba02185bdd1600b62bf327c669974fa1ea94ed005b118744531
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rake
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
2
|
-
|
6
|
+
NewCops: enable
|
7
|
+
TargetRubyVersion: 3.0
|
3
8
|
|
4
9
|
Style/StringLiterals:
|
10
|
+
|
5
11
|
Enabled: true
|
6
12
|
|
7
13
|
Style/StringLiteralsInInterpolation:
|
@@ -10,3 +16,12 @@ Style/StringLiteralsInInterpolation:
|
|
10
16
|
|
11
17
|
Layout/LineLength:
|
12
18
|
Max: 120
|
19
|
+
|
20
|
+
Style/Documentation:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/BlockLength:
|
24
|
+
Max: 150
|
25
|
+
|
26
|
+
RSpec/MultipleExpectations:
|
27
|
+
Max: 4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.0] - 2024-01-30
|
4
|
+
|
5
|
+
- Added documentation
|
6
|
+
- Added rubocop
|
7
|
+
- Added Github Actions CI
|
8
|
+
|
9
|
+
## [0.1.3] - 2024-01-29
|
10
|
+
|
11
|
+
- Cover with tests different use cases
|
12
|
+
|
13
|
+
## [0.1.2] - 2024-01-25
|
14
|
+
|
15
|
+
- Configuration interface.
|
16
|
+
- Added `#configure` method to configure:
|
17
|
+
* permissions_dir_path configuration option for setting path to permissions directory
|
18
|
+
* role_access_method configuration option for setting method name to access role of the resource instance
|
19
|
+
- Added `#has_settings` method to configure dynamic settings.
|
20
|
+
It accepts a scope name were the settings will stored under and default settings hash from a yaml file.
|
21
|
+
|
22
|
+
## [0.1.1] - 2024-01-23
|
23
|
+
|
24
|
+
- Added basic class structure and core logic
|
25
|
+
- Configured rspec. Covered instance verification logic with specs
|
26
|
+
|
3
27
|
## [0.1.0] - 2024-01-17
|
4
28
|
|
5
29
|
- Initial release
|
data/README.md
CHANGED
@@ -1,24 +1,180 @@
|
|
1
|
-
# PermissionSettings
|
1
|
+
# PermissionSettings - [Changelog](https://github.com/Misha7776/permission_settings/blob/main/README.md)
|
2
2
|
|
3
|
-
|
3
|
+
**PermissionSettings** allows to dynamically set, retrieve and check permissions of your resource model.
|
4
|
+
Under the hood it uses **[Rails Settings](https://github.com/ledermann/rails-settings)** gem for storing settings in database.
|
5
|
+
Main idea is to store permissions in yaml files that can be divided by resource models and roles.
|
6
|
+
It alos allows to change permissions without restarting the application that gives you more flexibility in build a permissions system.
|
4
7
|
|
5
|
-
|
8
|
+
### Tested with ruby:
|
9
|
+
- 3.0.2
|
6
10
|
|
7
|
-
##
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
- Rails 6.1 or newer (including Rails 7.0)
|
8
14
|
|
9
|
-
|
15
|
+
## Installation
|
10
16
|
|
11
|
-
|
17
|
+
Include the gem in your Gemfile and run `bundle` to install it:
|
12
18
|
|
13
|
-
|
19
|
+
```ruby
|
20
|
+
gem 'permission_settings', '~> 0.1.0'
|
21
|
+
```
|
14
22
|
|
15
|
-
|
23
|
+
Generate and run the migration to create the settings table that is used to store the permissions:
|
16
24
|
|
17
|
-
|
25
|
+
```shell
|
26
|
+
rails g rails_settings:migration
|
27
|
+
rake db:migrate
|
28
|
+
```
|
18
29
|
|
19
30
|
## Usage
|
20
31
|
|
21
|
-
|
32
|
+
### Configuration
|
33
|
+
|
34
|
+
You can configure the gem by calling `PermissionSettings.configure` method in an initializer:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
# config/initializers/permission_settings.rb
|
38
|
+
|
39
|
+
PermissionSettings.configure do |_config|
|
40
|
+
config.permissions_dir_path = 'config/permissions'
|
41
|
+
config.role_access_method = :role
|
42
|
+
end
|
43
|
+
```
|
44
|
+
* `permissions_dir_path` - configuration option for setting path to permissions directory
|
45
|
+
* `role_access_method` - configuration option for setting method name to access role of the resource instance
|
46
|
+
|
47
|
+
You can create different yaml files for different resource models to keep permissions separated.
|
48
|
+
by default it looks for yaml files in `config/permissions` directory.
|
49
|
+
|
50
|
+
### Permissions file structure
|
51
|
+
|
52
|
+
Gem will load permissions from yaml files into database on application start.
|
53
|
+
|
54
|
+
The permissions file should be a yaml file and should be the same as the name of the resource model.
|
55
|
+
|
56
|
+
For example, if you have a `User` model, you can create a `user.yml` file in `config/permissions` directory with the following structure:
|
57
|
+
|
58
|
+
```yaml
|
59
|
+
# config/permissions/person.yml
|
60
|
+
|
61
|
+
admin:
|
62
|
+
notifications:
|
63
|
+
read: true
|
64
|
+
create: true
|
65
|
+
edit: true
|
66
|
+
delete: true
|
67
|
+
|
68
|
+
manager:
|
69
|
+
notifications:
|
70
|
+
read: true
|
71
|
+
create: false
|
72
|
+
edit: false
|
73
|
+
delete: false
|
74
|
+
```
|
75
|
+
|
76
|
+
In this file we should divided permissions into roles. If not following this structure gem won't find permissions that are defined for a specific role of that calling instance.
|
77
|
+
If you experience a `PersistentSettings::NotFoundError` error, please check if you have defined permissions for that role inside the permissions file of resource model.
|
78
|
+
|
79
|
+
### Connecting permissions to the resource and calling model
|
80
|
+
|
81
|
+
To connect permissions to the resource model you need just to include `PersmissionSettings` module in the model class:
|
82
|
+
|
83
|
+
Calling model:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
class User < ApplicationRecord
|
87
|
+
include PermissionSettings
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
Resource model:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class Person < ApplicationRecord
|
95
|
+
include PermissionSettings
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
In order to check permissions of the resource instance you need to pass it as a named argument `resource` to the `#can?` method.
|
100
|
+
|
101
|
+
Take into account that the resource model should have a `role` filed or method that returns a role name of the calling instance or you can configure the gem to use another method name by setting `role_access_method` configuration option.
|
102
|
+
|
103
|
+
### Checking permissions
|
104
|
+
|
105
|
+
You can check permissions of the resource instance by calling `#can?` method:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
user = User.first # => #<User id: 1, name: "John", role: "manager">
|
109
|
+
person = Person.last # => #<Person id: 2, name: "Jane", role: "client">
|
110
|
+
user.can?(:read, :notifications, resource: person) # => true
|
111
|
+
```
|
112
|
+
|
113
|
+
Method `can?` accepts 2 arguments:
|
114
|
+
* `*permission_keys` - this keys will be used to find permissions in the settings. It can be a string or an array of strings. Required argument.
|
115
|
+
* `*resource` - Named argument resource. Instance towards which the permissions will be checked. Required argument.
|
116
|
+
|
117
|
+
### Accessing permissions
|
118
|
+
|
119
|
+
You can also access permissions of the resource or calling instance by calling `#settings` method:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
person = Person.last # => #<Person id: 2, name: "Jane", role: "client">
|
123
|
+
person.settings[PermissionSettings.configuration.scope_name].admin.notifications.read # => false
|
124
|
+
```
|
125
|
+
|
126
|
+
More about settings you can read in [Rails Settings](https://github.com/ledermann/rails-settings) gem documentation.
|
127
|
+
|
128
|
+
### Dynamic settings
|
129
|
+
|
130
|
+
You can override default settings by calling `#has_settings` method in the resource model class:
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
custom_permissions = {
|
134
|
+
admin: {
|
135
|
+
notifications: {
|
136
|
+
read: false,
|
137
|
+
create: false,
|
138
|
+
edit: false,
|
139
|
+
delete: false
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
admin = User.first # => #<User id: 1, name: "John", role: "admin">
|
144
|
+
person = Person.last # => #<User id: 2, name: "Jane", role: "client">
|
145
|
+
|
146
|
+
admin.can?(:read, :notifications, resource: person) # => true
|
147
|
+
|
148
|
+
person.settings(PermissionSettings.configuration.scope_name).update(custom_permissions)
|
149
|
+
|
150
|
+
admin.can?(:read, :notifications, resource: person) # => false
|
151
|
+
```
|
152
|
+
|
153
|
+
If you will unset your custom settings, default settings will be used:
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
custom_permissions = {
|
157
|
+
admin: {
|
158
|
+
notifications: {
|
159
|
+
read: false,
|
160
|
+
create: false,
|
161
|
+
edit: false,
|
162
|
+
delete: false
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
admin = User.first # => #<User id: 1, name: "John", role: "admin">
|
168
|
+
person = Person.last # => #<User id: 2, name: "Jane", role: "client">
|
169
|
+
|
170
|
+
person.settings(PermissionSettings.configuration.scope_name).update(custom_permissions)
|
171
|
+
|
172
|
+
admin.can?(:read, :notifications, resource: person) # => false
|
173
|
+
|
174
|
+
person.settings(policy_scope).update({ admin: { notifications: nil } })
|
175
|
+
|
176
|
+
admin.can?(:read, :notifications, resource: person) # => true
|
177
|
+
```
|
22
178
|
|
23
179
|
## Development
|
24
180
|
|
@@ -28,7 +184,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
184
|
|
29
185
|
## Contributing
|
30
186
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
187
|
+
Bug reports and pull requests are welcome on GitHub at [Permission Settings](https://github.com/Misha7776/permission_settings). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Misha7776/permission_settings/blob/main/CODE_OF_CONDUCT.md).
|
32
188
|
|
33
189
|
## License
|
34
190
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
admin:
|
2
|
+
notifications:
|
3
|
+
read: true
|
4
|
+
create: true
|
5
|
+
edit: true
|
6
|
+
delete: true
|
7
|
+
|
8
|
+
items:
|
9
|
+
read: true
|
10
|
+
create: true
|
11
|
+
edit: true
|
12
|
+
delete: true
|
13
|
+
|
14
|
+
payments:
|
15
|
+
read: true
|
16
|
+
create: true
|
17
|
+
edit: true
|
18
|
+
delete: false
|
19
|
+
|
20
|
+
manager:
|
21
|
+
notifications:
|
22
|
+
read: true
|
23
|
+
create: false
|
24
|
+
edit: false
|
25
|
+
delete: false
|
26
|
+
|
27
|
+
items:
|
28
|
+
read: true
|
29
|
+
create: true
|
30
|
+
edit: true
|
31
|
+
delete: true
|
32
|
+
|
33
|
+
payments:
|
34
|
+
read: true
|
35
|
+
create: true
|
36
|
+
edit: false
|
37
|
+
delete: false
|
38
|
+
|
39
|
+
client:
|
40
|
+
notifications:
|
41
|
+
read: true
|
42
|
+
create: false
|
43
|
+
edit: false
|
44
|
+
delete: false
|
45
|
+
|
46
|
+
items:
|
47
|
+
read: true
|
48
|
+
create: false
|
49
|
+
edit: false
|
50
|
+
delete: false
|
51
|
+
|
52
|
+
payments:
|
53
|
+
read: true
|
54
|
+
create: false
|
55
|
+
edit: false
|
56
|
+
delete: false
|
@@ -0,0 +1,56 @@
|
|
1
|
+
admin:
|
2
|
+
notifications:
|
3
|
+
read: true
|
4
|
+
create: true
|
5
|
+
edit: true
|
6
|
+
delete: true
|
7
|
+
|
8
|
+
items:
|
9
|
+
read: true
|
10
|
+
create: true
|
11
|
+
edit: true
|
12
|
+
delete: true
|
13
|
+
|
14
|
+
payments:
|
15
|
+
read: true
|
16
|
+
create: true
|
17
|
+
edit: true
|
18
|
+
delete: false
|
19
|
+
|
20
|
+
manager:
|
21
|
+
notifications:
|
22
|
+
read: true
|
23
|
+
create: false
|
24
|
+
edit: false
|
25
|
+
delete: false
|
26
|
+
|
27
|
+
items:
|
28
|
+
read: true
|
29
|
+
create: true
|
30
|
+
edit: true
|
31
|
+
delete: true
|
32
|
+
|
33
|
+
payments:
|
34
|
+
read: true
|
35
|
+
create: true
|
36
|
+
edit: false
|
37
|
+
delete: false
|
38
|
+
|
39
|
+
client:
|
40
|
+
notifications:
|
41
|
+
read: true
|
42
|
+
create: false
|
43
|
+
edit: false
|
44
|
+
delete: false
|
45
|
+
|
46
|
+
items:
|
47
|
+
read: true
|
48
|
+
create: false
|
49
|
+
edit: false
|
50
|
+
delete: false
|
51
|
+
|
52
|
+
payments:
|
53
|
+
read: true
|
54
|
+
create: false
|
55
|
+
edit: false
|
56
|
+
delete: false
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
module PermissionSettings
|
6
|
+
class Configuration
|
7
|
+
class PermissionsDirNotFound < StandardError; end
|
8
|
+
|
9
|
+
DEFAULT_PERMISSION_FILE_PATH = 'config/permissions'
|
10
|
+
DEFAULT_ROLE_ACCESS_METHOD = :role
|
11
|
+
|
12
|
+
attr_accessor :role_access_method
|
13
|
+
attr_reader :permissions_dir_path
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@permissions_dir_path = DEFAULT_PERMISSION_FILE_PATH
|
17
|
+
@role_access_method = DEFAULT_ROLE_ACCESS_METHOD
|
18
|
+
end
|
19
|
+
|
20
|
+
def permissions_dir_path=(path)
|
21
|
+
raise PermissionsDirNotFound, 'Permissions directory not found' unless Dir.exist?(path)
|
22
|
+
|
23
|
+
@permissions_dir_path = path
|
24
|
+
end
|
25
|
+
|
26
|
+
def scope_name(klass)
|
27
|
+
[klass.name.underscore, 'permissions'].join('_').to_sym
|
28
|
+
end
|
29
|
+
|
30
|
+
def load_permissions_file(klass)
|
31
|
+
if RUBY_VERSION.to_f >= 3.1
|
32
|
+
YAML.load_file(permission_file_path(klass), aliases: true)
|
33
|
+
else
|
34
|
+
YAML.load_file(permission_file_path(klass))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def permission_file_path(klass)
|
39
|
+
File.join(permissions_dir_path, "#{klass.name.underscore}.yml")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'byebug'
|
4
|
+
require_relative 'verify_instance'
|
5
|
+
|
6
|
+
module PermissionSettings
|
7
|
+
# Class that defines core functionality
|
8
|
+
class Patcher
|
9
|
+
attr_reader :klass
|
10
|
+
|
11
|
+
def initialize(klass)
|
12
|
+
@klass = klass
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.call(klass)
|
16
|
+
new(klass).call
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
setup_settings_interface
|
21
|
+
setup_instance_verification
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def setup_settings_interface
|
27
|
+
klass.class_eval do
|
28
|
+
has_settings do |s|
|
29
|
+
s.key PermissionSettings.configuration.scope_name(self),
|
30
|
+
defaults: PermissionSettings.configuration.load_permissions_file(self)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def setup_instance_verification
|
36
|
+
role_method = PermissionSettings.configuration.role_access_method
|
37
|
+
|
38
|
+
klass.class_eval do
|
39
|
+
define_method(:can?) do |*keys, resource: nil, &block|
|
40
|
+
PermissionSettings::VerifyInstance.call(keys,
|
41
|
+
role: send(role_method),
|
42
|
+
resource: resource,
|
43
|
+
&block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'byebug'
|
4
|
+
require 'active_support/hash_with_indifferent_access'
|
5
|
+
|
6
|
+
module PermissionSettings
|
7
|
+
class Verify
|
8
|
+
def initialize(permission_keys, role, resource, &block)
|
9
|
+
@permission_keys = permission_keys.map(&:to_s)
|
10
|
+
@role = role
|
11
|
+
@resource = resource
|
12
|
+
@block = block
|
13
|
+
@scope = PermissionSettings.configuration.scope_name(resource.class)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.call(permission_keys = [], role: nil, resource: nil, &block)
|
17
|
+
new(permission_keys, role, resource, &block).call
|
18
|
+
end
|
19
|
+
|
20
|
+
def call
|
21
|
+
extract_permission_value
|
22
|
+
raise_not_found_error if permission_value.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :permission_keys, :role, :resource, :block, :permission_value, :scope
|
28
|
+
|
29
|
+
def extract_permission_value
|
30
|
+
fetch_record_permission_value
|
31
|
+
fetch_default_permissions_value if @permission_value.nil?
|
32
|
+
end
|
33
|
+
|
34
|
+
def fetch_record_permission_value
|
35
|
+
@permission_value = action_permitted?(*permission_keys,
|
36
|
+
resource_permissions.presence || default_permissions)
|
37
|
+
end
|
38
|
+
|
39
|
+
def fetch_default_permissions_value
|
40
|
+
@permission_value = action_permitted?(*permission_keys, default_permissions)
|
41
|
+
end
|
42
|
+
|
43
|
+
def action_permitted?(*permission_keys, permissions)
|
44
|
+
permissions.dig(role, *permission_keys.reverse)
|
45
|
+
end
|
46
|
+
|
47
|
+
def resource_permissions
|
48
|
+
ActiveSupport::HashWithIndifferentAccess.new(resource.settings(scope).value)
|
49
|
+
end
|
50
|
+
|
51
|
+
def default_permissions
|
52
|
+
ActiveSupport::HashWithIndifferentAccess.new(resource.default_settings[scope])
|
53
|
+
end
|
54
|
+
|
55
|
+
def raise_not_found_error
|
56
|
+
keys = permission_keys.reverse.unshift(role).join('.')
|
57
|
+
raise NotFoundError, "You need to set #{keys} permission in #{resource.class} class"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'verify'
|
4
|
+
|
5
|
+
module PermissionSettings
|
6
|
+
# comment
|
7
|
+
class VerifyInstance < PermissionSettings::Verify
|
8
|
+
def call
|
9
|
+
super
|
10
|
+
return permission_value unless block_given?
|
11
|
+
|
12
|
+
permission_value && block.call
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/permission_settings.rb
CHANGED
@@ -1,8 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'byebug'
|
4
|
+
|
3
5
|
require_relative 'permission_settings/version'
|
6
|
+
require_relative 'permission_settings/patcher'
|
7
|
+
require_relative 'permission_settings/configuration'
|
4
8
|
|
9
|
+
# Gem entrypoint
|
5
10
|
module PermissionSettings
|
6
|
-
class
|
7
|
-
|
11
|
+
class NotFoundError < StandardError; end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def included(klass)
|
15
|
+
PermissionSettings::Patcher.call(klass)
|
16
|
+
end
|
17
|
+
|
18
|
+
def configuration
|
19
|
+
@configuration ||= Configuration.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure
|
23
|
+
yield(configuration)
|
24
|
+
end
|
25
|
+
end
|
8
26
|
end
|
data/permission_settings.gemspec
CHANGED
@@ -11,11 +11,11 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'Allows to dynamically set, retrieve and check permissions of your resource model'
|
12
12
|
spec.homepage = 'https://github.com/Misha7776/permission_settings'
|
13
13
|
spec.license = 'MIT'
|
14
|
-
spec.required_ruby_version = '>=
|
14
|
+
spec.required_ruby_version = '>= 3.0.0'
|
15
15
|
|
16
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
17
16
|
spec.metadata['source_code_uri'] = spec.homepage
|
18
17
|
spec.metadata['changelog_uri'] = 'https://github.com/Misha7776/permission_settings/main/CHANGELOG.md'
|
18
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -30,8 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
|
-
|
34
|
-
|
35
|
-
# For more information and examples about making a new gem, check out our
|
36
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
33
|
+
spec.add_dependency 'activesupport', '~> 7.0.0'
|
34
|
+
spec.add_dependency 'ledermann-rails-settings', '~> 2.6.1'
|
37
35
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permission_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Misha Push
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ledermann-rails-settings
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.6.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.6.1
|
13
41
|
description:
|
14
42
|
email:
|
15
43
|
- m.push@coaxsoft.com
|
@@ -17,7 +45,6 @@ executables: []
|
|
17
45
|
extensions: []
|
18
46
|
extra_rdoc_files: []
|
19
47
|
files:
|
20
|
-
- ".idea/.gitignore"
|
21
48
|
- ".rspec"
|
22
49
|
- ".rubocop.yml"
|
23
50
|
- CHANGELOG.md
|
@@ -25,17 +52,23 @@ files:
|
|
25
52
|
- LICENSE.txt
|
26
53
|
- README.md
|
27
54
|
- Rakefile
|
55
|
+
- config/custom_permissions/user.yml
|
56
|
+
- config/initializers/permission_settings.rb
|
57
|
+
- config/permissions/user.yml
|
28
58
|
- lib/permission_settings.rb
|
59
|
+
- lib/permission_settings/configuration.rb
|
60
|
+
- lib/permission_settings/patcher.rb
|
61
|
+
- lib/permission_settings/verify.rb
|
62
|
+
- lib/permission_settings/verify_instance.rb
|
29
63
|
- lib/permission_settings/version.rb
|
30
64
|
- permission_settings.gemspec
|
31
|
-
- sig/permission_settings.rbs
|
32
65
|
homepage: https://github.com/Misha7776/permission_settings
|
33
66
|
licenses:
|
34
67
|
- MIT
|
35
68
|
metadata:
|
36
|
-
homepage_uri: https://github.com/Misha7776/permission_settings
|
37
69
|
source_code_uri: https://github.com/Misha7776/permission_settings
|
38
70
|
changelog_uri: https://github.com/Misha7776/permission_settings/main/CHANGELOG.md
|
71
|
+
rubygems_mfa_required: 'true'
|
39
72
|
post_install_message:
|
40
73
|
rdoc_options: []
|
41
74
|
require_paths:
|
@@ -44,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
77
|
requirements:
|
45
78
|
- - ">="
|
46
79
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
80
|
+
version: 3.0.0
|
48
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
82
|
requirements:
|
50
83
|
- - ">="
|
data/.idea/.gitignore
DELETED
data/sig/permission_settings.rbs
DELETED