ocean-rails 4.1.5 → 4.1.6
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/app/helpers/application_helper.rb +9 -2
- data/lib/ocean-rails.rb +2 -2
- data/lib/ocean/ocean_application_controller.rb +2 -2
- data/lib/ocean/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: 63ca7637df130db08dda89487685ab261006299d
|
4
|
+
data.tar.gz: 2ad788ad6233fa6c819deaba1bc9e615bf9f3fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48512b574084859bb88862cfc565e74fece0c52ae8f15138a013a2852dd8a2f3b4341a5773239a0680108862d444f010604f4f4bc61e22ee42746c280a3d6382
|
7
|
+
data.tar.gz: dbfb5e8a596c89e3812a8eb9d4c1c8534068a407d38d83699bb342a464dc1a9d8a8175f554a6db1f33e58fa577ac1fc24c8f53c636578770deb16c30adde6868
|
@@ -22,16 +22,23 @@ module ApplicationHelper
|
|
22
22
|
#
|
23
23
|
def api_user_url(x)
|
24
24
|
if x.blank?
|
25
|
-
"#{OCEAN_API_URL}/#{Api.version_for :api_user}/api_users/0"
|
25
|
+
"#{OCEAN_API_URL}/#{Api.version_for :api_user}/api_users/0-0-0-0-0"
|
26
26
|
elsif x.is_a?(Integer)
|
27
27
|
"#{OCEAN_API_URL}/#{Api.version_for :api_user}/api_users/#{x}"
|
28
28
|
elsif x.is_a?(String)
|
29
|
-
x
|
29
|
+
x =~ /^http(s)?:\/\// ? x : "#{OCEAN_API_URL}/#{Api.version_for :api_user}/api_users/#{x}"
|
30
30
|
else
|
31
31
|
raise "api_user_url takes an integer, a string, or nil"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
#
|
36
|
+
# This is an alias of +api_user_url+.
|
37
|
+
#
|
38
|
+
def api_user_url_smart(x)
|
39
|
+
api_user_url(x)
|
40
|
+
end
|
41
|
+
|
35
42
|
|
36
43
|
#
|
37
44
|
# View helper predicates to determine if the ApiUser behind the current
|
data/lib/ocean-rails.rb
CHANGED
@@ -39,12 +39,12 @@ end
|
|
39
39
|
# and +creator_uri+ given by the parameters. It also allows the value of 'right' to
|
40
40
|
# be specified: this will restrict all SQL queries accordingly.
|
41
41
|
#
|
42
|
-
def permit_with(status, user_id:
|
42
|
+
def permit_with(status, user_id: "1-2-3-4-5", creator_uri: "https://api.example.com/v1/api_users/#{user_id}",
|
43
43
|
right: nil, group_names: [])
|
44
44
|
allow(Api).to receive(:permitted?).
|
45
45
|
and_return(double(:status => status,
|
46
46
|
:body => {'authentication' =>
|
47
|
-
{'user_id' => user_id,
|
47
|
+
{#'user_id' => user_id,
|
48
48
|
'right' => right,
|
49
49
|
'group_names' => group_names,
|
50
50
|
'_links' => { 'creator' => {'href' => creator_uri,
|
@@ -68,7 +68,7 @@ module OceanApplicationController
|
|
68
68
|
response = Api.permitted?(@x_api_token, query: qs)
|
69
69
|
if response.status == 200
|
70
70
|
a = response.body['authentication']
|
71
|
-
|
71
|
+
#@auth_api_user_id = a['user_id'] # Deprecate and remove
|
72
72
|
@auth_api_user_uri = a['_links']['creator']['href'] # Keep
|
73
73
|
Thread.current[:username] = a['username']
|
74
74
|
@right_restrictions = a['right']
|
@@ -91,7 +91,7 @@ module OceanApplicationController
|
|
91
91
|
#
|
92
92
|
def set_updater(obj)
|
93
93
|
id_or_uri = obj.created_by.is_a?(Integer) ? @auth_api_user_id : @auth_api_user_uri
|
94
|
-
obj.created_by = id_or_uri if obj.created_by.blank? || obj.created_by == 0
|
94
|
+
obj.created_by = id_or_uri if obj.created_by.blank? || obj.created_by == 0 || obj.created_by == "0-0-0-0-0"
|
95
95
|
obj.updated_by = id_or_uri
|
96
96
|
end
|
97
97
|
|
data/lib/ocean/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocean-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Bengtson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|