Compare commits

...

2 Commits

Author SHA1 Message Date
Jonathan Jenne
a64d3461a7 update to devexpress 18, finish migration to active directory interface 2019-11-08 15:10:35 +01:00
Jonathan Jenne
4f77749c9a clean up, add config module, use logger module, use database module 2019-11-08 10:56:54 +01:00
21 changed files with 826 additions and 564 deletions

View File

@@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DDUserManager.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DDUserManager.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DDUserManager.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DDUserManager.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<connectionStrings>
<add name="DDUserManager.My.MySettings.DD_ECMConnectionString"
connectionString="Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
<add name="DDUserManager.My.MySettings.DD_ECMConnectionString" connectionString="Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<userSettings>
<DDUserManager.My.MySettings>
<setting name="AD_USER_QUERY" serializeAs="String">
<value />
<value/>
</setting>
</DDUserManager.My.MySettings>
</userSettings>

View File

@@ -1,230 +0,0 @@
Imports System.DirectoryServices
Imports System.DirectoryServices.AccountManagement
Public Class ClassActiveDirectory
Private Shared logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()
Private Shared excludedGroupNames As New List(Of String) From {
"Abgelehnte",
"DHCP",
"Distributed COM",
"Dns",
"Domänen-Gäste",
"Domänencomput",
"Domänencontroller",
"Druck",
"Einstellungen eingehender",
"Erstellungen",
"Ereignis",
"Gäst",
"Hyper-V",
"IIS_",
"Klonbare",
"Konten-Oper",
"Kryptografie",
"Leistungs",
"Netzwerkskon",
"PrivUser",
"Protected User",
"Prä-Windows",
"RAS- und IAS-Server",
"RDS-",
"Remoteverwaltungs",
"Replikations",
"Reporting",
"Richtlinien-Ersteller",
"SQLAccess",
"Schreibgeschützte Domänen",
"Schlüsseladministratoren",
"Server-Operatore",
"Sicherungs",
"Storage",
"System Managed",
"Terminalserver-Liz",
"WinRMR",
"Windows-Auth",
"Unternehme",
"Zertifikat",
"Zugriffssteuerungs",
"Zulässige"
}
Public Class GroupResult
Public SAMAccountName As String
Public ObjectClass As String
Public CN As String
Public Description As String
Public DistinguishedName As String
Public Name As String
Public ObjectCategory As String
Public Overrides Function ToString() As String
Return $"SAMAccountName={SAMAccountName}, ObjectClass={ObjectClass}, CN={CN}, Description={Description}, DistinguishedName={DistinguishedName}, Name={Name}, ObjectCategory={ObjectCategory}"
End Function
End Class
Public Shared Function ConnectionTest(path As String)
Try
Dim de As New DirectoryEntry(path)
de.Username = Nothing
de.Password = Nothing
de.AuthenticationType = AuthenticationTypes.Secure
de.RefreshCache()
Return True
Catch ex As Exception
MsgBox($"Verbindungstest fehlgeschlagen. Bitte überprüfen sie den ActiveDirectory Pfad. Der zurückgelieferte Fehler lautet:{vbCrLf}{ex.Message}", MsgBoxStyle.Exclamation)
logger.Error(ex, $"Connection Test failed for path '{path}'")
Return False
End Try
End Function
Private Shared Function GetDirectoryEntry()
Dim de As New DirectoryEntry(ActiveDirectoryRootNode)
de.Username = Nothing
de.Password = Nothing
de.AuthenticationType = AuthenticationTypes.Secure
Return de
End Function
Public Shared Function GetDirectorySearch(rootNode As DirectoryEntry) As DirectorySearcher
Dim dirEntry As DirectoryEntry = GetDirectoryEntry()
Dim dirSearcher As DirectorySearcher = New DirectorySearcher(dirEntry)
Return dirSearcher
End Function
Public Shared Function GetActiveDirectoryGroups(Optional query As String = "(&(objectClass=group) (samAccountName=*))") As List(Of GroupResult)
Dim groups As New List(Of GroupResult)
Dim deSearch = GetDirectorySearch(GetDirectoryEntry())
deSearch.SearchScope = SearchScope.Subtree
deSearch.Filter = query
deSearch.SizeLimit = 50000
Dim results As SearchResultCollection = deSearch.FindAll()
For Each r As SearchResult In results
Try
Dim groupName, objectClass, cn, description, distinguishedName, name, objectCategory As String
Try
groupName = r.Properties.Item("samaccountname").Item(0)
Catch ex As Exception
logger.Error(ex)
groupName = ""
End Try
Try
objectClass = r.Properties.Item("objectClass").Item(0)
Catch ex As Exception
logger.Error(ex)
objectClass = ""
End Try
Try
cn = r.Properties.Item("cn").Item(0)
Catch ex As Exception
logger.Error(ex)
cn = ""
End Try
Try
description = r.Properties.Item("description").Item(0)
Catch ex As Exception
logger.Error(ex)
description = ""
End Try
Try
distinguishedName = r.Properties.Item("distinguishedName").Item(0)
Catch ex As Exception
logger.Error(ex)
distinguishedName = ""
End Try
Try
name = r.Properties.Item("name").Item(0)
Catch ex As Exception
logger.Error(ex)
name = ""
End Try
Try
objectCategory = r.Properties.Item("objectCategory").Item(0)
Catch ex As Exception
logger.Error(ex)
objectCategory = ""
End Try
'If Not String.IsNullOrEmpty(groupName) Then
' Dim isExcluded = excludedGroupNames.Where(Function(excludedGroup)
' Return (groupName.Contains(excludedGroup) Or groupName.StartsWith(excludedGroup))
' End Function).Any()
' If Not isExcluded Then
' groups.Add(New GroupResult() With {
' .SAMAccountName = groupName,
' .CN = cn,
' .Description = description,
' .DistinguishedName = distinguishedName,
' .Name = name,
' .ObjectCategory = objectCategory,
' .ObjectClass = objectClass
' })
' End If
'End If
logger.Info("Adding Group '{0}'", groupName)
'If Not String.IsNullOrEmpty(groupName) Then
groups.Add(New GroupResult() With {
.SAMAccountName = groupName,
.CN = cn,
.Description = description,
.DistinguishedName = distinguishedName,
.Name = name,
.ObjectCategory = objectCategory,
.ObjectClass = objectClass
})
'End If
Catch ex As Exception
logger.Error(ex)
Continue For
End Try
Next
Return groups
End Function
Public Shared Function GetActiveDirectoryUsersForGroup(groupName As String) As List(Of ADUser)
'Dim users As New List(Of UserPrincipal)
Dim users As New List(Of ADUser)
Using context As New PrincipalContext(ContextType.Domain)
Using group As GroupPrincipal = GroupPrincipal.FindByIdentity(context, IdentityType.Name, groupName)
Using members = group.GetMembers(True)
For Each member As UserPrincipal In members
If TypeOf member Is UserPrincipal Then
'users.Add(member)
users.Add(New ADUser() With {
.Username = member.SamAccountName,
.Surname = member.Surname,
.GivenName = member.GivenName,
.MiddleName = member.MiddleName,
.Email = member.EmailAddress
})
End If
Next
End Using
End Using
End Using
Return users
End Function
Public Class ADUser
Public Username As String
Public Surname As String
Public GivenName As String
Public MiddleName As String
Public Email As String
Public Path As String
End Class
End Class

View File

