You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
Public Class clsUser
|
|
|
|
|
|
#Region "Tools"
|
|
Sub create_usertable(ByVal username As String)
|
|
Dim ds As New DataSet
|
|
ds.Tables.Add("Users")
|
|
ds.Tables(0).Columns.Add("TGNummer")
|
|
ds.Tables(0).Columns.Add("Rolle")
|
|
ds.Tables(0).Columns.Add("EDOKA_MA_Nr")
|
|
Dim dr As DataRow = ds.Tables(0).NewRow
|
|
dr.Item(0) = Crypto.EncryptText(username, "Selbstanzeigen")
|
|
dr.Item(1) = 1
|
|
dr.Item(2) = 0
|
|
ds.Tables(0).Rows.Add(dr)
|
|
ds.WriteXml(ApplicationPath() + "\DocRetUsers.xml")
|
|
End Sub
|
|
|
|
Function check_user(user As String) As Boolean
|
|
If Not System.IO.File.Exists(ApplicationPath() + "\DocRetUsers.xml") Then
|
|
MsgBox("User-Datenbank ist nicht vorhanden und wird neu erstellt", MsgBoxStyle.Critical)
|
|
Dim s As String = InputBox("Geben Sie das Passwort ein:")
|
|
If s <> "edokatools" Then
|
|
Return False
|
|
End If
|
|
create_usertable(user)
|
|
Return False
|
|
End If
|
|
|
|
Userdata.ReadXml(ApplicationPath() + "\DocRetUsers.xml")
|
|
For Each dr As DataRow In Userdata.Tables(0).Rows
|
|
dr.Item(0) = Crypto.DecryptText(dr.Item(0).ToString, "Selbstanzeigen")
|
|
Next
|
|
|
|
userrechte = -1
|
|
For Each dr As DataRow In Userdata.Tables(0).Rows
|
|
If UCase(user) = UCase(dr.Item(0)) Then
|
|
If dr.Item(1) = 1 Then UserRechte = 1 Else UserRechte = 0
|
|
Mitarbeiternr = dr.Item(2)
|
|
tgnummer = user
|
|
Exit For
|
|
End If
|
|
Next
|
|
If userrechte = -1 Then
|
|
MsgBox("Sie sind nicht berechtig, die Applikation zu verwenden.", MsgBoxStyle.Exclamation)
|
|
Return False
|
|
End If
|
|
Return True
|
|
|
|
|
|
End Function
|
|
#End Region
|
|
|
|
End Class
|