ocean-rails 4.1.5 → 4.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79cfdbb9fd109b9b240836259183c5269af1dcd5
4
- data.tar.gz: fa8a5c44c6004df123e70c7efdd22dfc6d99b84d
3
+ metadata.gz: 63ca7637df130db08dda89487685ab261006299d
4
+ data.tar.gz: 2ad788ad6233fa6c819deaba1bc9e615bf9f3fc7
5
5
  SHA512:
6
- metadata.gz: a45ac48ba046f42223ad48471017c99092697372ba5238bfb3b639a140a9198d76ec757a7ed8acbf10d19afd1f668907aabc1a36a272cb57f3d59bd23d03b0fd
7
- data.tar.gz: b9eff2df4942131bc76bc898db290de2776c2cc3007ea4362d16c7fc51fe7ae716106b372b078e10be6d4d47a0aef2b329d1202a5eb351ce59a49726ec19cc7c
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: 123, creator_uri: "https://api.example.com/v1/api_users/#{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
- @auth_api_user_id = a['user_id'] # Deprecate and remove
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
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "4.1.5"
2
+ VERSION = "4.1.6"
3
3
  end
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.5
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-05-09 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus