Berechtigungen kopieren aus Referenzuser

This commit is contained in:
2023-06-30 15:01:55 +02:00
parent 6ce26b0614
commit cbc8f3651b
9 changed files with 1463 additions and 37 deletions

View File

@@ -22,6 +22,7 @@ Partial Class frmMitarbDetails
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMitarbDetails))
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.Label1 = New System.Windows.Forms.Label()
@@ -187,6 +188,7 @@ Partial Class frmMitarbDetails
Me.PictureBox6 = New System.Windows.Forms.PictureBox()
Me.cboAdminBer = New System.Windows.Forms.ComboBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
Me.TabControl2.SuspendLayout()
@@ -2057,6 +2059,11 @@ Partial Class frmMitarbDetails
Me.Label7.TabIndex = 78
Me.Label7.Text = "Berechtigung:"
'
'ContextMenuStrip1
'
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(181, 26)
'
'frmMitarbDetails
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -2265,4 +2272,5 @@ Partial Class frmMitarbDetails
Friend WithEvents txtEmailExtension As TextBox
Friend WithEvents lblEmailExtension As Label
Friend WithEvents btnUpdateAD As Button
Friend WithEvents ContextMenuStrip1 As ContextMenuStrip
End Class

View File

@@ -133,6 +133,9 @@
01+wb33MpfBz/gAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="ContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAYGAAAAEAGACocAAAFgAAACgAAABgAAAAwAAAAAEAGAAAAAAAgHAAAMQOAADEDgAAAAAAAAAA

View File

@@ -21,7 +21,7 @@ Public Class frmMitarbDetails
Private berechtigungen As New List(Of cBerechtigungen)
Public mid As Integer = -1
Public isUpdate As Boolean = False
Private mitarbeiter As New VERAG_PROG_ALLGEMEIN.cMitarbeiter
Public mitarbeiter As New VERAG_PROG_ALLGEMEIN.cMitarbeiter
Private usrBerechtigung As New List(Of cUserBerechtigungen)
Private usrBerechtigungNEU As New List(Of cUserBerechtigungen)
Dim ZOLLDATENBEARB = False
@@ -926,11 +926,39 @@ Public Class frmMitarbDetails
End Sub
Private Sub mnuItem_Clicked(sender As Object, e As EventArgs)
ContextMenuStrip1.Hide() 'Sometimes the menu items can remain open. May not be necessary for you.
Dim item As ToolStripMenuItem = TryCast(sender, ToolStripMenuItem)
If item IsNot Nothing Then
synchActiveDirectoryADMIN(item.Name)
End If
End Sub
Private Sub btnUpdateAD_Click(sender As Object, e As EventArgs) Handles btnUpdateAD.Click
If cboALIASDomain._value = "" Or txtALIASUser.Text = "" Then
Exit Sub
End If
ContextMenuStrip1.Items.Clear()
Dim ADToADMIN = New ToolStripMenuItem() With {.Text = "Active Directory -> ADMIN (nur leere Felder werden befüllt)", .Name = "ADtoADMIN", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)}
Dim ADMINToAD = New ToolStripMenuItem() With {.Text = "ADMIN -> Active Directory (nur leere Felder werden befüllt)", .Name = "ADMINtoAD", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)}
AddHandler ADToADMIN.Click, AddressOf mnuItem_Clicked
ContextMenuStrip1.Items.Add(ADToADMIN)
AddHandler ADMINToAD.Click, AddressOf mnuItem_Clicked
ContextMenuStrip1.Items.Add(ADMINToAD)
ContextMenuStrip1.Show(Cursor.Position)
End Sub
Private Sub synchActiveDirectoryADMIN(AdminTOAD As String)
Dim a As MsgBoxResult = MsgBox("Die Daten des Mitarbeiters mit dem AD synchronisieren?", vbYesNo)
If a = vbYes Then
@@ -982,25 +1010,50 @@ Public Class frmMitarbDetails
Exit Sub
End If
If (isFilled(de.Properties("givenName").Value)) Then de.Properties("givenName").Value = txtVname.Text
If (isFilled(de.Properties("department").Value)) Then de.Properties("department").Value = cboAbteilung._value
If (isFilled(de.Properties("company").Value)) Then de.Properties("company").Value = cboFirma.SelectedValue
If (isFilled(de.Properties("sn").Value)) Then de.Properties("sn").Value = txtNname.Text
If (isFilled(de.Properties("mail").Value)) Then de.Properties("mail").Value = txtEmail.Text
If AdminTOAD = "ADMINtoAD" Then
If (isFilled(de.Properties("givenName").Value)) Then de.Properties("givenName").Value = txtVname.Text
If (isFilled(de.Properties("department").Value)) Then de.Properties("department").Value = cboAbteilung._value
If (isFilled(de.Properties("company").Value)) Then de.Properties("company").Value = cboFirma.SelectedValue
If (isFilled(de.Properties("sn").Value)) Then de.Properties("sn").Value = txtNname.Text
If (isFilled(de.Properties("mail").Value)) Then de.Properties("mail").Value = txtEmail.Text
If (isFilled(de.Properties("streetAdress").Value)) Then de.Properties("streetAdress").Value = txtStrasse.Text
If (isFilled(de.Properties("postalCode").Value)) Then de.Properties("postalCode").Value = txtPlz.Text
If (isFilled(de.Properties("I").Value)) Then de.Properties("I").Value = txtOrt.Text
If (isFilled(de.Properties("Mobile").Value)) Then de.Properties("Mobile").Value = txtMobiltel.Text
If cbxGekuendigt.Checked Then
Dim expire As DateTime = datGekuendigtAm.Value
expire = expire.AddDays(1)
de.Properties("accountExpires").Value = expire.ToFileTime.ToString
End If
de.CommitChanges()
Else
If txtEmail.Text = "" Then txtEmail.Text = de.Properties("mail").Value
If txtUsername.Text = "" Then txtUsername.Text = de.Properties("sAMAccountName").Value
If txtVname.Text = "" Then txtVname.Text = de.Properties("givenName").Value
If txtNname.Text = "" Then txtNname.Text = de.Properties("sn").Value
If txtStrasse.Text = "" Then txtStrasse.Text = de.Properties("streetAdress").Value
If txtPlz.Text = "" Then txtPlz.Text = de.Properties("postalCode").Value
If txtOrt.Text = "" Then txtOrt.Text = de.Properties("I").Value
If txtMobiltel.Text = "" Then txtMobiltel.Text = de.Properties("Mobile").Value
If txtDurchwahl.Text = "" Then txtDurchwahl.Text = de.Properties("telephoneNumber").Value
If txtALIASUser.Text = "" Then txtALIASUser.Text = de.Properties("sAMAccountName").Value
If txtEmailExtension.Text = "" Then txtEmailExtension.Text = de.Properties("extensionAttribute7").Value
'cboALIASDomain.changeItem(frmAD.activeDirectoryObj.domain)
'cboAbteilung.changeItem(frmAD.setNoNullableValue(frmAD.activeDirectoryObj.ADEntry.Properties("department").Value))
'cboNiederlassung.changeItem(frmAD.setNoNullableValue(frmAD.activeDirectoryObj.ADEntry.Properties("company").Value))
If cbxGekuendigt.Checked Then
Dim expire As DateTime = datGekuendigtAm.Value
expire = expire.AddDays(1)
de.Properties("accountExpires").Value = expire.ToFileTime.ToString
End If
'If (isFilled(de.Properties("streetAdress").Value)) Then de.Properties("streetAdress").Value = txtStrasse.Text
'If (isFilled(de.Properties("postalCode").Value)) Then de.Properties("postalCode").Value = txtPlz.Text
'If (isFilled(de.Properties("I").Value)) Then de.Properties("I").Value = txtOrt.Text
'If (isFilled(de.Properties("Mobile").Value)) Then de.Properties("Mobile").Value = txtMobiltel.Text
de.CommitChanges()
Catch ex As Exception
MsgBox(ex.Message)
End Try

View File

@@ -54,6 +54,7 @@ Partial Class usrCntlMitarbeiter
Me.Panel3 = New System.Windows.Forms.Panel()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.UserKopierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.BerechtigungenSetzenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.Panel2.SuspendLayout()
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
@@ -100,20 +101,22 @@ Partial Class usrCntlMitarbeiter
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(10, 285)
Me.Button8.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Button8.Location = New System.Drawing.Point(3, 553)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(75, 43)
Me.Button8.Size = New System.Drawing.Size(87, 60)
Me.Button8.TabIndex = 20
Me.Button8.Text = "Upload WIKI"
Me.Button8.Text = "Upload Mitarbeiterfotos WIKI"
Me.Button8.UseVisualStyleBackColor = True
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(10, 236)
Me.Button7.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Button7.Location = New System.Drawing.Point(11, 619)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(75, 43)
Me.Button7.Size = New System.Drawing.Size(75, 53)
Me.Button7.TabIndex = 19
Me.Button7.Text = "Clipboard WIKI"
Me.Button7.Text = "Copy to Clipboard WIKI"
Me.Button7.UseVisualStyleBackColor = True
'
'Button5
@@ -384,16 +387,22 @@ Partial Class usrCntlMitarbeiter
'
'ContextMenuStrip1
'
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.UserKopierenToolStripMenuItem})
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.UserKopierenToolStripMenuItem, Me.BerechtigungenSetzenToolStripMenuItem})
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(147, 26)
Me.ContextMenuStrip1.Size = New System.Drawing.Size(195, 48)
'
'UserKopierenToolStripMenuItem
'
Me.UserKopierenToolStripMenuItem.Name = "UserKopierenToolStripMenuItem"
Me.UserKopierenToolStripMenuItem.Size = New System.Drawing.Size(146, 22)
Me.UserKopierenToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
Me.UserKopierenToolStripMenuItem.Text = "User kopieren"
'
'BerechtigungenSetzenToolStripMenuItem
'
Me.BerechtigungenSetzenToolStripMenuItem.Name = "BerechtigungenSetzenToolStripMenuItem"
Me.BerechtigungenSetzenToolStripMenuItem.Size = New System.Drawing.Size(194, 22)
Me.BerechtigungenSetzenToolStripMenuItem.Text = "Berechtigungen setzen"
'
'usrCntlMitarbeiter
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -458,4 +467,5 @@ Partial Class usrCntlMitarbeiter
Friend WithEvents UserKopierenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents Button7 As Button
Friend WithEvents Button8 As Button
Friend WithEvents BerechtigungenSetzenToolStripMenuItem As ToolStripMenuItem
End Class

View File

@@ -2,6 +2,8 @@
Imports System.Net
Imports System.Text
Imports System.Windows.Controls
Imports GrapeCity.Viewer.Common.Model
Imports VERAG_PROG_ALLGEMEIN
Imports VERAG_PROG_ALLGEMEIN.cChilkat_Helper
@@ -380,22 +382,25 @@ Public Class usrCntlMitarbeiter
Tabelle_anzeigen()
End Sub
Private Sub UserKopierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UserKopierenToolStripMenuItem.Click
Private Sub UserKopierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UserKopierenToolStripMenuItem.Click, BerechtigungenSetzenToolStripMenuItem.Click
If TabControl1.SelectedIndex = 0 Then
If dgvVERAG.SelectedRows.Count <> 1 Then Exit Sub
copyUser(dgvVERAG.CurrentRow.Cells(0).Value)
If sender.Name = "UserKopierenToolStripMenuItem" Then
copyUser(dgvVERAG.CurrentRow.Cells(0).Value)
Else
Dim frm As New frmBenutzerBerGruppenKopieren(dgvVERAG.CurrentRow.Cells(0).Value)
frm.Show(Me)
End If
ElseIf TabControl1.SelectedIndex = 1 Then
If dgvATILLA.SelectedRows.Count <> 1 Then Exit Sub
copyUser(dgvATILLA.CurrentRow.Cells(0).Value)
ElseIf TabControl1.SelectedIndex = 2 Then
If dgvIMEX.SelectedRows.Count <> 1 Then Exit Sub
copyUser(dgvIMEX.CurrentRow.Cells(0).Value)
ElseIf TabControl1.SelectedIndex = 3 Then
If dgvUNISPED.SelectedRows.Count <> 1 Then Exit Sub
@@ -475,11 +480,31 @@ Public Class usrCntlMitarbeiter
frmMitarbDetails.mid = id
frmMitarbDetails.Show(Me)
frmMitarbDetails.isUpdate = False
frmMitarbDetails.Label1.Text = "Mitarbeiterkopie"
frmMitarbDetails.Label1.Text = "Mitarbeiter kopieren"
frmMitarbDetails.txtVname.Text = "Kopie von " & frmMitarbDetails.txtVname.Text
frmMitarbDetails.txtNname.Text = "Kopie von " & frmMitarbDetails.txtNname.Text
frmMitarbDetails.Label48.Text = "00"
'ZUordnungen zu ext. Prog entfernen
frmMitarbDetails.txtPwd.Text = ""
frmMitarbDetails.txtCSPW.Text = ""
frmMitarbDetails.txtVname.Text = "Kopie von " & frmMitarbDetails.txtVname.Text
frmMitarbDetails.Label48.Text = "00"
frmMitarbDetails.txtCSUser.Text = ""
frmMitarbDetails.txtPwd.Text = ""
'frmMitarbDetails.cboALIASDomain.changeItem("")
frmMitarbDetails.cboALIASDomain2.changeItem("")
frmMitarbDetails.cboPersonal.changeItem("")
frmMitarbDetails.txtALIASUser.Text = ""
frmMitarbDetails.txtALIASUser2.Text = ""
frmMitarbDetails.txtDakosySB.Text = ""
frmMitarbDetails.txtTelotecSB.Text = ""
If frmMitarbDetails.mitarbeiter IsNot Nothing Then
frmMitarbDetails.mitarbeiter.mit_EZOLL_SB = -1
frmMitarbDetails.mitarbeiter.mit_ATLAS_SB = ""
End If
frmMitarbDetails.txtDyFullName.Text = ""
Me.Cursor = Cursors.Default
@@ -506,7 +531,7 @@ Public Class usrCntlMitarbeiter
filePath.Append(filenameFull)
filePath.Append("](/mitarbeiterfotos/")
filePath.Append(filenameFull)
filePath.Append(" =150x150)") 'Bildgröße
filePath.Append(")")
filename = filePath.ToString
Else
filename = "|-"
@@ -581,11 +606,9 @@ Public Class usrCntlMitarbeiter
For Each row As DataGridViewRow In dgv.Rows
Dim test As Boolean = False
If row.Cells("mit_foto_DocId").Value > 0 Then
Dim file = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(row.Cells("mit_foto_DocId").Value)
Dim succeess = uploadPictureToWiki(token, 4, file)
test = True
Dim succeess = uploadPictureToWiki(token, 4, file) 'Folder 4 -> Mitarbeiterfotos
End If
Next