unidom-authorization 1.6.1 → 1.6.2

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
  SHA1:
3
- metadata.gz: 7984b6c161a9b4aca20a2cde74685ae17608f298
4
- data.tar.gz: 23452781745ca69a5d06a94536f242cb61dfd02b
3
+ metadata.gz: 7f606e2b92a57d5ec745cda441d7da33b79a484e
4
+ data.tar.gz: 96ff8f3d4af000942776552800b59ef9359ba1ff
5
5
  SHA512:
6
- metadata.gz: cca7a56defb0241a5591abe3a98e10366dc7ed9128d62930c2339983298cd3cf67c51b0b144d8c3a9fe77a763f852ad43842ac88e59eacdd59a9ff7459dea919
7
- data.tar.gz: '09b998963d29d63be072ac8460ef824c72e964486713b441f330302b3623544c6320979beb3adab61d5a352d16af94ab28e88c6598a2531d3249bb39c4f66077'
6
+ metadata.gz: b11a0816e6003a8de6ddd30ac71c1e9bc7292e0e6dcc597b706d9044c06458135f9159d03af4662862d328af73f061efcbae3384f802ebe86fbf7678fa5a499d
7
+ data.tar.gz: 409daacaea1c2d3c8de54626a5d8945e5d131f1d2ffbd66655887f9013e230670933d30955264b089c05dd11306d58ed243a20cc6bb7695f9e5b651644e77e70
@@ -11,9 +11,9 @@ class Unidom::Authorization::Authorizing < Unidom::Authorization::ApplicationRec
11
11
  belongs_to :authorizer, polymorphic: true
12
12
  belongs_to :authorized, polymorphic: true
13
13
 
14
- scope :permission_is, ->(permission) { where permission_id: (permission.respond_to?(:id) ? permission.id : permission) }
15
- scope :authorized_is, ->(authorized) { where authorized: authorized }
16
- scope :authorized_by, ->(authorizer) { where authorizer: authorizer }
14
+ scope :permission_is, ->(permission) { where permission_id: to_id(permission) }
15
+ scope :authorized_is, ->(authorized) { where authorized: authorized }
16
+ scope :authorized_by, ->(authorizer) { where authorizer: authorizer }
17
17
 
18
18
  ##
19
19
  # 授予 authorized 权限 permission ,授权者是 authorizer ,授权时间是 opened_at。如:
@@ -18,7 +18,12 @@ describe Unidom::Authorization::Authorizing, type: :model do
18
18
 
19
19
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
20
 
21
- #it_behaves_like 'belongs_to', model_attributes, :permission, Unidom::Authorization::Permission, { name: 'User Management', path: 'administration/users'}
21
+ permission_attributes = {
22
+ name: 'User Management',
23
+ path: 'administration/users'
24
+ }
25
+
26
+ it_behaves_like 'belongs_to', model_attributes, :permission, Unidom::Authorization::Permission, permission_attributes
22
27
 
23
28
  it_behaves_like 'scope', :permission_is, [
24
29
  { attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:permission_id] ] },
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Authorization
3
- VERSION = '1.6.1'.freeze
3
+ VERSION = '1.6.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-26 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common