@@ -1,67 +1,72 @@
Imports DD_LIB_Standards
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Public Class ClassData
Public Sub New()
Private _logger As Logger
Private _database As MSSQLServer
Public Sub New(LogConfig As LogConfig, Database As MSSQLServer)
_logger = LogConfig.GetLogger()
_database = Database
End Sub
Private Shared Function IntToBool(int As Integer) As Boolean
Private Function IntToBool(int As Integer) As Boolean
Return int >= 1
End Function
Private Shared Function BoolToInt(bool As Boolean) As Integer
Private Function BoolToInt(bool As Boolean) As Integer
Return IIf(bool, 1, 0)
End Function
Public Shared Function GroupExists(groupName As String) As Boolean
Public Function GroupExists(groupName As String) As Boolean
Try
Dim sql As String = $"SELECT COUNT(GUID) FROM TBDD_GROUPS WHERE NAME = '{groupName}'"
Dim result = clsDatabase.Execute_Scalar(sql)
Dim result = _database.GetScalarValue(sql)
Return IntToBool(result)
Catch ex As Exception
clsLogger.Add($"Error in GroupExists: {ex.Message}")
_logger.Error($"Error in GroupExists: {ex.Message}")
Return Nothing
End Try
End Function
Public Shared Function UserExists(userName As String) As Boolean
Public Function UserExists(userName As String) As Boolean
Try
Dim sql As String = $"SELECT COUNT(GUID) FROM TBDD_USER WHERE USERNAME = '{userName}'"
Dim result = clsDatabase.Execute_Scalar(sql)
Dim result = _database.GetScalarValue(sql)
Return IntToBool(result)
Catch ex As Exception
clsLogger.Add($"Error in UserExists: {ex.Message}")
_logger.Error($"Error in UserExists: {ex.Message}")
Return Nothing
End Try
End Function
Public Shared Function InsertUser(username As String, prename As String, name As String, email As String)
Public Function InsertUser(username As String, prename As String, name As String, email As String)
Try
Dim addedWho As String = Environment.UserName
Dim sql As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL, ADDED_WHO)
VALUES ('{prename}','{name}','{username}','{email}','{addedWho}')"
Dim result = clsDatabase.Execute_non_Query(sql)
Dim result = _database.ExecuteNonQuery(sql)
Return True
Catch ex As Exception
clsLogger.Add($"Error in InsertUser: {ex.Message}")
_logger.Error(ex)
Return False
End Try
End Function
Public Shared Function InsertGroup(name As String, Optional ECM_FK_ID As Integer = 1, Optional adSync As Boolean = True, Optional internal As Boolean = False, Optional active As Boolean = True)
Public Function InsertGroup(name As String, Optional ECM_FK_ID As Integer = 1, Optional adSync As Boolean = True, Optional internal As Boolean = False, Optional active As Boolean = True)
Try
Dim addedWho As String = Environment.UserName
Dim sql As String = $"INSERT INTO TBDD_GROUPS (NAME, ADDED_WHO, ECM_FK_ID, AD_SYNC, INTERNAL, ACTIVE)
VALUES ('{name}', '{addedWho}', {ECM_FK_ID}, {BoolToInt(adSync)}, {BoolToInt(internal)}, {BoolToInt(active)} )"
Dim result = clsDatabase.Execute_non_Query(sql)
Dim result = _database.ExecuteNonQuery(sql)
Return True
Catch ex As Exception
clsLogger.Add($"Error in InsertGroup: {ex.Message}")
_logger.Error(ex)
Return False
End Try
End Function

View File

@@ -11,7 +11,7 @@
<AssemblyName>DDUserManager</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -51,17 +51,30 @@
<ApplicationIcon>user.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DD_LIB_Standards">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\DD_LIB_Standards.dll</HintPath>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Sparkline.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Filesystem">
<HintPath>..\..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Interfaces">
<HintPath>..\..\..\DDMonorepo\Modules.Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="NLog">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\NLog\NLog.dll</HintPath>
</Reference>
@@ -96,7 +109,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="ClassActiveDirectory.vb" />
<Compile Include="ClassData.vb" />
<Compile Include="ClassDragDrop.vb" />
<Compile Include="ClassNLog.vb" />
@@ -105,10 +117,16 @@
<DesignTime>True</DesignTime>
<DependentUpon>DS_ChangeS.xsd</DependentUpon>
</Compile>
<Compile Include="frmADDebug.Designer.vb">
<DependentUpon>frmADDebug.vb</DependentUpon>
<Compile Include="frmADDebug_Groups.Designer.vb">
<DependentUpon>frmADDebug_Groups.vb</DependentUpon>
</Compile>
<Compile Include="frmADDebug.vb">
<Compile Include="frmADDebug_Groups.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmADDebug_Users.Designer.vb">
<DependentUpon>frmADDebug_Users.vb</DependentUpon>
</Compile>
<Compile Include="frmADDebug_Users.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConfigDatabase.Designer.vb">
@@ -152,6 +170,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="UserConfig.vb" />
<Compile Include="UserDataSet.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -162,8 +181,11 @@
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmADDebug.resx">
<DependentUpon>frmADDebug.vb</DependentUpon>
<EmbeddedResource Include="frmADDebug_Groups.resx">
<DependentUpon>frmADDebug_Groups.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmADDebug_Users.resx">
<DependentUpon>frmADDebug_Users.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmConfigDatabase.resx">
<DependentUpon>frmConfigDatabase.vb</DependentUpon>

View File

