This commit is contained in:
SchreiberM 2016-08-17 14:18:07 +02:00
parent f0ce937585
commit 708156ba0c
13 changed files with 520 additions and 67 deletions

View File

@ -206,7 +206,7 @@ Public Class ClassInit
MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
End Function
End Class

View File

@ -6,4 +6,6 @@
Public USER_LANGUAGE As String = "de-DE"
Public USER_DATE_FORMAT As String
Public USER_WAN As Boolean = False
Public DT_WORK_USER_RIGHTS As DataTable
Public DT_SUPERVISOR_ENTITY As DataTable
End Module

View File

@ -60,6 +60,16 @@ Namespace My.Resources
End Set
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property _112_RightArrowShort_Blue_24x24_72() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("112_RightArrowShort_Blue_24x24_72", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>

View File

@ -121,10 +121,13 @@
<data name="cancel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cancel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cancel1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cancel1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_Closed_16xSM" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\folder_Closed_16xSM.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cancel1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cancel1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="112_RightArrowShort_Blue_24x24_72" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\112_RightArrowShort_Blue_24x24_72.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -79,6 +79,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="frmReworkUsers.Designer.vb">
<DependentUpon>frmReworkUsers.vb</DependentUpon>
</Compile>
<Compile Include="frmReworkUsers.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmCheckRightsEntity.Designer.vb">
<DependentUpon>frmCheckRightsEntity.vb</DependentUpon>
</Compile>
@ -110,6 +116,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmReworkUsers.resx">
<DependentUpon>frmReworkUsers.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmCheckRightsEntity.resx">
<DependentUpon>frmCheckRightsEntity.vb</DependentUpon>
</EmbeddedResource>
@ -146,6 +155,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="navigate_right2.ico" />
<None Include="Resources\112_RightArrowShort_Blue_24x24_72.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

View File

@ -98,16 +98,18 @@ Partial Class frmCheckRightsEntity
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7!, 16!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(755, 321)
Me.ClientSize = New System.Drawing.Size(503, 161)
Me.Controls.Add(Me.chklogging)
Me.Controls.Add(Me.btncancel)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.btnCheckRights)
Me.Controls.Add(Me.cmbentity)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCheckRightsEntity"
Me.ShowInTaskbar = false
Me.Text = "Check Rights for Entity"

View File

@ -46,6 +46,7 @@ Public Class frmCheckRightsEntity
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
_error = False
Dim i As Integer = 1
'Jede Datei einzeln verarbeiten
For Each row As DataRow In DT_FILES.Rows
If BW_RightsEntity.CancellationPending = True Then
e.Cancel = True
@ -69,6 +70,7 @@ Public Class frmCheckRightsEntity
i += 1
End If
Next
DD_Rights.ClassRights.Finalize_SettingRights()
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
@ -83,7 +85,8 @@ Public Class frmCheckRightsEntity
If _error = False Then
MsgBox("All rights of files belonging to entity were checked and refreshed successfully!", MsgBoxStyle.Information)
Else
MsgBox("Some errors occured while checking and setting the rights...please check the log!", MsgBoxStyle.Exclamation)
MsgBox("Some errors occured while checking and setting the rights...please check the log!" & vbNewLine & ">> " & ClassRights.COUNT_FILES.ToString & " files schould be worked." & _
">> " & ClassRights.WORKED_FILES.ToString & " were worked successfully.", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception

View File

@ -0,0 +1,131 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmReworkUsers
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.Label1 = New System.Windows.Forms.Label()
Me.cmbUser = New System.Windows.Forms.ComboBox()
Me.BW_RightsEntity = New System.ComponentModel.BackgroundWorker()
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
Me.chklogging = New System.Windows.Forms.CheckBox()
Me.btncancel = New System.Windows.Forms.Button()
Me.btnCheckRights = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(25, 9)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(147, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Please choose an entity:"
'
'cmbUser
'
Me.cmbUser.FormattingEnabled = True
Me.cmbUser.Location = New System.Drawing.Point(28, 29)
Me.cmbUser.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.cmbUser.Name = "cmbUser"
Me.cmbUser.Size = New System.Drawing.Size(335, 24)
Me.cmbUser.TabIndex = 1
'
'BW_RightsEntity
'
'
'ProgressBar1
'
Me.ProgressBar1.Location = New System.Drawing.Point(28, 108)
Me.ProgressBar1.Name = "ProgressBar1"
Me.ProgressBar1.Size = New System.Drawing.Size(335, 31)
Me.ProgressBar1.TabIndex = 3
Me.ProgressBar1.Visible = False
'
'chklogging
'
Me.chklogging.AutoSize = True
Me.chklogging.Checked = True
Me.chklogging.CheckState = System.Windows.Forms.CheckState.Checked
Me.chklogging.Location = New System.Drawing.Point(379, 31)
Me.chklogging.Name = "chklogging"
Me.chklogging.Size = New System.Drawing.Size(113, 20)
Me.chklogging.TabIndex = 5
Me.chklogging.Text = "Log errors only"
Me.chklogging.UseVisualStyleBackColor = True
'
'btncancel
'
Me.btncancel.Image = Global.RecordOrganizer_RightManager.My.Resources.Resources.cancel1
Me.btncancel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btncancel.Location = New System.Drawing.Point(369, 108)
Me.btncancel.Name = "btncancel"
Me.btncancel.Size = New System.Drawing.Size(75, 31)
Me.btncancel.TabIndex = 4
Me.btncancel.Text = "Cancel"
Me.btncancel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btncancel.UseVisualStyleBackColor = True
Me.btncancel.Visible = False
'
'btnCheckRights
'
Me.btnCheckRights.Image = Global.RecordOrganizer_RightManager.My.Resources.Resources._112_RightArrowShort_Blue_24x24_72
Me.btnCheckRights.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnCheckRights.Location = New System.Drawing.Point(28, 60)
Me.btnCheckRights.Name = "btnCheckRights"
Me.btnCheckRights.Size = New System.Drawing.Size(335, 39)
Me.btnCheckRights.TabIndex = 2
Me.btnCheckRights.Text = "Check rights for all documents related to this user"
Me.btnCheckRights.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnCheckRights.UseVisualStyleBackColor = True
'
'frmReworkUsers
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(503, 161)
Me.Controls.Add(Me.chklogging)
Me.Controls.Add(Me.btncancel)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.btnCheckRights)
Me.Controls.Add(Me.cmbUser)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmReworkUsers"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Rework Rights for User"
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents cmbUser As System.Windows.Forms.ComboBox
Friend WithEvents btnCheckRights As System.Windows.Forms.Button
Friend WithEvents BW_RightsEntity As System.ComponentModel.BackgroundWorker
Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
Friend WithEvents btncancel As System.Windows.Forms.Button
Friend WithEvents chklogging As System.Windows.Forms.CheckBox
End Class

View File

@ -0,0 +1,123 @@
<?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>
<metadata name="BW_RightsEntity.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,138 @@
Imports DD_Rights
Imports System.ComponentModel
Public Class frmReworkUsers
Private DT_FILES As DataTable
Private _error As Boolean = False
Private GUID_WORKING As Integer = 0
Private COUNT_ENTITIES As Integer = 0
Private ENTITIES_WORKED As Integer = 0
Private Sub frmCheckRightsEntity_Load(sender As Object, e As EventArgs) Handles Me.Load
Refresh_Combo()
End Sub
Sub Refresh_Combo()
Try
cmbUser.DataSource = Nothing
cmbUser.DataSource = DT_WORK_USER_RIGHTS
cmbUser.ValueMember = DT_WORK_USER_RIGHTS.Columns(0).ColumnName
cmbUser.DisplayMember = DT_WORK_USER_RIGHTS.Columns(1).ColumnName
Catch ex As Exception
MsgBox("Unexpected error in load Users List: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnCheckRights_Click(sender As Object, e As EventArgs) Handles btnCheckRights.Click
Dim ECM_USER_ID As Integer
If cmbUser.SelectedIndex <> -1 Then
GUID_WORKING = 0
Try
ENTITIES_WORKED = 0
Try
ECM_USER_ID = ClassDatabase.Execute_Scalar(String.Format("SELECT USERID_FK_INT_ECM FROM TBDD_USER WHERE GUID = (SELECT USER_ID FROM TBPMO_USER_RIGHTS_JOBS WHERE GUID = {0} )", cmbUser.SelectedValue))
Catch ex As Exception
MsgBox("No User ECM-ID found for selected User. Please inform Digital Data.", MsgBoxStyle.Exclamation)
Exit Sub
End Try
Dim sql = String.Format("SELECT ENTITY_ID FROM VWPMO_WD_DOC_SEARCH where DocID in (SELECT [dwObjectID] FROM VWPMO_WD_OBJECT_RIGHTS WHERE dwUserOrGroupID = {0}) GROUP BY ENTITY_ID", ECM_USER_ID)
Dim DT_ENTITY As DataTable = ClassDatabase.Return_Datatable(sql)
COUNT_ENTITIES = DT_ENTITY.Rows.Count
For Each row As DataRow In DT_ENTITY.Rows
sql = String.Format("SELECT * FROM VWPMO_WD_DOC_SEARCH where DocID in (SELECT [dwObjectID] FROM VWPMO_WD_OBJECT_RIGHTS WHERE dwUserOrGroupID = {0}) AND ENTITY_ID = {1}", ECM_USER_ID, row.Item("ENTITY_ID"))
DT_FILES = ClassDatabase.Return_Datatable(sql)
If DD_Rights.ClassRights.Init(row.Item("ENTITY_ID"), chklogging.Checked, DT_FILES.Rows.Count) = False Then
MsgBox("Could not init rights management. " & vbNewLine & "Check logfile", MsgBoxStyle.Critical)
Exit Sub
End If
'BackgroundWorker erstellen ...
BW_RightsEntity = New BackgroundWorker
BW_RightsEntity.WorkerReportsProgress = True
ProgressBar1.Maximum = DT_FILES.Rows.Count
Me.ProgressBar1.Visible = True
GUID_WORKING = cmbUser.SelectedValue
AddHandler BW_RightsEntity.DoWork, AddressOf bw_DoWork
ENTITIES_WORKED += 1
'.. und starten
BW_RightsEntity.RunWorkerAsync()
Next
Catch ex As Exception
MsgBox("Unexpected error in starting backgroundworker: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Me.ProgressBar1.Visible = False
End Try
End If
End Sub
Private Sub BW_RightsEntity_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BW_RightsEntity.ProgressChanged
Me.ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
_error = False
Dim i As Integer = 1
'Jede Datei einzeln verarbeiten
For Each row As DataRow In DT_FILES.Rows
If BW_RightsEntity.CancellationPending = True Then
e.Cancel = True
Exit For
Else
If DD_Rights.ClassRights.Collect_Users(row.Item("RECORD_ID")) = True Then
If DD_Rights.ClassRights.File_DeleteAndSetRight(row.Item("FULL_FILENAME"), True) Then
If DD_Rights.ClassRights.MSG_RESULT <> "" Then
MsgBox("Unexpected Errors in setting rights: " & vbNewLine & DD_Rights.ClassRights.MSG_RESULT, MsgBoxStyle.Exclamation)
_error = True
Else
End If
Else
ClassLogger.Add(">> Unexpected Error in ClassRights.File_DeleteAndSetRight. Check Log.")
_error = True
End If
Else
_error = True
End If
If BW_RightsEntity.CancellationPending = False And BW_RightsEntity.IsBusy Then
BW_RightsEntity.ReportProgress(i)
End If
i += 1
End If
Next
DD_Rights.ClassRights.Finalize_SettingRights()
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
ENTITIES_WORKED -= 1
' Cancel the asynchronous operation.
Me.BW_RightsEntity.CancelAsync()
End Sub
Private Sub BW_RightsEntity_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BW_RightsEntity.RunWorkerCompleted
Try
btncancel.Visible = False
ProgressBar1.Visible = False
If _error = False Then
If ENTITIES_WORKED = COUNT_ENTITIES Then
Dim upd = String.Format("UPDATE TBPMO_USER_RIGHTS_JOBS SET WORKED = 1, CHANGED_WHO = 'JOB-RIGHTS FINISHER' WHERE GUID = {0}", GUID_WORKING)
If ClassDatabase.Execute_non_Query(upd) = True Then
'Überprüfen ob es User gibt die aktualisiert werden müssen
Dim Sql = "SELECT T.GUID,T1.USERNAME + 'Reason: ' + T.COMMENT AS USER_COMMENT FROM TBPMO_USER_RIGHTS_JOBS T, TBDD_USER T1 WHERE T.USER_ID = T1.GUID AND T.WORKED = 0"
DT_WORK_USER_RIGHTS = ClassDatabase.Return_Datatable(Sql)
Refresh_Combo()
End If
MsgBox("All rights of files belonging to entity/User were checked and refreshed successfully!", MsgBoxStyle.Information)
End If
Else
MsgBox("Some errors occured while checking and setting the rights...please check the log!" & vbNewLine & ">> " & ClassRights.COUNT_FILES.ToString & " files schould be worked." & _
">> " & ClassRights.WORKED_FILES.ToString & " were worked successfully.", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
End Try
End Sub
End Class

View File

@ -24,6 +24,7 @@ Partial Class frmStart
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmStart))
Me.Button1 = New System.Windows.Forms.Button()
Me.btnWorkUserRights = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
@ -32,11 +33,22 @@ Partial Class frmStart
Me.Button1.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.Location = New System.Drawing.Point(12, 12)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(194, 45)
Me.Button1.Size = New System.Drawing.Size(250, 45)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Check Rights for Entity"
Me.Button1.UseVisualStyleBackColor = True
'
'btnWorkUserRights
'
Me.btnWorkUserRights.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnWorkUserRights.ForeColor = System.Drawing.Color.DarkRed
Me.btnWorkUserRights.Location = New System.Drawing.Point(12, 63)
Me.btnWorkUserRights.Name = "btnWorkUserRights"
Me.btnWorkUserRights.Size = New System.Drawing.Size(250, 45)
Me.btnWorkUserRights.TabIndex = 2
Me.btnWorkUserRights.Text = "Work User"
Me.btnWorkUserRights.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Image = Global.RecordOrganizer_RightManager.My.Resources.Resources.folder_Closed_16xSM
@ -54,16 +66,19 @@ Partial Class frmStart
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(829, 402)
Me.Controls.Add(Me.btnWorkUserRights)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmStart"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Rights Manager"
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents btnWorkUserRights As System.Windows.Forms.Button
End Class

View File

@ -1,82 +1,98 @@
Imports DD_Rights
Public Class frmStart
Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
Try
DD_Rights.ClassLogger.Init(Application.UserAppDataPath() & "\Log", Environment.UserName)
If DD_Rights.ClassDatabase.Init(My.Settings.MyConnectionString) = False Then
MsgBox("Error in Initializing Database. Please check log.", MsgBoxStyle.Critical)
Me.Close()
End If
Dim sql = String.Format("SELECT * FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", Environment.UserName)
ClassLogger.Add(">> Login at: " & Now.ToString, False)
ClassLogger.Add(">> Username: " & Environment.UserName, False)
Dim USER_DT As DataTable = ClassDatabase.Return_Datatable(sql)
If USER_DT.Rows.Count = 0 Then
ClassLogger.Add(" - User '" & Environment.UserName & "' not listed in Useradminsitration!", False)
'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
'Me.Close()
Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.")
DD_Rights.ClassLogger.Init(Application.UserAppDataPath() & "\Log", Environment.UserName)
If DD_Rights.ClassDatabase.Init(My.Settings.MyConnectionString) = False Then
MsgBox("Error in Initializing Database. Please check log.", MsgBoxStyle.Critical)
Me.Close()
End If
Dim sql = String.Format("SELECT * FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", Environment.UserName)
ClassLogger.Add(">> Login at: " & Now.ToString, False)
ClassLogger.Add(">> Username: " & Environment.UserName, False)
Dim USER_DT As DataTable = ClassDatabase.Return_Datatable(sql)
If USER_DT.Rows.Count = 0 Then
ClassLogger.Add(" - User '" & Environment.UserName & "' not listed in Useradminsitration!", False)
'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
'Me.Close()
Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.")
MsgBox(msg, MsgBoxStyle.Exclamation)
Me.Close()
Else
USER_GUID = USER_DT.Rows(0).Item("GUID")
USERID_FK_INT_ECM = USER_DT.Rows(0).Item("USERID_FK_INT_ECM")
USER_WAN = USER_DT.Rows(0).Item("WAN_ENVIRONMENT") 'ClassDatabase.Execute_Scalar("SELECT WAN_ENVIRONMENT FROM TBDD_USER WHERE GUID = " & USER_GUID, False)
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
USER_DATE_FORMAT = USER_DT.Rows(0).Item("DATE_FORMAT")
USER_IS_ADMIN = USER_DT.Rows(0).Item("RECORD_ADMIN")
'USER_LANGUAGE = ClassDatabase.Execute_Scalar("SELECT LANGUAGE FROM TBDD_USER WHERE GUID = " & USER_GUID, False)
Dim DT_CLIENT_USER As DataTable = ClassDatabase.Return_Datatable("SELECT CLIENT_ID FROM TBDD_CLIENT_USER WHERE USER_ID = " & USER_GUID)
'Dim i As Integer = 0
'For Each row As DataRow In DT_CLIENT_USER.Rows
' If i = 0 Then
' USER_CLIENTS_COMMA_SEPERATED = row.Item(0).ToString
' Else
' USER_CLIENTS_COMMA_SEPERATED = USER_CLIENTS_COMMA_SEPERATED & "," & row.Item(0).ToString
' End If
' i += 1
'Next
Dim Right_RO As Boolean = USER_DT.Rows(0).Item("MODULE_RECORD_ORG")
If Right_RO = False Then
ClassLogger.Add(" - User: " & Environment.UserName & " nicht für Modul freigegben!", False)
'MsgBox("Achtung: Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
Dim msg = String.Format("Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!")
If USER_LANGUAGE <> "de-DE" Then
msg = String.Format("You are not authorized for using this module." & vbNewLine & "Please contact the admin.")
End If
MsgBox(msg, MsgBoxStyle.Exclamation)
Me.Close()
Else
USER_GUID = USER_DT.Rows(0).Item("GUID")
USERID_FK_INT_ECM = USER_DT.Rows(0).Item("USERID_FK_INT_ECM")
USER_WAN = USER_DT.Rows(0).Item("WAN_ENVIRONMENT") 'ClassDatabase.Execute_Scalar("SELECT WAN_ENVIRONMENT FROM TBDD_USER WHERE GUID = " & USER_GUID, False)
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
USER_DATE_FORMAT = USER_DT.Rows(0).Item("DATE_FORMAT")
sql = String.Format("SELECT * FROM TBPMO_ENTITY_SUPERVISOR WHERE USER_ID = {0}", USER_GUID)
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
If DT.Rows.Count > 0 Then
DT_SUPERVISOR_ENTITY = DT
MsgBox("As Supervisor You are only allowed to change entity-related rights!", MsgBoxStyle.Information)
End If
'USER_LANGUAGE = ClassDatabase.Execute_Scalar("SELECT LANGUAGE FROM TBDD_USER WHERE GUID = " & USER_GUID, False)
Dim DT_CLIENT_USER As DataTable = ClassDatabase.Return_Datatable("SELECT CLIENT_ID FROM TBDD_CLIENT_USER WHERE USER_ID = " & USER_GUID)
'Dim i As Integer = 0
'For Each row As DataRow In DT_CLIENT_USER.Rows
' If i = 0 Then
' USER_CLIENTS_COMMA_SEPERATED = row.Item(0).ToString
' Else
' USER_CLIENTS_COMMA_SEPERATED = USER_CLIENTS_COMMA_SEPERATED & "," & row.Item(0).ToString
' End If
' i += 1
'Next
Dim Right_RO As Boolean = USER_DT.Rows(0).Item("MODULE_RECORD_ORG")
If Right_RO = False Then
ClassLogger.Add(" - User: " & Environment.UserName & " nicht für Modul freigegben!", False)
'MsgBox("Achtung: Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
Dim msg = String.Format("Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!")
If USER_LANGUAGE <> "de-DE" Then
msg = String.Format("You are not authorized for using this module." & vbNewLine & "Please contact the admin.")
End If
If USER_IS_ADMIN = False And DT.Rows.Count = 0 Then
Dim msg = String.Format("Sorry You are not an ADDI-Admin!")
MsgBox(msg, MsgBoxStyle.Exclamation)
Me.Close()
Else
sql = String.Format("SELECT RECORD_ADMIN FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('{0}'))", Environment.UserName)
USER_IS_ADMIN = ClassDatabase.Execute_Scalar(sql)
If USER_IS_ADMIN = False Then
Dim msg = String.Format("Sorry You are not an ADDI-Admin!")
MsgBox(msg, MsgBoxStyle.Exclamation)
Me.Close()
End If
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in InitUserLogin: " & ex.Message, True)
MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical)
End Try
Catch ex As Exception
'Überprüfen ob es User gibt die aktualisiert werden müssen
sql = "SELECT T.GUID,T1.USERNAME + 'Reason: ' + T.COMMENT AS USER_COMMENT FROM TBPMO_USER_RIGHTS_JOBS T, TBDD_USER T1 WHERE T.USER_ID = T1.GUID AND T.WORKED = 0"
DT_WORK_USER_RIGHTS = ClassDatabase.Return_Datatable(sql)
If DT_WORK_USER_RIGHTS.Rows.Count > 0 Then
btnWorkUserRights.Text = "Userrelations were changed." & vbNewLine & DT_WORK_USER_RIGHTS.Rows.Count.ToString & " Users need to be refreshed!"
btnWorkUserRights.Visible = True
Else
btnWorkUserRights.Visible = False
End If
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in InitUserLogin: " & ex.Message, True)
MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Visible = False
' Me.Visible = False
frmCheckRightsEntity.ShowDialog()
Me.Visible = True
'Me.Visible = True
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Process.Start(ClassLogger.DateiSpeicherort)
End Sub
Private Sub btnWorkUserRights_Click(sender As Object, e As EventArgs) Handles btnWorkUserRights.Click
frmReworkUsers.ShowDialog()
End Sub
End Class