MS Adding documents
This commit is contained in:
@@ -86,10 +86,10 @@ Public Class ClassWDRights
|
||||
|
||||
If Not IsNothing(oSession) Then
|
||||
LOGGER.Debug("Session created.")
|
||||
Dim sql = String.Format("SELECT * FROM [dbo].[FNPMO_GET_RIGHTS_FOR_DOC] ({0}) where USER_OR_GROUP = 'USER'", doc_id)
|
||||
DT_USER_RIGHT = MYDB_ECM.GetDatatable(sql)
|
||||
sql = String.Format("SELECT * FROM [dbo].[FNPMO_GET_RIGHTS_FOR_DOC] ({0}) where USER_OR_GROUP = 'GROUP'", doc_id)
|
||||
DT_GROUP_RIGHT = MYDB_ECM.GetDatatable(sql)
|
||||
Dim oSql = String.Format("SELECT * FROM [dbo].[FNPMO_GET_RIGHTS_FOR_DOC] ({0},{1}) where USER_OR_GROUP = 'USER'", doc_id, CURRENT_ENTITY_ID)
|
||||
DT_USER_RIGHT = MYDB_ECM.GetDatatable(oSql)
|
||||
oSql = String.Format("SELECT * FROM [dbo].[FNPMO_GET_RIGHTS_FOR_DOC] ({0},{1}) where USER_OR_GROUP = 'GROUP'", doc_id, CURRENT_ENTITY_ID)
|
||||
DT_GROUP_RIGHT = MYDB_ECM.GetDatatable(oSql)
|
||||
If IsNothing(DT_USER_RIGHT) Then
|
||||
Dim msg = "Error while receiving rights for DocID"
|
||||
LOGGER.Warn(msg)
|
||||
@@ -127,6 +127,11 @@ Public Class ClassWDRights
|
||||
End If
|
||||
'############################# Rechte löschen ################################################################################
|
||||
'#############################################################################################################################
|
||||
|
||||
If Not (DT_USER_RIGHT.Rows.Count > 0 Or DT_GROUP_RIGHT.Rows.Count > 0) Then
|
||||
LOGGER.Warn("ONLY FOLDERRIGHTS WILL BE USED, AS NO RIGHTS WERE FOUND!")
|
||||
Return True
|
||||
End If
|
||||
If deleterights = True Then
|
||||
LOGGER.Debug("rights for document will now be deleted.")
|
||||
'Erst einmal alle anderen Rechte löschen
|
||||
@@ -151,7 +156,7 @@ Public Class ClassWDRights
|
||||
Else
|
||||
_msg = "Right for User: '" & UserOrGroup.aName & "'"""
|
||||
End If
|
||||
LOGGER.Debug(String.Format("[{0}] will now be deleted.", _msg))
|
||||
LOGGER.Debug(String.Format("[{0}] will now be deleted ...", _msg))
|
||||
If Err.Number <> 0 Then
|
||||
Dim msg = "Error in setting UserGroupRelation - Err.Number: " & Err.Number & vbCrLf & Err.Description
|
||||
LOGGER.Warn(msg)
|
||||
@@ -169,9 +174,10 @@ Public Class ClassWDRights
|
||||
End Try
|
||||
i += 1
|
||||
_msg = _msg.Replace(" '", "")
|
||||
LOGGER.Debug(String.Format("{0} was deleted.", _msg))
|
||||
LOGGER.Debug(String.Format("{0} has been deleted!", _msg))
|
||||
Next
|
||||
LOGGER.Debug("All rights for doc were deleted....")
|
||||
LOGGER.Debug("All rights for doc were deleted!")
|
||||
LOGGER.Debug("================================")
|
||||
End If
|
||||
|
||||
Err.Clear()
|
||||
@@ -179,29 +185,30 @@ Public Class ClassWDRights
|
||||
' dann muss mindestens EIN Rechteträger mit dem Recht zur Rechteänderung
|
||||
' wieder zugefügt werden!!!!! Dies ist der OrgFlow-Right User!
|
||||
'Für jeden User das Recht einzeln hinzufügen
|
||||
LOGGER.Debug("Nun hinzufügen von User-Rechten ...")
|
||||
For Each User_Row As DataRow In DT_USER_RIGHT.Rows
|
||||
Dim fileright 'Recht als Integer
|
||||
Dim StringUserRight
|
||||
Dim ofilerightfromFunc 'Recht als Integer
|
||||
Dim oFileRightString
|
||||
oFileRightString = AD_DOMAIN & "\" & User_Row.Item("USR_NAME")
|
||||
ofilerightfromFunc = User_Row.Item("USR_RIGHT")
|
||||
Try
|
||||
StringUserRight = AD_DOMAIN & "\" & User_Row.Item("USR_NAME")
|
||||
fileright = User_Row.Item("USR_RIGHT")
|
||||
LOGGER.Debug(String.Format("Working on right for user-right: {0}-{1}", StringUserRight, fileright))
|
||||
LOGGER.Debug(String.Format("Working on right for user-right: {0}-{1}", oFileRightString, ofilerightfromFunc))
|
||||
Try
|
||||
' User holen
|
||||
oUSer = oSession.GetWMObjectByName(WMEntityUser, StringUserRight)
|
||||
oUSer = oSession.GetWMObjectByName(WMEntityUser, oFileRightString)
|
||||
LOGGER.Debug("got oUSer...")
|
||||
Catch ex As Exception
|
||||
Dim msg = String.Format("Could not create windream-Usersession for user '{0}' - check whether user is part of windream-group!", StringUserRight)
|
||||
Dim msg = String.Format("Could not create windream-Usersession for user '{0}' - check whether user is part of windream-group!", oFileRightString)
|
||||
LOGGER.Warn(msg)
|
||||
MSG_RESULT &= msg & vbNewLine
|
||||
Continue For
|
||||
End Try
|
||||
If Not IsNothing(oUSer) Then
|
||||
Try
|
||||
AccessRights.Insert2(oUSer, fileright) 'WMAccessRightAllRights)
|
||||
LOGGER.Debug("Right was set...")
|
||||
AccessRights.Insert2(oUSer, ofilerightfromFunc) 'WMAccessRightAllRights)
|
||||
LOGGER.Debug("==> Right was set!")
|
||||
Catch ex As Exception
|
||||
Dim msg = String.Format("Could not set right for user {0} - AccessRights.Insert2: {1}", StringUserRight, ex.Message)
|
||||
Dim msg = String.Format("Could not set right for user {0} - AccessRights.Insert2: {1}", oFileRightString, ex.Message)
|
||||
LOGGER.Warn(msg)
|
||||
Continue For
|
||||
End Try
|
||||
@@ -209,7 +216,7 @@ Public Class ClassWDRights
|
||||
|
||||
Catch ex As Exception
|
||||
Dim _right
|
||||
Select Case fileright
|
||||
Select Case ofilerightfromFunc
|
||||
Case WMAccessRightRead
|
||||
_right = "READ"
|
||||
Case WMAccessRightWrite
|
||||
@@ -221,13 +228,14 @@ Public Class ClassWDRights
|
||||
Case WMAccessRightReadWrite
|
||||
_right = "READ WRITE"
|
||||
End Select
|
||||
MSG_RESULT &= String.Format("Error while working on RightChange:" & vbNewLine & "Fileright: {0}" & vbNewLine & "User: {1} " & vbNewLine & "File: {2}", _right, StringUserRight, reldocpath) & vbNewLine
|
||||
MSG_RESULT &= String.Format("Error while working on RightChange:" & vbNewLine & "Fileright: {0}" & vbNewLine & "User: {1} " & vbNewLine & "File: {2}", _right, oFileRightString, reldocpath) & vbNewLine
|
||||
LOGGER.Warn(ex.Message)
|
||||
End Try
|
||||
Next
|
||||
End Try
|
||||
Next
|
||||
|
||||
|
||||
'Für jede Gruppe das Recht einzeln hinzufügen
|
||||
|
||||
LOGGER.Debug("Nun hinzufügen von Gruppen-Rechten ...")
|
||||
For Each Group_Row As DataRow In DT_GROUP_RIGHT.Rows
|
||||
Dim fileright 'Recht als Integer
|
||||
Dim StringGroupRight
|
||||
@@ -235,7 +243,7 @@ Public Class ClassWDRights
|
||||
Try
|
||||
StringGroupRight = AD_DOMAIN & "\" & Group_Row.Item("USR_NAME")
|
||||
fileright = Group_Row.Item("USR_RIGHT")
|
||||
LOGGER.Debug(String.Format("Working on right for group-right: {0}-{1}", StringGroupRight, fileright))
|
||||
LOGGER.Debug(String.Format("Working on right for group-right: {0}-{1} ...", StringGroupRight, fileright))
|
||||
Try
|
||||
' User holen
|
||||
_oGroup = oSession.GetWMObjectByName(WMEntityGroups, StringGroupRight)
|
||||
@@ -250,7 +258,7 @@ Public Class ClassWDRights
|
||||
If Not IsNothing(_oGroup) Then
|
||||
Try
|
||||
AccessRights.Insert2(_oGroup, fileright) 'WMAccessRightAllRights)
|
||||
LOGGER.Debug("Right was set...")
|
||||
LOGGER.Debug("==> Right was set!")
|
||||
Catch ex As Exception
|
||||
Dim msg = String.Format("Could not set right for docID: {0} group {1} - AccessRights.Insert2: {2}", doc_id, StringGroupRight, ex.Message)
|
||||
LOGGER.Warn(msg)
|
||||
|
||||
Reference in New Issue
Block a user