role_core 0.0.26 → 0.0.27

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
  SHA256:
3
- metadata.gz: 37317c08fd473381f65f6d583ad90c3cc36ee2f79a27461d037d25c4a618a89d
4
- data.tar.gz: 216d88ad8ae195f935b3096c156d4fe9490fb9c2491982fc36b7791af341ea26
3
+ metadata.gz: b871889f8b71162c5c7c24045116015b8150665efba84a9b2016bad9027899ba
4
+ data.tar.gz: 17023a72c92dd4b0db76b0f38cd553c0e23b12e06fc963c0410b5dc9c05bf34c
5
5
  SHA512:
6
- metadata.gz: ec5646dfdc2648120ebb8b5fe8f300b97a3edf3e4ba613a38becf5a7b311ce77778afcdc55c1346f2271581835ba8046a785fec3cd90798570c6d9f7fc5082e8
7
- data.tar.gz: b9dc82258bd777cc26996941e91c97b3750d81bd1e0040acf229f7a933d1385a2f68d3694fdc0ddcd4f4dde893e2435986ee3b209de59d725fb1afdc4ff12674
6
+ metadata.gz: c0064979352e03f2ed97771968a7a268ae2682b21b89eaa7bd132cd8026a727974430d212bcae3a75e06e67e848891bf62879eb63ee480d4823092ce76d2e4a9
7
+ data.tar.gz: 8253d8d25ae47411db785c44170dec128d0e0a802e8c259c358f95c0440b8b31cd54701d3d4f9a1c97b5e05142bbe0bc11baf7818eddd4584f340fe55d3bd629
data/README.md CHANGED
@@ -76,8 +76,8 @@ In fact, the essence of permissions is Hash, keys are permissions, and values ar
76
76
 
77
77
  ### Management UI
78
78
 
79
- Building a management UI is difficult,
80
- but virtual model technique will translates permissions to a virtual model's (a class that conforms to ActiveModel) attributes,
79
+ Building a management UI is difficult,
80
+ but virtual model technique will translates permissions to a virtual model's (a class that conforms to ActiveModel) attributes,
81
81
  and groups will translates to nested virtual models,
82
82
  that means you can use all Rails view helpers including the mighty form builder,
83
83
  and can benefit to Strong Parameter.
@@ -305,7 +305,7 @@ class PostPolicy
305
305
  def update?
306
306
  user.permissions.post.update?
307
307
  end
308
-
308
+
309
309
  def update_my_own?
310
310
  return true if user.permissions.post.update?
311
311
  return unless user.permissions.post.update_my_own?
@@ -340,6 +340,20 @@ Open your User model:
340
340
 
341
341
  Open `app/models/ability.rb`, add `user.computed_permissions.call(self, user)` to `initialize` method.
342
342
 
343
+ ```ruby
344
+ class Ability
345
+ include CanCan::Ability
346
+
347
+ def initialize(user)
348
+ # Apply RoleCole managing permissions
349
+ user.computed_permissions.call(self, user)
350
+
351
+ # You still can add other permissions
352
+ can :read_public, :all
353
+ end
354
+ end
355
+ ```
356
+
343
357
  You can check dummy app for better understanding.
344
358
 
345
359
  ### Management UI
@@ -375,7 +389,7 @@ Here's an example:
375
389
  - Generate dynamic permissions set in runtime
376
390
  ```ruby
377
391
  # Create a new permission set to containerize dynamic permissions
378
- # `"Dynamic"` can be named to other but must be a valid Ruby class name,
392
+ # `"Dynamic"` can be named to other but must be a valid Ruby class name,
379
393
  # that's a hacking for `ActiveModel::Naming`,
380
394
  # and can be used as I18n key, in this case, the key is `role_core/models/dynamic`.
381
395
  dynamic_permission_set_class = PermissionSet.derive "Dynamic"
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ load "rails/tasks/engine.rake"
21
21
 
22
22
  load "rails/tasks/statistics.rake"
23
23
 
24
- # require "bundler/gem_tasks"
24
+ require "bundler/gem_tasks"
25
25
 
26
26
  require "rake/testtask"
27
27
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module RoleCore
4
4
  class Mapper
5
- def initialize(set, constraints = {}) #:nodoc:
5
+ def initialize(set, constraints = {}) # :nodoc:
6
6
  @constraints = constraints
7
7
  @constraints[:_namespace] ||= []
8
8
  @set = set
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RoleCore
4
- VERSION = "0.0.26"
4
+ VERSION = "0.0.27"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: role_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-25 00:00:00.000000000 Z
11
+ date: 2021-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: options_model
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '5'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7'
42
+ version: '8'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '5'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7'
52
+ version: '8'
53
53
  description: RoleCore is a Rails engine which could provide essential industry of
54
54
  Role-based access control.
55
55
  email:
@@ -85,7 +85,7 @@ homepage: https://github.com/rails-engine/role_core
85
85
  licenses:
86
86
  - MIT
87
87
  metadata: {}
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -100,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.1.2
104
- signing_key:
103
+ rubygems_version: 3.2.32
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: RoleCore is a Rails engine which could provide essential industry of Role-based
107
107
  access control.