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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66521fd280c2f53800dfece67dc0167d10f25b76a2d435064fdaea3d37f9b260
4
- data.tar.gz: 3e8f3889d228f4e051e3516d23fedb16dacea71393667c9acbf6b897f42c5e6f
3
+ metadata.gz: 34e6f83a9517ad4596b91a677ea60bc4520a6d074684ba31069a33967252e520
4
+ data.tar.gz: 94a3e5fee24cd500c7b1904b048f76df2831f22363a463c1273603f56e996fde
5
5
  SHA512:
6
- metadata.gz: c4f29154906b6b23c1d2b2f2b18aa3be16da6c1b6e9d0f0952360eea13c141e05c39a6eaee952d402685e94556a07f2063137cbdcbbabbf8b0046434795e5124
7
- data.tar.gz: 58e3f792a2f85054f3a9ff88ab19bd70fd9ceb6c1a3f9308bbdf403b53a6dab56430bc6ddc9af47d83941ef48cc629e2b4d360b523136282b8f543ca9f996c08
6
+ metadata.gz: 42e31bc636a89203a07f9b068ba6916cf6b1df32e978d01bbc01a1f4168c825137c367a5bc6d73c3584b485f8768f32184a2eb026ccd5b78a22f5dcea1a08e74
7
+ data.tar.gz: 4fc46af681505a061ea78d606410b8dcf7bc490ccf34deae1ec07f9ad36382bd232c9e550781a8bc55d67012ab8af104d0efa56f38ee0462e3fe6261613be1d1
data/docker-compose.yml CHANGED
@@ -17,7 +17,7 @@ services:
17
17
  volumes:
18
18
  - postgres_db:/var/lib/postgresql/data
19
19
  ports:
20
- - "5432:5432"
20
+ - "5442:5432"
21
21
  mem_limit: 512mb
22
22
  restart: unless-stopped
23
23
  environment:
@@ -10,11 +10,12 @@ module Restme
10
10
  include ::Restme::Shared::CurrentModel
11
11
  include ::Restme::Shared::UserRole
12
12
 
13
- def user_authorize
14
- return true unless restme_current_user
15
- return authorize_errors unless authorize?
13
+ def user_authorized?
14
+ return true if restme_current_user.blank? || authorize?
16
15
 
17
- true
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
- user_authorize
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
@@ -58,7 +58,7 @@ module Restme
58
58
  end
59
59
 
60
60
  def model_scope
61
- @model_scope ||= without_item_in_scope? ? user_scope : custom_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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restme
4
- VERSION = "0.0.39"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - everson-ever