mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-14 23:33:19 +00:00
adjustments for ldap
This commit is contained in:
@@ -18,7 +18,6 @@ namespace Bit.Core.Models
|
||||
switch(type)
|
||||
{
|
||||
case DirectoryType.ActiveDirectory:
|
||||
MemberAttribute = "memberOf";
|
||||
CreationDateAttribute = "whenCreated";
|
||||
RevisionDateAttribute = "whenChanged";
|
||||
UserEmailPrefixAttribute = "sAMAccountName";
|
||||
@@ -33,7 +32,7 @@ namespace Bit.Core.Models
|
||||
UserEmailSuffix = null;
|
||||
break;
|
||||
case DirectoryType.Other:
|
||||
IntervalMinutes = 30;
|
||||
IntervalMinutes = 60;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
@@ -104,7 +105,7 @@ namespace Bit.Core.Services
|
||||
var initialSearchGroupIds = new List<string>();
|
||||
foreach(SearchResult item in result)
|
||||
{
|
||||
initialSearchGroupIds.Add(new Uri(item.Path).Segments?.LastOrDefault());
|
||||
initialSearchGroupIds.Add(DNFromPath(item.Path));
|
||||
}
|
||||
|
||||
if(searchSinceRevision && !initialSearchGroupIds.Any())
|
||||
@@ -144,7 +145,7 @@ namespace Bit.Core.Services
|
||||
var dict = new Dictionary<string, string>();
|
||||
foreach(SearchResult item in result)
|
||||
{
|
||||
var referenceId = new Uri(item.Path).Segments?.LastOrDefault();
|
||||
var referenceId = DNFromPath(item.Path);
|
||||
var externalId = referenceId;
|
||||
|
||||
if(item.Properties.Contains("objectGUID") && item.Properties["objectGUID"].Count > 0)
|
||||
@@ -161,7 +162,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
var group = new GroupEntry
|
||||
{
|
||||
ReferenceId = new Uri(item.Path).Segments?.LastOrDefault()
|
||||
ReferenceId = DNFromPath(item.Path)
|
||||
};
|
||||
|
||||
if(group.ReferenceId == null)
|
||||
@@ -297,7 +298,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
var user = new UserEntry
|
||||
{
|
||||
ReferenceId = new Uri(item.Path).Segments?.LastOrDefault(),
|
||||
ReferenceId = DNFromPath(item.Path),
|
||||
Deleted = deleted
|
||||
};
|
||||
|
||||
@@ -362,5 +363,16 @@ namespace Bit.Core.Services
|
||||
|
||||
return (control & UserAccountControl.AccountDisabled) == UserAccountControl.AccountDisabled;
|
||||
}
|
||||
|
||||
private static string DNFromPath(string path)
|
||||
{
|
||||
var dn = new Uri(path).Segments?.LastOrDefault();
|
||||
if(dn == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return WebUtility.UrlDecode(dn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ namespace Service
|
||||
}
|
||||
|
||||
var intervalMinutes = SettingsService.Instance.Sync.IntervalMinutes;
|
||||
if(SettingsService.Instance.Server.Type == Bit.Core.Enums.DirectoryType.Other && intervalMinutes < 30)
|
||||
if(SettingsService.Instance.Server.Type == Bit.Core.Enums.DirectoryType.Other && intervalMinutes < 60)
|
||||
{
|
||||
intervalMinutes = 30;
|
||||
intervalMinutes = 60;
|
||||
}
|
||||
else if(intervalMinutes < 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user