unidom-authorization 0.2 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/unidom/authorization/authorizing.rb +5 -1
- data/lib/unidom/authorization/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33f00597f81f77f4af640b1cb72e47e736e1c3f
|
4
|
+
data.tar.gz: b178379cec884fbce6f3a69e2b34e8438c0537a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5306f671d64ab3f36b7358a11b0769c44d058b5615cd8381ee65ada803552ad102fc9357ec95800a6f985dbbb3d2620cf001376799222b8d20ec904811b8a90e
|
7
|
+
data.tar.gz: 38a89f8d22957deb576c3aee72f99106bb3772c337ab076e7eae70051ab8f29fa02ddb16bf82ae4a0a6fc44d4c3e2400a93fd64d9a7d2dddaf5ed460e6bf9850
|
data/README.md
CHANGED
@@ -27,5 +27,5 @@ Unidom::Authorization::Permission.valid_at.alive
|
|
27
27
|
Unidom::Authorization::Authorizing.valid_at.alive
|
28
28
|
|
29
29
|
permission = Unidom::Authorization::Permission.valid_at.alive.first
|
30
|
-
Unidom::Authorization::Authorizing.authorize! permission, user
|
30
|
+
Unidom::Authorization::Authorizing.authorize! permission: permission, authorized: user
|
31
31
|
```
|
@@ -14,7 +14,11 @@ class Unidom::Authorization::Authorizing < ActiveRecord::Base
|
|
14
14
|
scope :authorized_is, ->(authorized) { where authorized: authorized }
|
15
15
|
scope :authorized_by, ->(authorizer) { where authorizer: authorizer }
|
16
16
|
|
17
|
-
def self.authorize!(permission, authorized, authorizer
|
17
|
+
def self.authorize!(permission: nil, authorized: nil, authorizer: nil, opened_at: Time.now)
|
18
|
+
raise ArgumentError.new('The authorized argument is required.') if authorized.blank?
|
19
|
+
raise ArgumentError.new('The opened_at argument is required.' ) if opened_at.blank?
|
20
|
+
raise ArgumentError.new('The permission argument is required.') if permission.blank?
|
21
|
+
|
18
22
|
attributes = { opened_at: opened_at }
|
19
23
|
if authorizer.present?
|
20
24
|
attributes[:authorizer] = authorizer
|
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: '0
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|