auth-lh 0.16.0 → 0.17.0

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
  SHA1:
3
- metadata.gz: 84a2280a0034c71315f3616b03000ff512f082f6
4
- data.tar.gz: 24725f8dfcf521e5c9191f2aebb63c9eff6ea529
3
+ metadata.gz: 4efea20883c067de98d7cc847a02496c7875a29a
4
+ data.tar.gz: 65312becc4aadebbcf9c1abd8cf319de3752d110
5
5
  SHA512:
6
- metadata.gz: d2337990e8448a7d311f5af6f963037ade570c2dc56fb510719c40ba6cfc663add883da38210ffab9e99e40c52285ecc97d2161ac9add7c478408736c6a4b0ab
7
- data.tar.gz: f6fae7842d2ff09b7f7d60fdb4f19ccffd357219a2950a78b124273068537819d544db8bde4ba0c2520bbcc2c1f47ea5f95180d2b1668b0280fe6f3d628fb41d
6
+ metadata.gz: c7d599509ee7bb1afac3248a7cdbbbe12962b86fb7cb21fa8f07a911cb6325e20b74dbb4ad6228ac3930df0a3909a5527d4fd3d68dfa4fcc932bb06d54d51919
7
+ data.tar.gz: 8797c9ee319db402a063afb0b369051648a0da0056285259131517c485824754ad1562b4a813b4232c88c72b38b2eee72ccab6f06aed03e1cf7bf1b4b5c3cd9c
data/CHANGELOG.md CHANGED
@@ -193,3 +193,7 @@
193
193
  ## v0.16.0
194
194
 
195
195
  * Bugfix getting current shop.
196
+
197
+ ## v0.17.0
198
+
199
+ * Replaced role codes by role ids.
@@ -1,5 +1,5 @@
1
1
  module Auth
2
2
  module Lh
3
- VERSION = "0.16.0"
3
+ VERSION = "0.17.0"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ module AuthLh
6
6
 
7
7
  def auth_role
8
8
  if @auth_role.nil?
9
- @auth_role = self.class.find_external(code)
9
+ @auth_role = self.class.find_external(id)
10
10
  end
11
11
 
12
12
  @auth_role
@@ -21,8 +21,8 @@ module AuthLh
21
21
  @cached_roles ||= AuthLh::Api.get_roles
22
22
  end
23
23
 
24
- def find_external(code)
25
- all_external.find { |x| x.code == code.to_s }
24
+ def find_external(id)
25
+ all_external.find { |x| x.id == id.to_i }
26
26
  end
27
27
 
28
28
  def clear_cache!
data/lib/auth_lh/user.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module AuthLh
2
2
  class User
3
3
  attr_accessor :email, :jabber, :first_name, :last_name, :login,
4
- :shop_code, :shop_id, :shop_name, :enabled, :role_codes,
4
+ :shop_code, :shop_id, :shop_name, :enabled, :role_ids,
5
5
  :password_expired, :has_remote_desktop, :attendance_mode,
6
6
  :fingerprint_from, :fingerprint_to, :external_apps
7
7
 
@@ -19,19 +19,19 @@ module AuthLh
19
19
  "#{first_name} #{last_name}"
20
20
  end
21
21
 
22
- def has_role?(role_code)
23
- role_codes.include?(role_code.to_s)
22
+ def has_role?(role_id)
23
+ role_ids.include?(role_id.to_i)
24
24
  end
25
25
 
26
- def has_some_role?(r_codes)
27
- r_codes.any? { |r_code|
28
- role_codes.include?(r_code.to_s)
26
+ def has_some_role?(r_ids)
27
+ r_ids.any? { |r_id|
28
+ role_ids.include?(r_id.to_i)
29
29
  }
30
30
  end
31
31
 
32
- def has_all_roles?(r_codes)
33
- r_codes.all? { |r_code|
34
- role_codes.include?(r_code.to_s)
32
+ def has_all_roles?(r_ids)
33
+ r_ids.all? { |r_id|
34
+ role_ids.include?(r_id.to_i)
35
35
  }
36
36
  end
37
37
  end
@@ -5,7 +5,7 @@ module AuthLh
5
5
  :allow_remote_access, :session_timeout, :only_working_time,
6
6
  :allow_multiple_sessions, :working_time, :has_remote_desktop,
7
7
  :fingerprint_from, :fingerprint_to, :attendance_mode,
8
- :role_codes, :app_codes
8
+ :role_ids, :app_codes
9
9
 
10
10
  def initialize(attributes={})
11
11
  attributes.each do |k,v|
@@ -21,13 +21,13 @@ module AuthLh
21
21
  @cached_users ||= AuthLh::Api.get_users({ pagination: 'false' })
22
22
  end
23
23
 
24
- def all_external_with_role(role_code)
25
- all_external.find_all { |x| x.has_role?(role_code) }
24
+ def all_external_with_role(role_id)
25
+ all_external.find_all { |x| x.has_role?(role_id) }
26
26
  end
27
27
 
28
- def all_external_with_some_role(role_codes)
28
+ def all_external_with_some_role(role_ids)
29
29
  all_external.find_all { |x|
30
- role_codes.any? { |role_code| x.has_role?(role_code) }
30
+ role_ids.any? { |role_id| x.has_role?(role_id) }
31
31
  }
32
32
  end
33
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-lh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.5.1
97
+ rubygems_version: 2.4.5.2
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Authentication with auth lh api