egov_utils 1.5.0 → 1.5.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: 0dcf2cc8a445a3720966d1c64529d216ec9bce421c1b59fefc1e3a8e611d0501
4
- data.tar.gz: 95e2e7d35ad27dda72e70e95e130beea35699251acfe0197df821fed8d19c891
3
+ metadata.gz: 9fc6111a6eb2353e73a8739cf9ec6deef39850bafd759d57bd1da1d712de94ac
4
+ data.tar.gz: 511095327a6726e8722f6ffc5d06a0d77a8b0191fa7039e067d0d415e5cb732c
5
5
  SHA512:
6
- metadata.gz: 3e78b105c52830f1495c15d55437e627c6556b771f19786eb44bd1124b3d1694d15be23b26c3979da27f10deed692099cf3c9d98001c85dc2fc2f72120be2481
7
- data.tar.gz: 2f0219205440c8ee873c51673e8dda503917c39b28d36c3255f996deef676a8daf3e5c623f1a8b8e31e750302c6523959b890d6df60de8b7f92f891d56ff1dd0
6
+ metadata.gz: 60f5e7271165702e73938b59da2efcfcc47f9dd3568dd9733e844d143b88470b871a4651273b10c5e507e694e29417a1ef75c829a4ce8738601602068a4c590d
7
+ data.tar.gz: 82b126e04ea180491ee30fc030c6989f383b116752ec2ac41d1a6cacbcf55547ddad9afc190223f9c528ff4bfb4941bd75ad7ac07e15cf4b87e30f5c1de56592
@@ -161,8 +161,21 @@ module EgovUtils
161
161
  end
162
162
  end
163
163
 
164
+ def groups
165
+ super.to_a.concat(Array.wrap(ldap_groups))
166
+ end
167
+
164
168
  def ldap_groups
165
- groups.where.not(ldap_uid: nil)
169
+ if provider.present?
170
+ group_ids = persisted? && Rails.cache.read("#{cache_key}/ldap_group_ids", expires_in: 30.minutes)
171
+ if group_ids
172
+ groups = EgovUtils::Group.where(id: group_ids).to_a
173
+ else
174
+ groups = EgovUtils::Group.where(provider: provider).to_a.select{|g| auth_source.member?(ldap_dn, g.external_uid) }
175
+ Rails.cache.write("#{cache_key}/ldap_group_ids", groups.collect(&:id), expires_in: 30.minutes) if persisted?
176
+ end
177
+ groups
178
+ end
166
179
  end
167
180
 
168
181
  def must_change_password?
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.5.0'
2
+ VERSION = '1.5.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-18 00:00:00.000000000 Z
11
+ date: 2025-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails