Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117710352
D5610.1774885581.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5610.1774885581.diff
View Options
diff --git a/src/app/Auth/OAuth.php b/src/app/Auth/OAuth.php
--- a/src/app/Auth/OAuth.php
+++ b/src/app/Auth/OAuth.php
@@ -127,7 +127,7 @@
{
$response = [
// Per OIDC spec. 'sub' must be always returned
- 'sub' => $user->id,
+ 'sub' => $user->getSetting('uid') ?: $user->id,
];
if ($user->tokenCan('email')) {
diff --git a/src/app/Backends/LDAP.php b/src/app/Backends/LDAP.php
--- a/src/app/Backends/LDAP.php
+++ b/src/app/Backends/LDAP.php
@@ -396,7 +396,7 @@
self::throwException($ldap, "Failed to create user {$user->email} in LDAP (" . __LINE__ . ")");
}
- self::setUserAttributes($user, $entry);
+ self::setUserAttributes($user, $entry, true);
self::addEntry(
$ldap,
@@ -1055,10 +1055,10 @@
/**
* Set common user attributes
*/
- private static function setUserAttributes(User $user, array &$entry)
+ private static function setUserAttributes(User $user, array &$entry, $is_new = false)
{
$isDegraded = $user->isDegraded(true);
- $settings = $user->getSettings(['first_name', 'last_name', 'organization']);
+ $settings = $user->getSettings(['first_name', 'last_name', 'organization', 'uid']);
$firstName = $settings['first_name'];
$lastName = $settings['last_name'];
@@ -1084,6 +1084,10 @@
}
}
+ if ($is_new && !empty($settings['uid'])) {
+ $entry['nsuniqueid'] = $settings['uid'];
+ }
+
$entry['cn'] = $cn;
$entry['displayname'] = $displayname;
$entry['givenname'] = $firstName;
diff --git a/src/app/Console/Commands/Data/Import/LdifCommand.php b/src/app/Console/Commands/Data/Import/LdifCommand.php
--- a/src/app/Console/Commands/Data/Import/LdifCommand.php
+++ b/src/app/Console/Commands/Data/Import/LdifCommand.php
@@ -963,6 +963,7 @@
'mailalternateaddress' => 'external_email',
'mobile' => 'phone',
'o' => 'organization',
+ 'nsuniqueid' => 'uid',
// 'address' => 'billing_address'
];
diff --git a/src/tests/Feature/Backends/LDAPTest.php b/src/tests/Feature/Backends/LDAPTest.php
--- a/src/tests/Feature/Backends/LDAPTest.php
+++ b/src/tests/Feature/Backends/LDAPTest.php
@@ -377,6 +377,7 @@
Queue::fake();
$user = $this->getTestUser('user-ldap-test@' . \config('app.domain'));
+ $user->setSetting('uid', '1111');
LDAP::createUser($user);
@@ -405,6 +406,7 @@
'mailquota' => null,
'o' => '',
'alias' => null,
+ 'nsuniqueid' => '1111',
];
foreach ($expected as $attr => $value) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 3:46 PM (2 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18815724
Default Alt Text
D5610.1774885581.diff (2 KB)
Attached To
Mode
D5610: SSO: Use (old) user identifier (if available)
Attached
Detach File
Event Timeline