restme 0.0.39 → 1.0.1
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/docker-compose.yml +1 -1
- data/lib/restme/authorize/rules.rb +5 -4
- data/lib/restme/restme.rb +5 -1
- data/lib/restme/scope/rules.rb +1 -5
- data/lib/restme/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e6f83a9517ad4596b91a677ea60bc4520a6d074684ba31069a33967252e520
|
4
|
+
data.tar.gz: 94a3e5fee24cd500c7b1904b048f76df2831f22363a463c1273603f56e996fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42e31bc636a89203a07f9b068ba6916cf6b1df32e978d01bbc01a1f4168c825137c367a5bc6d73c3584b485f8768f32184a2eb026ccd5b78a22f5dcea1a08e74
|
7
|
+
data.tar.gz: 4fc46af681505a061ea78d606410b8dcf7bc490ccf34deae1ec07f9ad36382bd232c9e550781a8bc55d67012ab8af104d0efa56f38ee0462e3fe6261613be1d1
|
data/docker-compose.yml
CHANGED
@@ -10,11 +10,12 @@ module Restme
|
|
10
10
|
include ::Restme::Shared::CurrentModel
|
11
11
|
include ::Restme::Shared::UserRole
|
12
12
|
|
13
|
-
def
|
14
|
-
return true
|
15
|
-
return authorize_errors unless authorize?
|
13
|
+
def user_authorized?
|
14
|
+
return true if restme_current_user.blank? || authorize?
|
16
15
|
|
17
|
-
|
16
|
+
authorize_errors
|
17
|
+
|
18
|
+
false
|
18
19
|
end
|
19
20
|
|
20
21
|
def authorize?
|
data/lib/restme/restme.rb
CHANGED
@@ -18,11 +18,15 @@ module Restme
|
|
18
18
|
def initialize_restme
|
19
19
|
use_current_user
|
20
20
|
|
21
|
-
|
21
|
+
restme_authorize_response unless user_authorized?
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
+
def restme_authorize_response
|
27
|
+
render json: restme_scope_errors, status: restme_scope_status
|
28
|
+
end
|
29
|
+
|
26
30
|
def use_current_user
|
27
31
|
@restme_current_user = try(:current_user)
|
28
32
|
end
|
data/lib/restme/scope/rules.rb
CHANGED
@@ -58,7 +58,7 @@ module Restme
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def model_scope
|
61
|
-
@model_scope ||=
|
61
|
+
@model_scope ||= custom_scope
|
62
62
|
end
|
63
63
|
|
64
64
|
def pagination
|
@@ -79,10 +79,6 @@ module Restme
|
|
79
79
|
@restme_scope_status ||= status
|
80
80
|
end
|
81
81
|
|
82
|
-
def without_item_in_scope?
|
83
|
-
!user_scope.exists?
|
84
|
-
end
|
85
|
-
|
86
82
|
def custom_scope
|
87
83
|
@filtered_scope = filterable_scope(user_scope)
|
88
84
|
@sorted_scope = sortable_scope(filtered_scope)
|
data/lib/restme/version.rb
CHANGED