@@ -0,0 +1,297 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{87122913-C196-46BC-A7CD-27F7E201E55F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>DDUserManager.My.MyApplication</StartupObject>
<RootNamespace>DDUserManager</RootNamespace>
<AssemblyName>DDUserManager</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DDUserManager.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DDUserManager.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>user.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Filesystem">
<HintPath>..\..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Interfaces">
<HintPath>..\..\..\DDMonorepo\Modules.Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\NLog\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Deployment" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="ClassData.vb" />
<Compile Include="ClassDragDrop.vb" />
<Compile Include="ClassNLog.vb" />
<Compile Include="DS_ChangeS.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>DS_ChangeS.xsd</DependentUpon>
</Compile>
<Compile Include="frmADDebug_Groups.Designer.vb">
<DependentUpon>frmADDebug_Groups.vb</DependentUpon>
</Compile>
<Compile Include="frmADDebug_Groups.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmADDebug_Users.Designer.vb">
<DependentUpon>frmADDebug_Users.vb</DependentUpon>
</Compile>
<Compile Include="frmADDebug_Users.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConfigDatabase.Designer.vb">
<DependentUpon>frmConfigDatabase.vb</DependentUpon>
</Compile>
<Compile Include="frmConfigDatabase.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmADImport_Groups.Designer.vb">
<DependentUpon>frmADImport_Groups.vb</DependentUpon>
</Compile>
<Compile Include="frmADImport_Groups.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmADImport_Users.Designer.vb">
<DependentUpon>frmADImport_Users.vb</DependentUpon>
</Compile>
<Compile Include="frmADImport_Users.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.vb">
<DependentUpon>frmMain.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="ModuleRuntime.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="UserConfig.vb" />
<Compile Include="UserDataSet.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>UserDataSet.xsd</DependentUpon>
</Compile>
<Compile Include="UserDataSet.vb">
<DependentUpon>UserDataSet.xsd</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmADDebug_Groups.resx">
<DependentUpon>frmADDebug_Groups.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmADDebug_Users.resx">
<DependentUpon>frmADDebug_Users.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmConfigDatabase.resx">
<DependentUpon>frmConfigDatabase.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmADImport_Groups.resx">
<DependentUpon>frmADImport_Groups.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmADImport_Users.resx">
<DependentUpon>frmADImport_Users.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.vb</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="DS_ChangeS.xsc">
<DependentUpon>DS_ChangeS.xsd</DependentUpon>
</None>
<None Include="DS_ChangeS.xsd">
<SubType>Designer</SubType>
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>DS_ChangeS.Designer.vb</LastGenOutput>
</None>
<None Include="DS_ChangeS.xss">
<DependentUpon>DS_ChangeS.xsd</DependentUpon>
</None>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
<None Include="UserDataSet.xsc">
<DependentUpon>UserDataSet.xsd</DependentUpon>
</None>
<None Include="UserDataSet.xsd">
<SubType>Designer</SubType>
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>UserDataSet.Designer.vb</LastGenOutput>
</None>
<None Include="UserDataSet.xss">
<DependentUpon>UserDataSet.xsd</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Resources\user.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\group.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\book.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\user_add.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\plugin.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\user_go.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\key.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\group_go.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\arrow_right.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\arrow_left_red.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\disk.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\cog.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\arrow_refresh.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\database_connect.png" />
<None Include="Resources\folder.png" />
<None Include="Resources\help.png" />
<Content Include="user.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@@ -1,160 +1,17 @@
Imports System.IO
Imports DD_LIB_Standards
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Logging
Module ModuleRuntime
Public MyConnectionString As String
Public MyDatabase As MSSQLServer
Public MyLogConfig As LogConfig
Public MyLogger As Logger
Public MyConfig As ConfigManager(Of UserConfig)
Public LogErrorsOnly As Boolean = True
Public ConfigPath As String = Path.Combine(Application.UserAppDataPath, "UserConfig.xml")
Public ActiveDirectoryRootNode As String = $"LDAP://{Environment.UserDomainName}"
Public Function SaveMySettingsValue(name As String, value As String, type As String)
Try
Dim DT As DataTable = Nothing
If type = "ConfigMain" Then
DT = GetTablefromXML(ConfigPath)
End If
If Not IsNothing(DT) Then
For Each Row As DataRow In DT.Rows
If Row.Item("ConfigName") = name Then
Row.Item("Value") = value
End If
Next
DT.AcceptChanges()
DT.WriteXml(ConfigPath)
Else
MsgBox("Setting could not be saved! Check logfile.", MsgBoxStyle.Critical)
End If
Catch ex As Exception
MsgBox("Error in SaveConfigValue" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
Return True
End Function
Private Function GetTablefromXML(path As String) As DataTable
Try
Dim DS As New DataSet
DS.ReadXml(path)
Return DS.Tables(0)
Catch ex As Exception
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message & vbNewLine & "ConfigPath: " & vbNewLine & path, MsgBoxStyle.Critical)
clsLogger.Add("Error in GetTablefromXML: " & ex.Message, True)
clsLogger.Add(">> ConfigPath: " & ConfigPath, False)
Return Nothing
End Try
End Function
Public Function MySettings_Load()
Try
Dim DT As DataTable
'if file doesn't exist, create the file with its default xml table
If Not File.Exists(ConfigPath) Then
clsLogger.Add(">> ConfigFile was created in: " & ConfigPath, False)
DT = CreateConfigTable()
DT.WriteXml(ConfigPath)
clsLogger.Add(">> Defaultvalues were saved.", False)
End If
DT = GetTablefromXML(ConfigPath)
If DT Is Nothing Then
MsgBox("Configuration could not be loaded!! Check LogFile!", MsgBoxStyle.Critical)
Return False
End If
For Each Row As DataRow In DT.Rows
Select Case Row.Item("ConfigName")
Case "MyConnectionString"
Dim connstring As String
'Den ConnectonString mit verschlüsseltem PW laden
Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = Row.Item("Value")
If Not csb.ConnectionString = "" Then
If csb.ConnectionString.Contains("Password=") Then
'sa-
'Jetzt das Passwort entschlüsseln
Dim PWplainText As String
Dim wrapper As New clsEncryption("!35452didalog=")
' DecryptData throws if the wrong password is used.
Try
PWplainText = wrapper.DecryptData(csb.Password)
connstring = Row.Item("Value").ToString.Replace(csb.Password, PWplainText)
Catch ex As Exception
clsLogger.Add("- the Password '" & csb.Password & "' could not be decrypted", False)
connstring = ""
End Try
Else
'Windows-Auth
connstring = Row.Item("Value").ToString
End If
MyConnectionString = connstring
Else
MyConnectionString = ""
End If
Case "LogErrorsOnly"
LogErrorsOnly = CBool(Row.Item("Value"))
Case "ActiveDirectoryRootNode"
Dim rootNode As String = Row.Item("Value")
If rootNode <> String.Empty Then
ActiveDirectoryRootNode = rootNode
End If
End Select
Next
Catch ex As Exception
MsgBox("Error in LoadMyConfig" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
clsLogger.Add("Error in LoadMyConfig: " & ex.Message, True)
Return False
End Try
Return True
End Function
Private Function CreateConfigTable() As DataTable
Try
' Create sample Customers table, in order
' to demonstrate the behavior of the DataTableReader.
Dim table As New DataTable
table.TableName = "MyConfig"
' Create two columns, ID and Name.
Dim idColumn As DataColumn = table.Columns.Add("ID",
GetType(System.Int32))
idColumn.AutoIncrement = True
idColumn.AutoIncrementSeed = 0
idColumn.AutoIncrementStep = 1
table.Columns.Add("ConfigName", GetType(System.String))
table.Columns.Add("Value", GetType(System.String))
'Set the ID column as the primary key column.
table.PrimaryKey = New DataColumn() {idColumn}
Dim newRow As DataRow
newRow = table.NewRow()
newRow.Item("ConfigName") = "MyConnectionString"
newRow.Item("Value") = ""
table.Rows.Add(newRow)
newRow = table.NewRow()
newRow.Item("ConfigName") = "LogErrorsOnly"
newRow.Item("Value") = "True"
table.Rows.Add(newRow)
newRow = table.NewRow()
newRow.Item("ConfigName") = "ActiveDirectoryRootNode"
newRow.Item("Value") = ""
table.Rows.Add(newRow)
table.AcceptChanges()
clsLogger.Add(">> CreateConfigTable su...", False)
Return table
Catch ex As Exception
MsgBox("Error in CreateConfigTable" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
End Module

View File

@@ -1 +1 @@
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -0,0 +1 @@
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -0,0 +1,11 @@
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Interfaces
Public Class UserConfig
<ConfigAttributes.ConnectionString>
Public Property ConnectionString As String = ""
Public Property LogErrorsOnly As Boolean = True
Public Property AdGroupFilter As String = ActiveDirectoryInterface.DEFAULT_GROUP_FILTER
Public Property AdUserFilter As String = ActiveDirectoryInterface.DEFAULT_USER_FILTER
Public Property AdRootPath As String = $"LDAP://{Environment.UserDomainName}"
End Class

View File

@@ -1,17 +0,0 @@
Imports DDUserManager.ClassActiveDirectory
Public Class frmADDebug
Public Property DebugData As List(Of GroupResult)
Private Sub frmADDebug_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim table As New UserDataSet.TBLOCAL_DEBUG_GROUPSDataTable()
For Each group In DebugData
table.AddTBLOCAL_DEBUG_GROUPSRow(group.SAMAccountName, group.CN, group.ObjectClass, group.ObjectCategory, group.Description, group.DistinguishedName, group.Name)
Next
Me.Text = $"{table.Rows.Count} Gruppen"
GridControl1.DataSource = table
End Sub
End Class

View File

@@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmADDebug
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmADDebug_Groups
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@@ -20,7 +20,7 @@ Partial Class frmADDebug
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
@@ -34,8 +34,8 @@ Partial Class frmADDebug
Me.GridControl1.Location = New System.Drawing.Point(0, 0)
Me.GridControl1.MainView = Me.GridView1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.Size = New System.Drawing.Size(800, 450)
Me.GridControl1.TabIndex = 1
Me.GridControl1.Size = New System.Drawing.Size(284, 261)
Me.GridControl1.TabIndex = 0
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
'GridView1
@@ -43,14 +43,11 @@ Partial Class frmADDebug
Me.GridView1.GridControl = Me.GridControl1
Me.GridView1.Name = "GridView1"
'
'frmADDebug
'frmADDebug_Groups
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.Controls.Add(Me.GridControl1)
Me.Name = "frmADDebug"
Me.Text = "frmADDebug"
Me.Name = "frmADDebug_Groups"
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

View File

@@ -0,0 +1,18 @@
Imports DigitalData.Modules.Interfaces
Public Class frmADDebug_Groups
Public Property DebugData As List(Of ADGroup)
Private Sub frmADDebug_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim table As New UserDataSet.TBLOCAL_DEBUG_GROUPSDataTable()
For Each oGroup In DebugData
table.AddTBLOCAL_DEBUG_GROUPSRow(oGroup.SAMAccountName, oGroup.CN, oGroup.ObjectClass, oGroup.ObjectCategory, oGroup.Description, oGroup.DistinguishedName, oGroup.Name)
Next
Text = $"{table.Rows.Count} Gruppen"
TopMost = True
GridControl1.DataSource = table
End Sub
End Class

View File

@@ -0,0 +1,59 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmADDebug_Users
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GridControl1
'
Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridControl1.Location = New System.Drawing.Point(0, 0)
Me.GridControl1.MainView = Me.GridView1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.Size = New System.Drawing.Size(284, 261)
Me.GridControl1.TabIndex = 0
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
'GridView1
'
Me.GridView1.GridControl = Me.GridControl1
Me.GridView1.Name = "GridView1"
'
'frmADDebug_Users
'
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.Controls.Add(Me.GridControl1)
Me.Name = "frmADDebug_Users"
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
End Class

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,18 @@
Imports DigitalData.Modules.Interfaces
Public Class frmADDebug_Users
Public Property DebugData As List(Of ADUser)
Private Sub frmADDebug_Users_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim table As New UserDataSet.TBLOCAL_ADUSERSDataTable()
For Each oUser In DebugData
table.AddTBLOCAL_ADUSERSRow(oUser.samAccountName, oUser.GivenName, oUser.Surname, oUser.Email)
Next
Text = $"{table.Rows.Count} Benutzer"
TopMost = True
GridControl1.DataSource = table
End Sub
End Class

View File

@@ -1,18 +1,26 @@
Imports DevExpress.XtraGrid.Views.Grid
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Interfaces
Public Class frmADImport_Groups
Private Shared logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()
Private logger As Logger
Private data As ClassData
Private activeDirectory As ActiveDirectoryInterface
Private Sub frmADImport_Groups_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim groups = ClassActiveDirectory.GetActiveDirectoryGroups(My.Settings.AD_GROUP_QUERY)
logger = MyLogConfig.GetLogger()
data = New ClassData(MyLogConfig, MyDatabase)
activeDirectory = New ActiveDirectoryInterface(MyLogConfig, MyConfig.Config.AdRootPath)
logger.Info("Found {0} groups", groups.Count)
Dim oGroups = activeDirectory.ListGroups(MyConfig.Config.AdGroupFilter)
logger.Info("Found {0} groups", oGroups.Count)
UserDataSet.TBLOCAL_ADGROUPS.Clear()
For Each group As ClassActiveDirectory.GroupResult In groups
UserDataSet.TBLOCAL_ADGROUPS.AddTBLOCAL_ADGROUPSRow(group.SAMAccountName)
For Each oGroup As ADGroup In oGroups
UserDataSet.TBLOCAL_ADGROUPS.AddTBLOCAL_ADGROUPSRow(oGroup.SAMAccountName)
Next
lbGroupsCount.Text = String.Format(lbGroupsCount.Text, UserDataSet.TBLOCAL_ADGROUPS.Rows.Count)
@@ -36,8 +44,8 @@ Public Class frmADImport_Groups
Dim internal As Boolean = False
Dim sync As Boolean = True
If Not ClassData.GroupExists(groupRow.GROUPNAME) Then
ClassData.InsertGroup(groupRow.GROUPNAME)
If Not data.GroupExists(groupRow.GROUPNAME) Then
data.InsertGroup(groupRow.GROUPNAME)
importedGroups = importedGroups + 1
End If
Next

View File

@@ -1,20 +1,24 @@
Imports System.DirectoryServices
Imports System.DirectoryServices.AccountManagement
Imports DDUserManager.UserDataSet
Imports DDUserManager.UserDataSet
Imports DevExpress.XtraGrid.Views.Grid
Imports DD_LIB_Standards
Imports DigitalData.Modules.Interfaces
Imports DigitalData.Modules.Logging
Public Class frmADImport_Users
Private Shared logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()
Private logger As Logger
Private data As ClassData
Private activeDirectory As ActiveDirectoryInterface
Private Sub frmADImport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim groups = ClassActiveDirectory.GetActiveDirectoryGroups(My.Settings.AD_GROUP_QUERY)
logger = MyLogConfig.GetLogger()
data = New ClassData(MyLogConfig, MyDatabase)
activeDirectory = New ActiveDirectoryInterface(MyLogConfig, MyConfig.Config.AdRootPath)
gridAD_Groups.DataSource = groups.Select(Of String)(Function(g)
Return g.SAMAccountName
End Function)
Dim oGroups = activeDirectory.ListGroups(MyConfig.Config.AdGroupFilter)
gridAD_Groups.DataSource = oGroups.Select(Function(g) g.SAMAccountName)
viewAD_Groups.Columns.Item(0).Caption = "Gruppe"
Catch ex As Exception
logger.Error(ex, $"Error while loading initial groups")
@@ -26,16 +30,16 @@ Public Class frmADImport_Users
Dim groupName As String = viewAD_Groups.GetRow(e.FocusedRowHandle)
Try
Dim usersForGroup As List(Of ClassActiveDirectory.ADUser) = ClassActiveDirectory.GetActiveDirectoryUsersForGroup(groupName)
Dim oUsers = activeDirectory.ListUsers(groupName, MyConfig.Config.AdUserFilter)
UserDataSet.TBLOCAL_ADUSERS.Clear()
For Each user As ClassActiveDirectory.ADUser In usersForGroup
For Each user As ADUser In oUsers
Dim row As TBLOCAL_ADUSERSRow = UserDataSet.TBLOCAL_ADUSERS.NewTBLOCAL_ADUSERSRow()
row.NAME = user.Surname
row.PRENAME = user.GivenName
row.USERNAME = user.Username
row.USERNAME = user.samAccountName
row.EMAIL = user.Email
UserDataSet.TBLOCAL_ADUSERS.AddTBLOCAL_ADUSERSRow(row)
@@ -63,8 +67,8 @@ Public Class frmADImport_Users
Dim Email As String = IIf(IsDBNull(userRow.EMAIL), Nothing, userRow.EMAIL)
If Not ClassData.UserExists(Username) Then
If ClassData.InsertUser(Username, Prename, Name, Email) Then
If Not data.UserExists(Username) Then
If data.InsertUser(Username, Prename, Name, Email) Then
importedUsers = importedUsers + 1
Else
Throw New Exception($"Could not insert user {Username} into Database. Check the log.")

View File

@@ -1,11 +1,16 @@
Imports System.IO
Imports DD_LIB_Standards
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Logging
Public Class frmConfigDatabase
Private ConnectionChanged As Boolean = False
Private Sub frmConfigDatabase_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If MyLogConfig Is Nothing Then
MyLogConfig = New LogConfig(LogConfig.PathType.AppData)
End If
If Not MyConnectionString = String.Empty Then
ConnectionChanged = False
@@ -95,17 +100,21 @@ Public Class frmConfigDatabase
ConnectionChanged = True
'Set the construction string
MyConnectionString = con
clsDatabase.Init(MyConnectionString)
MyDatabase = New MSSQLServer(MyLogConfig, MyConnectionString)
My.Settings.Save()
If chkbxUserAut.Checked = False Then
Dim wrapper As New clsEncryption("!35452didalog=")
Dim wrapper As New EncryptionLegacy("!35452didalog=")
Dim cipherText As String = wrapper.EncryptData(Me.txtPasswort.Text)
Dim pw As String = cipherText
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & pw & ";"
End If
SaveMySettingsValue("MyConnectionString", con, "ConfigMain")
MyConfig.Config.ConnectionString = con
MyConfig.Save()
Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = MyConnectionString

View File

@@ -22,7 +22,6 @@ Partial Class frmMain
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim GUIDLabel As System.Windows.Forms.Label
Dim PRENAMELabel As System.Windows.Forms.Label
Dim NAMELabel As System.Windows.Forms.Label
@@ -63,7 +62,7 @@ Partial Class frmMain
Me.Label8 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.LANGUAGEComboBox = New System.Windows.Forms.ComboBox()
Me.TBDD_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_USERBindingSource = New System.Windows.Forms.BindingSource()
Me.UserDataSet = New DDUserManager.UserDataSet()
Me.DATE_FORMATComboBox = New System.Windows.Forms.ComboBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
@@ -80,12 +79,12 @@ Partial Class frmMain
Me.Label12 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.listModules = New System.Windows.Forms.ListBox()
Me.TBDD_MODULESBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_MODULESBindingSource = New System.Windows.Forms.BindingSource()
Me.listGroups = New System.Windows.Forms.ListBox()
Me.TBDD_GROUPSBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_GROUPSBindingSource = New System.Windows.Forms.BindingSource()
Me.Label2 = New System.Windows.Forms.Label()
Me.listClients = New System.Windows.Forms.ListBox()
Me.TBDD_CLIENTBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_CLIENTBindingSource = New System.Windows.Forms.BindingSource()
Me.GridUsers = New DevExpress.XtraGrid.GridControl()
Me.gvUsers = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colPRENAME = New DevExpress.XtraGrid.Columns.GridColumn()
@@ -117,7 +116,7 @@ Partial Class frmMain
Me.labelGroups_AssignedUsers = New System.Windows.Forms.Label()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.gridGroups_AllGroups = New DevExpress.XtraGrid.GridControl()
Me.TBDD_GROUPSBindingSource1 = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_GROUPSBindingSource1 = New System.Windows.Forms.BindingSource()
Me.DS_ChangeS = New DDUserManager.DS_ChangeS()
Me.viewGroups_AllGroups = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colNAME2 = New DevExpress.XtraGrid.Columns.GridColumn()
@@ -178,7 +177,7 @@ Partial Class frmMain
Me.GridColumn11 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.GridColumn12 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.Label9 = New System.Windows.Forms.Label()
Me.TBDD_USERBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.TBDD_USERBindingNavigator = New System.Windows.Forms.BindingNavigator()
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
@@ -257,7 +256,7 @@ Partial Class frmMain
Me.colNAME10 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colSHORT_NAME = New DevExpress.XtraGrid.Columns.GridColumn()
Me.Label16 = New System.Windows.Forms.Label()
Me.TBDD_GROUPSBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.TBDD_GROUPSBindingNavigator = New System.Windows.Forms.BindingNavigator()
Me.BindingNavigatorCountItem1 = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorDeleteItem1 = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMoveFirstItem1 = New System.Windows.Forms.ToolStripButton()
@@ -288,7 +287,7 @@ Partial Class frmMain
Me.GridColumn1 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.GridColumn7 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.GridColumn6 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.TBDD_CLIENTBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.TBDD_CLIENTBindingNavigator = New System.Windows.Forms.BindingNavigator()
Me.BindingNavigatorAddNewItem2 = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorCountItem2 = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorDeleteItem2 = New System.Windows.Forms.ToolStripButton()
@@ -313,7 +312,7 @@ Partial Class frmMain
Me.GridColumn8 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.GridColumn9 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.GridColumn10 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.TBDD_MODULESBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.TBDD_MODULESBindingNavigator = New System.Windows.Forms.BindingNavigator()
Me.BindingNavigatorCountItem3 = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorMoveFirstItem3 = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMovePreviousItem3 = New System.Windows.Forms.ToolStripButton()
@@ -326,7 +325,12 @@ Partial Class frmMain
Me.tabPageRights = New DevExpress.XtraTab.XtraTabPage()
Me.tabPageSettings = New DevExpress.XtraTab.XtraTabPage()
Me.Button2 = New System.Windows.Forms.Button()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.Label20 = New System.Windows.Forms.Label()
Me.Button4 = New System.Windows.Forms.Button()
Me.txtLDAPUserQuery = New System.Windows.Forms.TextBox()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.btnDebugGroupQuery = New System.Windows.Forms.Button()
Me.txtLDAPGroupQuery = New System.Windows.Forms.TextBox()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
@@ -336,14 +340,14 @@ Partial Class frmMain
Me.btnOpenLogDir = New System.Windows.Forms.Button()
Me.btnOpenConfigDir = New System.Windows.Forms.Button()
Me.btnConfigConnections = New System.Windows.Forms.Button()
Me.TBDD_GROUPS_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_GROUPS_USERBindingSource = New System.Windows.Forms.BindingSource()
Me.TBDD_USERTableAdapter = New DDUserManager.UserDataSetTableAdapters.TBDD_USERTableAdapter()
Me.TableAdapterManager = New DDUserManager.UserDataSetTableAdapters.TableAdapterManager()
Me.TBDD_CLIENT_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_CLIENT_USERBindingSource = New System.Windows.Forms.BindingSource()
Me.TBDD_CLIENT_USERTableAdapter = New DDUserManager.UserDataSetTableAdapters.TBDD_CLIENT_USERTableAdapter()
Me.TBDD_CLIENTTableAdapter = New DDUserManager.UserDataSetTableAdapters.TBDD_CLIENTTableAdapter()
Me.TBDD_MODULESTableAdapter = New DDUserManager.UserDataSetTableAdapters.TBDD_MODULESTableAdapter()
Me.TBDD_USER_MODULESBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_USER_MODULESBindingSource = New System.Windows.Forms.BindingSource()
Me.TBDD_USER_MODULESTableAdapter = New DDUserManager.UserDataSetTableAdapters.TBDD_USER_MODULESTableAdapter()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tsLabelUser = New System.Windows.Forms.ToolStripStatusLabel()
@@ -511,6 +515,7 @@ Partial Class frmMain
CType(Me.TBDD_MODULESBindingNavigator, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TBDD_MODULESBindingNavigator.SuspendLayout()
Me.tabPageSettings.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
CType(Me.TBDD_GROUPS_USERBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -827,7 +832,7 @@ Partial Class frmMain
Me.tabPageUsers.AutoScroll = True
Me.tabPageUsers.Controls.Add(Me.SplitContainer1)
Me.tabPageUsers.Controls.Add(Me.TBDD_USERBindingNavigator)
Me.tabPageUsers.Image = Global.DDUserManager.My.Resources.Resources.user
Me.tabPageUsers.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.user
Me.tabPageUsers.Name = "tabPageUsers"
Me.tabPageUsers.Size = New System.Drawing.Size(1193, 784)
Me.tabPageUsers.Text = "Benutzer"
@@ -1193,7 +1198,7 @@ Partial Class frmMain
'tabGroupAssign
'
Me.tabGroupAssign.Controls.Add(Me.SplitContainerUserGroups1)
Me.tabGroupAssign.Image = Global.DDUserManager.My.Resources.Resources.group
Me.tabGroupAssign.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.group
Me.tabGroupAssign.Name = "tabGroupAssign"
Me.tabGroupAssign.Size = New System.Drawing.Size(1187, 349)
Me.tabGroupAssign.Text = "Gruppen Zuordnung"
@@ -1492,7 +1497,7 @@ Partial Class frmMain
'tabClientAssign
'
Me.tabClientAssign.Controls.Add(Me.SplitContainer4)
Me.tabClientAssign.Image = Global.DDUserManager.My.Resources.Resources.book
Me.tabClientAssign.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.book
Me.tabClientAssign.Name = "tabClientAssign"
Me.tabClientAssign.Size = New System.Drawing.Size(1187, 349)
Me.tabClientAssign.Text = "Mandanten Zuordnung"
@@ -1773,7 +1778,7 @@ Partial Class frmMain
'tabModuleAssign
'
Me.tabModuleAssign.Controls.Add(Me.SplitContainer6)
Me.tabModuleAssign.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.tabModuleAssign.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.tabModuleAssign.Name = "tabModuleAssign"
Me.tabModuleAssign.Size = New System.Drawing.Size(1187, 349)
Me.tabModuleAssign.Text = "Modul Zuordnung"
@@ -2188,7 +2193,7 @@ Partial Class frmMain
'
Me.tabPageGroups.Controls.Add(Me.SplitContainer3)
Me.tabPageGroups.Controls.Add(Me.TBDD_GROUPSBindingNavigator)
Me.tabPageGroups.Image = Global.DDUserManager.My.Resources.Resources.group
Me.tabPageGroups.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.group
Me.tabPageGroups.Name = "tabPageGroups"
Me.tabPageGroups.Size = New System.Drawing.Size(1193, 784)
Me.tabPageGroups.Text = "Gruppen"
@@ -2405,7 +2410,7 @@ Partial Class frmMain
'XtraTabPage1
'
Me.XtraTabPage1.Controls.Add(Me.SplitContainer5)
Me.XtraTabPage1.Image = Global.DDUserManager.My.Resources.Resources.book
Me.XtraTabPage1.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.book
Me.XtraTabPage1.Name = "XtraTabPage1"
Me.XtraTabPage1.Size = New System.Drawing.Size(1190, 349)
Me.XtraTabPage1.Text = "Mandanten Zuordnung"
@@ -2644,7 +2649,7 @@ Partial Class frmMain
'XtraTabPage2
'
Me.XtraTabPage2.Controls.Add(Me.SplitContainer7)
Me.XtraTabPage2.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.XtraTabPage2.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.XtraTabPage2.Name = "XtraTabPage2"
Me.XtraTabPage2.Size = New System.Drawing.Size(1190, 349)
Me.XtraTabPage2.Text = "Modul Zuordnung"
@@ -3006,7 +3011,7 @@ Partial Class frmMain
Me.tabPageClients.Controls.Add(Me.Panel17)
Me.tabPageClients.Controls.Add(Me.gridClients)
Me.tabPageClients.Controls.Add(Me.TBDD_CLIENTBindingNavigator)
Me.tabPageClients.Image = Global.DDUserManager.My.Resources.Resources.book
Me.tabPageClients.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.book
Me.tabPageClients.Name = "tabPageClients"
Me.tabPageClients.Size = New System.Drawing.Size(1193, 784)
Me.tabPageClients.Text = "Mandanten"
@@ -3289,7 +3294,7 @@ Partial Class frmMain
Me.tabPageModules.Controls.Add(Me.Panel18)
Me.tabPageModules.Controls.Add(Me.gridModules)
Me.tabPageModules.Controls.Add(Me.TBDD_MODULESBindingNavigator)
Me.tabPageModules.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.tabPageModules.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.plugin
Me.tabPageModules.Name = "tabPageModules"
Me.tabPageModules.Size = New System.Drawing.Size(1193, 784)
Me.tabPageModules.Text = "Module"
@@ -3491,7 +3496,7 @@ Partial Class frmMain
'
'tabPageRights
'
Me.tabPageRights.Image = Global.DDUserManager.My.Resources.Resources.key
Me.tabPageRights.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.key
Me.tabPageRights.Name = "tabPageRights"
Me.tabPageRights.PageEnabled = False
Me.tabPageRights.Size = New System.Drawing.Size(1193, 784)
@@ -3500,12 +3505,13 @@ Partial Class frmMain
'tabPageSettings
'
Me.tabPageSettings.Controls.Add(Me.Button2)
Me.tabPageSettings.Controls.Add(Me.GroupBox3)
Me.tabPageSettings.Controls.Add(Me.GroupBox2)
Me.tabPageSettings.Controls.Add(Me.GroupBox1)
Me.tabPageSettings.Controls.Add(Me.btnOpenLogDir)
Me.tabPageSettings.Controls.Add(Me.btnOpenConfigDir)
Me.tabPageSettings.Controls.Add(Me.btnConfigConnections)
Me.tabPageSettings.Image = Global.DDUserManager.My.Resources.Resources.cog
Me.tabPageSettings.ImageOptions.Image = Global.DDUserManager.My.Resources.Resources.cog
Me.tabPageSettings.Name = "tabPageSettings"
Me.tabPageSettings.Size = New System.Drawing.Size(1193, 784)
Me.tabPageSettings.Text = "Einstellungen"
@@ -3521,8 +3527,49 @@ Partial Class frmMain
Me.Button2.Text = "Support Tool aufrufen"
Me.Button2.UseVisualStyleBackColor = True
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.Label20)
Me.GroupBox3.Controls.Add(Me.Button4)
Me.GroupBox3.Controls.Add(Me.txtLDAPUserQuery)
Me.GroupBox3.Location = New System.Drawing.Point(486, 239)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(700, 200)
Me.GroupBox3.TabIndex = 5
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "LDAP Filter für Benutzerabfrage"
'
'Label20
'
Me.Label20.AutoSize = True
Me.Label20.Location = New System.Drawing.Point(6, 176)
Me.Label20.Name = "Label20"
Me.Label20.Size = New System.Drawing.Size(381, 13)
Me.Label20.TabIndex = 8
Me.Label20.Text = "Benutzen Sie @SAMACCOUNTNAME als Platzhalter für den Aktuellen Benutzer"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(582, 171)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(112, 23)
Me.Button4.TabIndex = 7
Me.Button4.Text = "Speichern"
Me.Button4.UseVisualStyleBackColor = True
'
'txtLDAPUserQuery
'
Me.txtLDAPUserQuery.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtLDAPUserQuery.Location = New System.Drawing.Point(6, 20)
Me.txtLDAPUserQuery.Multiline = True
Me.txtLDAPUserQuery.Name = "txtLDAPUserQuery"
Me.txtLDAPUserQuery.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtLDAPUserQuery.Size = New System.Drawing.Size(688, 145)
Me.txtLDAPUserQuery.TabIndex = 2
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.Button3)
Me.GroupBox2.Controls.Add(Me.btnDebugGroupQuery)
Me.GroupBox2.Controls.Add(Me.txtLDAPGroupQuery)
Me.GroupBox2.Location = New System.Drawing.Point(486, 17)
@@ -3530,7 +3577,16 @@ Partial Class frmMain
Me.GroupBox2.Size = New System.Drawing.Size(700, 200)
Me.GroupBox2.TabIndex = 5
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "LDAP Gruppenabfrage"
Me.GroupBox2.Text = "LDAP Filter für Gruppenabfrage"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(438, 171)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(112, 23)
Me.Button3.TabIndex = 7
Me.Button3.Text = "Speichern"
Me.Button3.UseVisualStyleBackColor = True
'
'btnDebugGroupQuery
'
@@ -3543,13 +3599,13 @@ Partial Class frmMain
'
'txtLDAPGroupQuery
'
Me.txtLDAPGroupQuery.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtLDAPGroupQuery.Location = New System.Drawing.Point(6, 20)
Me.txtLDAPGroupQuery.Multiline = True
Me.txtLDAPGroupQuery.Name = "txtLDAPGroupQuery"
Me.txtLDAPGroupQuery.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtLDAPGroupQuery.Size = New System.Drawing.Size(688, 145)
Me.txtLDAPGroupQuery.TabIndex = 2
Me.txtLDAPGroupQuery.Text = "(&(objectClass=group) (samAccountName=*))"
'
'GroupBox1
'
@@ -3875,6 +3931,8 @@ Partial Class frmMain
Me.TBDD_MODULESBindingNavigator.ResumeLayout(False)
Me.TBDD_MODULESBindingNavigator.PerformLayout()
Me.tabPageSettings.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox3.PerformLayout()
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
@@ -4189,4 +4247,9 @@ Partial Class frmMain
Friend WithEvents btnDebugGroupQuery As Button
Friend WithEvents txtLDAPGroupQuery As TextBox
Friend WithEvents QueriesTableAdapter1 As UserDataSetTableAdapters.QueriesTableAdapter
Friend WithEvents Button3 As Button
Friend WithEvents GroupBox3 As GroupBox
Friend WithEvents Button4 As Button
Friend WithEvents txtLDAPUserQuery As TextBox
Friend WithEvents Label20 As Label
End Class

View File

@@ -1,9 +1,11 @@
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DDUserManager.UserDataSet
Imports DDUserManager.DS_ChangeS
Imports DD_LIB_Standards
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Config
Imports System.Reflection
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Interfaces
''' <summary>
''' Anmerkungen:
@@ -19,32 +21,32 @@ Public Class frmMain
Private DragDropManager As ClassDragDrop = Nothing
Private Shared logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
NLog.LogManager.Configuration = ClassNLog.GetLoggerConfigFor(MODULE_NAME)
MyLogConfig = New LogConfig(LogConfig.PathType.AppData)
MyLogger = MyLogConfig.GetLogger()
MyConfig = New ConfigManager(Of UserConfig)(MyLogConfig, Application.UserAppDataPath)
LoadConfig(MyConfig)
CurrentVersion = Assembly.GetEntryAssembly().GetName().Version.ToString()
txtLDAPGroupQuery.DataBindings.Add(New Binding("Text", My.Settings, "AD_GROUP_QUERY"))
MyLogger.Info("Starting UserManager v" & CurrentVersion)
MyLogger.Info($"Current Username: {Environment.UserName}")
logger.Info("Starting UserManager v" & CurrentVersion)
logger.Info($"Current Username: {Environment.UserName}")
If InitDatabase() = False Then
MsgBox($"Unexpected error in Database Init(1). {vbCrLf & vbCrLf}Please contact Your admin.", MsgBoxStyle.Critical, "UserManager")
logger.Fatal($"Unexpected error in Database Init(1). {vbCrLf & vbCrLf}Please contact Your admin.")
Application.Exit()
Exit Sub
End If
If MyConnectionString = "" Then
MsgBox($"Unexpected error in Database Init(2). {vbCrLf & vbCrLf}Please contact Your admin.", MsgBoxStyle.Critical, "UserManager")
logger.Fatal($"Unexpected error in Database Init(2). {vbCrLf & vbCrLf}Please contact Your admin.")
frmConfigDatabase.ShowDialog()
'MsgBox($"Unexpected error in Database Init(2). {vbCrLf & vbCrLf}Please contact Your admin.", MsgBoxStyle.Critical, "UserManager")
'MyLogger.Error($"Unexpected error in Database Init(2). {vbCrLf & vbCrLf}Please contact Your admin.")
Application.Exit()
Exit Sub
End If
MyDatabase = New DigitalData.Modules.Database.MSSQLServer(MyLogConfig, MyConnectionString)
TBDD_CLIENTTableAdapter.Connection.ConnectionString = MyConnectionString
TBDD_CLIENT_USERTableAdapter.Connection.ConnectionString = MyConnectionString
TBDD_GROUPSTableAdapter.Connection.ConnectionString = MyConnectionString
@@ -56,11 +58,11 @@ Public Class frmMain
TBDD_USER_MODULESTableAdapter.Connection.ConnectionString = MyConnectionString
Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','UM',{1})", Environment.UserName, 1)
Dim DT_CHECKUSER_MODULE As DataTable = clsDatabase.Return_Datatable(sql)
Dim DT_CHECKUSER_MODULE As DataTable = MyDatabase.GetDatatable(sql)
If DT_CHECKUSER_MODULE.Rows.Count = 0 Then
MsgBox($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt. {vbCrLf & vbCrLf}Bitte kontaktieren Sie den Administrator, wenn dies ein Fehler ist.", MsgBoxStyle.Critical, "UserManager")
logger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
MyLogger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
Application.ExitThread()
End If
@@ -69,7 +71,7 @@ Public Class frmMain
If userId = 0 Then
MsgBox($"Der Benutzer '{Environment.UserName}' ist nicht in der Benutzerverwaltung vorhanden. {vbCrLf & vbCrLf}Bitte kontaktieren Sie den Administrator, wenn dies ein Fehler ist.", MsgBoxStyle.Critical, "UserManager")
logger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht in der Benutzerverwaltung vorhanden.")
MyLogger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht in der Benutzerverwaltung vorhanden.")
Application.ExitThread()
End If
@@ -112,51 +114,55 @@ Public Class frmMain
DragDropManager.AddGridView(viewModulesGroups_AvailableGroups)
Else
MsgBox($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt. {vbCrLf & vbCrLf}Bitte kontaktieren Sie den Administrator, wenn dies ein Fehler ist.", MsgBoxStyle.Critical, "UserManager")
logger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
MyLogger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
Application.ExitThread()
End If
If TBDD_USERTableAdapter.IsUserManagerAdmin(Environment.UserName) <> 1 Then
MsgBox($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt. {vbCrLf & vbCrLf}Bitte kontaktieren Sie den Administrator, wenn dies ein Fehler ist.", MsgBoxStyle.Critical, "UserManager")
logger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
MyLogger.Warn($"Der Benutzer '{Environment.UserName}' ist nicht zur Benutzerverwaltung berechtigt.")
Application.ExitThread()
End If
Catch ex As Exception
MsgBox("Unexpected Error while loading. Please check the log.", MsgBoxStyle.Critical, "User Manager")
logger.Fatal(ex, "Unexpected Error while loading.")
MyLogger.Fatal(ex, "Unexpected Error while loading.")
End Try
End Sub
Public Function InitDatabase()
Try
Dim dbResult As Boolean
Private Sub LoadConfig(ConfigManager As ConfigManager(Of UserConfig))
Dim oConnectionString As String = ""
Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = ConfigManager.Config.ConnectionString
MySettings_Load()
If Not csb.ConnectionString = "" Then
If csb.ConnectionString.Contains("Password=") Then
'sa-
'Jetzt das Passwort entschlüsseln
Dim PWplainText As String
Dim wrapper As New EncryptionLegacy("!35452didalog=")
' DecryptData throws if the wrong password is used.
Try
PWplainText = wrapper.DecryptData(csb.Password)
oConnectionString = ConfigManager.Config.ConnectionString.Replace(csb.Password, PWplainText)
Catch ex As Exception
MyLogger.Error(ex)
MyLogger.Warn("- the Password '" & csb.Password & "' could not be decrypted", False)
oConnectionString = ""
End Try
clsDatabase.GUI = True
If MyConnectionString <> String.Empty Then
dbResult = clsDatabase.Init(MyConnectionString)
Else
frmConfigDatabase.ShowDialog()
dbResult = clsDatabase.Init(MyConnectionString)
'Windows-Auth
oConnectionString = ConfigManager.Config.ConnectionString
End If
clsDatabase.Init(MyConnectionString)
If dbResult = False Then
If clsLogger.LOGG_MSG <> String.Empty Then
Throw New Exception("Error while Initializing database:" & vbNewLine & clsLogger.LOGG_MSG)
Else
Throw New Exception("Find more information in the logfile.")
End If
End If
Return True
Catch ex As Exception
logger.Fatal(ex, "Unexpected Error in Init Database:")
MsgBox("Unexpected Error in Init Database:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
MyConnectionString = oConnectionString
Else
MyConnectionString = ""
End If
Return False
End Try
End Function
LogErrorsOnly = MyConfig.Config.LogErrorsOnly
ActiveDirectoryRootNode = MyConfig.Config.AdRootPath
End Sub
Private Sub btnImportUsers_Click(sender As Object, e As EventArgs) Handles btnImportUsers.Click
Dim frm As New frmADImport_Users()
@@ -1036,7 +1042,7 @@ Public Class frmMain
#End Region
Private Sub ShowErrorMessage(errorText As String, ex As Exception)
logger.Error(ex, errorText)
MyLogger.Error(ex, errorText)
MsgBox(errorText & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Critical, "User Manager")
End Sub
@@ -1069,20 +1075,23 @@ Public Class frmMain
Process.Start(ClassNLog.GetLogPathFor(MODULE_NAME))
End Sub
Private Sub txtADRootNode_Leave(sender As Object, e As EventArgs) Handles txtADRootNode.Leave, txtLDAPGroupQuery.Leave
SaveMySettingsValue("ActiveDirectoryRootNode", txtADRootNode.Text, "ConfigMain")
Private Sub txtADRootNode_Leave(sender As Object, e As EventArgs) Handles txtADRootNode.Leave, txtLDAPGroupQuery.Leave, txtLDAPUserQuery.Leave
MyConfig.Config.AdRootPath = txtADRootNode.Text
MyConfig.Save()
End Sub
Private Sub btnADConnectionTest_Click(sender As Object, e As EventArgs) Handles btnADConnectionTest.Click
Dim ldapPAth = IIf(txtADRootNode.Text = String.Empty, ActiveDirectoryRootNode, txtADRootNode.Text)
Dim oActiveDirectory As New ActiveDirectoryInterface(MyLogConfig, ldapPAth)
If ClassActiveDirectory.ConnectionTest(txtADRootNode.Text) Then
If oActiveDirectory.Authenticate() Then
MsgBox("Verbindung erfolgreich aufgebaut!", MsgBoxStyle.Information)
SaveMySettingsValue("ActiveDirectoryRootNode", txtADRootNode.Text, "ConfigMain")
logger.Info($"New ActiveDirectory Path saved: {txtADRootNode.Text}")
MyConfig.Config.AdRootPath = txtADRootNode.Text
MyConfig.Save()
MyLogger.Info($"New ActiveDirectory Path saved: {txtADRootNode.Text}")
End If
End Sub
@@ -1091,14 +1100,14 @@ Public Class frmMain
End Sub
Private Async Sub btnDebugQuery_Click(sender As Object, e As EventArgs) Handles btnDebugGroupQuery.Click
My.Settings.Save()
btnDebugGroupQuery.Text = "Abfrage läuft..."
btnDebugGroupQuery.Enabled = False
Dim oActiveDirectory As New ActiveDirectoryInterface(MyLogConfig, MyConfig.Config.AdRootPath)
Await Task.Run(Sub()
Dim groups = ClassActiveDirectory.GetActiveDirectoryGroups(txtLDAPGroupQuery.Text)
Dim frm As New frmADDebug()
Dim groups = oActiveDirectory.ListGroups(MyConfig.Config.AdGroupFilter)
Dim frm As New frmADDebug_Groups()
frm.DebugData = groups
frm.ShowDialog()
@@ -1116,7 +1125,7 @@ Public Class frmMain
If MessageBox.Show(oMessage, "Benutzer löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
Dim osql = $"EXEC PRDD_DELETE_USER {oUserId}"
If clsDatabase.Execute_Scalar(osql) = -1 Then
If MyDatabase.GetScalarValue(osql) = -1 Then
MessageBox.Show("Fehler beim Löschen des Benutzers.", "Benutzer löschen", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
UpdateSavedLabel()
@@ -1124,4 +1133,17 @@ Public Class frmMain
End If
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click, Button4.Click
MyConfig.Config.AdGroupFilter = txtLDAPGroupQuery.Text
MyConfig.Save()
End Sub
Private Sub XtraTabControl1_SelectedPageChanged(sender As Object, e As DevExpress.XtraTab.TabPageChangedEventArgs) Handles XtraTabControl1.SelectedPageChanged
If e.Page.Name = tabPageSettings.Name Then
txtADRootNode.Text = MyConfig.Config.AdRootPath
txtLDAPGroupQuery.Text = MyConfig.Config.AdGroupFilter
txtLDAPUserQuery.Text = MyConfig.Config.AdUserFilter
End If
End Sub
End Class