thecore_auth_commons 3.6.0 → 3.6.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 +4 -4
- data/README.md +1 -1
- data/app/models/ldap_server.rb +8 -7
- data/lib/thecore_auth_commons/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbdfa5e8e3ee139099bf681626e66c17459f3c0df764de2d1795fcb5bba8a71e
|
|
4
|
+
data.tar.gz: 73c4937049f42505c872d0360bbb38889d038f1c135332081fe3237e2ea7c82b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59d97568329cf50d32c444eaef8059199bc6f4d192976ab5b04b9209414b405be8808d16cf7eb87617976effb084e76a374a336d84dba87bbbf0fdd269b23559
|
|
7
|
+
data.tar.gz: 22984f97a81b0a638cfa259ede0e525390d00889793976436744da448549c3d0cd4fd14ba8e7119ca67f1c36b3517b8c98c557a719c54e34aa0e99b580d22a6d
|
data/README.md
CHANGED
|
@@ -104,7 +104,7 @@ Multiple servers are supported, ordered by `priority` (ascending). Each server c
|
|
|
104
104
|
|
|
105
105
|
On LDAP login or import, `memberOf` groups are read; matching group names become `Role` records assigned to the user. Groups named `Administrators`, `Domain Admins`, `Schema Admins`, `Enterprise Admins`, `admins`, or `administrators` also grant `user.admin = true`.
|
|
106
106
|
|
|
107
|
-
Deleting a `LdapServer` record
|
|
107
|
+
Deleting a `LdapServer` record keeps all users whose `auth_source` is `"ldap #{id}"` — same record, same roles — and turns them into local users (`auth_source = "local"`). To log in again they need a local password, set by hand.
|
|
108
108
|
|
|
109
109
|
### Background LDAP import
|
|
110
110
|
|
data/app/models/ldap_server.rb
CHANGED
|
@@ -10,8 +10,9 @@ class LdapServer < ApplicationRecord
|
|
|
10
10
|
validates :base_dn, presence: true
|
|
11
11
|
|
|
12
12
|
# Callbacks
|
|
13
|
-
#
|
|
14
|
-
|
|
13
|
+
# Users imported from this server outlive it: they become local users, same record and roles,
|
|
14
|
+
# and need a local password set by hand to log in again.
|
|
15
|
+
after_destroy :turn_users_into_local_users
|
|
15
16
|
|
|
16
17
|
def test_connection
|
|
17
18
|
# Test the connection to the LDAP server
|
|
@@ -37,10 +38,10 @@ class LdapServer < ApplicationRecord
|
|
|
37
38
|
|
|
38
39
|
private
|
|
39
40
|
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
# Destroying the users here used to strip their roles even when the destroy was refused: a
|
|
42
|
+
# User's dependents are destroyed before any later before_destroy guard aborts, and the
|
|
43
|
+
# abort's rollback is swallowed inside this record's own transaction, so it never undid them.
|
|
44
|
+
def turn_users_into_local_users
|
|
45
|
+
User.where(auth_source: "ldap #{id}").update_all(auth_source: "local", updated_at: Time.current)
|
|
45
46
|
end
|
|
46
47
|
end
|