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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/auth/lh/version.rb +1 -1
- data/lib/auth_lh/role_management.rb +3 -3
- data/lib/auth_lh/user.rb +9 -9
- data/lib/auth_lh/user_extended.rb +1 -1
- data/lib/auth_lh/user_management.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4efea20883c067de98d7cc847a02496c7875a29a
|
4
|
+
data.tar.gz: 65312becc4aadebbcf9c1abd8cf319de3752d110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d599509ee7bb1afac3248a7cdbbbe12962b86fb7cb21fa8f07a911cb6325e20b74dbb4ad6228ac3930df0a3909a5527d4fd3d68dfa4fcc932bb06d54d51919
|
7
|
+
data.tar.gz: 8797c9ee319db402a063afb0b369051648a0da0056285259131517c485824754ad1562b4a813b4232c88c72b38b2eee72ccab6f06aed03e1cf7bf1b4b5c3cd9c
|
data/CHANGELOG.md
CHANGED
data/lib/auth/lh/version.rb
CHANGED
@@ -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(
|
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(
|
25
|
-
all_external.find { |x| x.
|
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, :
|
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?(
|
23
|
-
|
22
|
+
def has_role?(role_id)
|
23
|
+
role_ids.include?(role_id.to_i)
|
24
24
|
end
|
25
25
|
|
26
|
-
def has_some_role?(
|
27
|
-
|
28
|
-
|
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?(
|
33
|
-
|
34
|
-
|
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
|
-
:
|
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(
|
25
|
-
all_external.find_all { |x| x.has_role?(
|
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(
|
28
|
+
def all_external_with_some_role(role_ids)
|
29
29
|
all_external.find_all { |x|
|
30
|
-
|
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.
|
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:
|
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.
|
97
|
+
rubygems_version: 2.4.5.2
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Authentication with auth lh api
|