active_record_api-rest 1.0.25 → 1.0.26
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30207d6586cff266c4f9979030c85bfe9b5e60cb6b4eb1ce9272168e9fe4f74e
|
|
4
|
+
data.tar.gz: b632b903fdfb6dd151c9c0859ddec560a00c467a375d317a73d2f1501f2c3a0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2bb9d74de180ef38de876dceb371e60ed08ea0bcb1d0ddeb92fc4fe4bb0363ccbee5ee82fc8611b6ffe708d5b263f59a71d958496927939b9ab6ac3979fce8b4
|
|
7
|
+
data.tar.gz: bba1e427407944eb1e10c3521f5f61d9ce669c5741a4a492ee0b37c819c89dac918c1191f4ac32e037819c78dadf445696373bf6d9647d0097b77431dbcaf66e
|
|
@@ -16,15 +16,15 @@ module ActiveRecordApi
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def can?
|
|
19
|
-
@can ||=
|
|
19
|
+
@can ||= policy.can?
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def authorized_models
|
|
23
|
-
@authorized_models ||=
|
|
23
|
+
@authorized_models ||= policy.authorized_models
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
@
|
|
26
|
+
def policy
|
|
27
|
+
@policy ||= policy_klass.new(
|
|
28
28
|
session: session,
|
|
29
29
|
model_klass: model_klass,
|
|
30
30
|
action_name: action_name,
|
|
@@ -34,8 +34,8 @@ module ActiveRecordApi
|
|
|
34
34
|
)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def
|
|
38
|
-
"#{self.class.name.remove(/Controller$/)}
|
|
37
|
+
def policy_klass
|
|
38
|
+
"#{self.class.name.remove(/Controller$/)}Policy".safe_constantize || Policy
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module ActiveRecordApi
|
|
2
2
|
module Rest
|
|
3
3
|
module Auth
|
|
4
|
-
class
|
|
4
|
+
class Policy
|
|
5
5
|
include ActiveAttr::Model
|
|
6
6
|
attr_accessor :session, :model_klass, :action_name, :modifiable_params, :queryable_params
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ module ActiveRecordApi
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def can?
|
|
13
|
-
send("#{action_name}?")
|
|
13
|
+
send("can_#{action_name}?")
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def can_manage?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_api-rest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Full Measure Education
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-04-
|
|
11
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -147,7 +147,7 @@ files:
|
|
|
147
147
|
- lib/active_record_api/rest/auth/access_denied_exception.rb
|
|
148
148
|
- lib/active_record_api/rest/auth/bad_session_exception.rb
|
|
149
149
|
- lib/active_record_api/rest/auth/controller.rb
|
|
150
|
-
- lib/active_record_api/rest/auth/
|
|
150
|
+
- lib/active_record_api/rest/auth/policy.rb
|
|
151
151
|
- lib/active_record_api/rest/controller.rb
|
|
152
152
|
- lib/active_record_api/rest/graceful_errors.rb
|
|
153
153
|
- lib/active_record_api/rest/parameters.rb
|