First create solution

This commit is contained in:
2017-03-08 11:21:27 +01:00
commit a2fb86bacf
5508 changed files with 1082238 additions and 0 deletions
@@ -0,0 +1,97 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Public Enum ePermissionType
Allow = 1
Deny = 0
NotSet = -1
End Enum
<DefaultClassOptions()> _
<NavigationItem("Default")> _
Public Class PermissionMatrix
Inherits BaseObject
Private _Role As Role
Private _ObjectType As String
Private _IsCreate As ePermissionType = -1
Private _IsDelete As ePermissionType = -1
Private _IsWrite As ePermissionType = -1
Private _IsRead As ePermissionType = -1
Private _IsNavigate As ePermissionType = -1
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
Property Role As Role
Get
Return _Role
End Get
Set(ByVal value As Role)
SetPropertyValue("Role", _Role, value)
End Set
End Property
<Size(255)> _
Property ObjectType As String
Get
Return _ObjectType
End Get
Set(ByVal value As String)
SetPropertyValue("ObjectType", _ObjectType, value)
End Set
End Property
Property IsCreate As ePermissionType
Get
Return _IsCreate
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsCreate", _IsCreate, value)
End Set
End Property
Property IsDelete As ePermissionType
Get
Return _IsDelete
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsDelete", _IsDelete, value)
End Set
End Property
Property IsWrite As ePermissionType
Get
Return _IsWrite
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsWrite", _IsWrite, value)
End Set
End Property
Property IsRead As ePermissionType
Get
Return _IsRead
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsRead", _IsRead, value)
End Set
End Property
Property IsNavigate As ePermissionType
Get
Return _IsNavigate
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsNavigate", _IsNavigate, value)
End Set
End Property
End Class
@@ -0,0 +1,99 @@
Partial Class CustomRoleEditorVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aCustomRoleLoad = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aCustomRoleSave = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aCustomRoleGroupSetUp = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aCreateCustomRoleObjectTypes = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
'
'aCustomRoleLoad
'
Me.aCustomRoleLoad.Caption = "Custom Role Load"
Me.aCustomRoleLoad.ConfirmationMessage = Nothing
Me.aCustomRoleLoad.Id = "aCustomRoleLoad"
Me.aCustomRoleLoad.ImageName = Nothing
Me.aCustomRoleLoad.Shortcut = Nothing
Me.aCustomRoleLoad.Tag = Nothing
Me.aCustomRoleLoad.TargetObjectsCriteria = Nothing
Me.aCustomRoleLoad.TargetViewId = "PermissionMatrix_ListView"
Me.aCustomRoleLoad.ToolTip = Nothing
Me.aCustomRoleLoad.TypeOfView = Nothing
'
'aCustomRoleSave
'
Me.aCustomRoleSave.Caption = "Custom Role Save"
Me.aCustomRoleSave.ConfirmationMessage = Nothing
Me.aCustomRoleSave.Id = "aCustomRoleSave"
Me.aCustomRoleSave.ImageName = Nothing
Me.aCustomRoleSave.Shortcut = Nothing
Me.aCustomRoleSave.Tag = Nothing
Me.aCustomRoleSave.TargetObjectsCriteria = Nothing
Me.aCustomRoleSave.TargetViewId = "PermissionMatrix_ListView"
Me.aCustomRoleSave.ToolTip = Nothing
Me.aCustomRoleSave.TypeOfView = Nothing
'
'aCustomRoleGroupSetUp
'
Me.aCustomRoleGroupSetUp.AcceptButtonCaption = Nothing
Me.aCustomRoleGroupSetUp.CancelButtonCaption = Nothing
Me.aCustomRoleGroupSetUp.Caption = "Custom Role Group SetUp"
Me.aCustomRoleGroupSetUp.Category = "ObjectsCreation"
Me.aCustomRoleGroupSetUp.ConfirmationMessage = Nothing
Me.aCustomRoleGroupSetUp.Id = "aCustomRoleGroupSetUp"
Me.aCustomRoleGroupSetUp.ImageName = Nothing
Me.aCustomRoleGroupSetUp.Shortcut = Nothing
Me.aCustomRoleGroupSetUp.Tag = Nothing
Me.aCustomRoleGroupSetUp.TargetObjectsCriteria = Nothing
Me.aCustomRoleGroupSetUp.TargetViewId = "PermissionMatrix_ListView"
Me.aCustomRoleGroupSetUp.ToolTip = Nothing
Me.aCustomRoleGroupSetUp.TypeOfView = Nothing
'
'aCreateCustomRoleObjectTypes
'
Me.aCreateCustomRoleObjectTypes.AcceptButtonCaption = Nothing
Me.aCreateCustomRoleObjectTypes.CancelButtonCaption = Nothing
Me.aCreateCustomRoleObjectTypes.Caption = "Create Custom Role ObjectTypes"
Me.aCreateCustomRoleObjectTypes.Category = "ObjectsCreation"
Me.aCreateCustomRoleObjectTypes.ConfirmationMessage = Nothing
Me.aCreateCustomRoleObjectTypes.Id = "aCreateCustomRoleObjectTypes"
Me.aCreateCustomRoleObjectTypes.ImageName = Nothing
Me.aCreateCustomRoleObjectTypes.Shortcut = Nothing
Me.aCreateCustomRoleObjectTypes.Tag = Nothing
Me.aCreateCustomRoleObjectTypes.TargetObjectsCriteria = Nothing
Me.aCreateCustomRoleObjectTypes.TargetViewId = "PermissionMatrix_ListView"
Me.aCreateCustomRoleObjectTypes.ToolTip = Nothing
Me.aCreateCustomRoleObjectTypes.TypeOfView = Nothing
End Sub
Friend WithEvents aCustomRoleLoad As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aCustomRoleSave As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aCustomRoleGroupSetUp As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aCreateCustomRoleObjectTypes As DevExpress.ExpressApp.Actions.PopupWindowShowAction
End Class
@@ -0,0 +1,135 @@
<?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="aCustomRoleLoad.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="aCustomRoleSave.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<metadata name="aCustomRoleGroupSetUp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="aCreateCustomRoleObjectTypes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>476, 95</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,495 @@
Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports System.IO
Imports System.Security
Imports System.Xml
Imports System.Security.Principal
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Base.Security
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Updating
Imports DevExpress.ExpressApp.Win.Editors
Imports Nuvolar.Module
Public Class CustomRoleEditorVC
Inherits DevExpress.ExpressApp.ViewController(Of ListView)
Private _GridListEditor As GridListEditor
Protected _selection As ArrayList
Protected _noselect As Boolean = False
Public Sub New()
MyBase.New()
_selection = New ArrayList()
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
''____________Továbbgondolásig letíltva!__________________________>>>>
'Frame.GetController(Of CustomRoleEditorVC).aCustomRoleSave.Active.SetItemValue("", False)
''____________Továbbgondolásig letíltva!__________________________<<<
If View.Id = "PermissionMatrix_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
AddHandler View.SelectionChanged, AddressOf PermissionMatrix_selection_changed
End If
'// Permission matrix beállítása Modelbõl
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "PermissionMatrix_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
RemoveHandler View.SelectionChanged, AddressOf PermissionMatrix_selection_changed
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
'If View.Id = "PermissionMatrix_ListView" Then
' Dim _ListView As ListView = CType(View, ListView)
' _GridListEditor = TryCast(View.Editor, GridListEditor)
' If _GridListEditor IsNot Nothing Then
' _GridListEditor.AllowEdit = True
' For i As Integer = 0 To _GridListEditor.Columns.Count - 1
' If _GridListEditor.GridView.Columns(i).FieldName <> "IsCreate" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "IsRead" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "IsWrite" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "IsNavigate" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "IsDelete" Then
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
' End If
' Next i
' End If
'End If
End Sub
Sub PermissionMatrix_selection_changed(ByVal sender As Object, ByVal e As System.EventArgs)
If View Is Nothing Then Exit Sub
If View.Id = "PermissionMatrix_ListView" Then
If _noselect = False Then
_selection.Clear()
For Each _PermissionMatrix As PermissionMatrix In View.SelectedObjects
_selection.Add(_PermissionMatrix)
Next
End If
End If
End Sub
Sub CreatePermissionMatrix(ByVal ObjectSpace As Xpo.XPObjectSpace)
Dim _PermissionMatrix_Collection As XPCollection(Of PermissionMatrix) = New XPCollection(Of PermissionMatrix)(ObjectSpace.Session, CriteriaOperator.Parse("Oid=Oid"))
Dim _Role_Collection As XPCollection(Of Role) = New XPCollection(Of Role)(ObjectSpace.Session, CriteriaOperator.Parse("Oid=Oid"))
Dim _Type As Type
Dim _Role As Role
Dim _Permission As IPermission
Dim _XMLDocument As New XmlDocument
Dim _XmlNodes As Xml.XmlNodeList
Dim _XmlNode As Xml.XmlNode
Dim _XmlNode1 As Xml.XmlNode
Dim i As Long
Dim _PermissionMatrix As PermissionMatrix
Dim _OT As String
ObjectSpace.Delete(_PermissionMatrix_Collection)
For Each _Role In _Role_Collection
For Each _Permission In _Role.Permissions
_XMLDocument.LoadXml(_Permission.ToXml.ToString)
_XmlNodes = _XMLDocument.SelectNodes("IPermission")
For Each _XmlNode In _XmlNodes
i = 0
For Each _XmlNode1 In _XmlNode.SelectNodes("ParticularAccessItem")
If i = 0 Then
_PermissionMatrix = ObjectSpace.CreateObject(Of PermissionMatrix)()
_PermissionMatrix.Role = _Role
_OT = Replace(_XmlNode1.Attributes("objectType").Value.ToString, "Nuvolar.Module.", "")
_PermissionMatrix.ObjectType = _OT
End If
If _XmlNode1.Attributes("access").Value.ToString = "Create" Then
If _XmlNode1.Attributes("modifier").Value.ToString = "Allow" Then _PermissionMatrix.IsCreate = ePermissionType.Allow
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _PermissionMatrix.IsCreate = ePermissionType.Deny
End If
If _XmlNode1.Attributes("access").Value.ToString = "Read" Then
If _XmlNode1.Attributes("modifier").Value.ToString = "Allow" Then _PermissionMatrix.IsRead = ePermissionType.Allow
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _PermissionMatrix.IsRead = ePermissionType.Deny
End If
If _XmlNode1.Attributes("access").Value.ToString = "Write" Then
If _XmlNode1.Attributes("modifier").Value.ToString = "Allow" Then _PermissionMatrix.IsWrite = ePermissionType.Allow
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _PermissionMatrix.IsWrite = ePermissionType.Deny
End If
If _XmlNode1.Attributes("access").Value.ToString = "Delete" Then
If _XmlNode1.Attributes("modifier").Value.ToString = "Allow" Then _PermissionMatrix.IsDelete = ePermissionType.Allow
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _PermissionMatrix.IsDelete = ePermissionType.Deny
End If
If _XmlNode1.Attributes("access").Value.ToString = "Navigate" Then
If _XmlNode1.Attributes("modifier").Value.ToString = "Allow" Then _PermissionMatrix.IsNavigate = ePermissionType.Allow
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _PermissionMatrix.IsNavigate = ePermissionType.Deny
End If
i += 1
Next
_PermissionMatrix.Save()
Next
Next
Next
ObjectSpace.CommitChanges()
View.Refresh()
End Sub
Private Sub aCustomRoleLoad_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCustomRoleLoad.Execute
Me.CreatePermissionMatrix(View.ObjectSpace)
End Sub
Private Sub aCustomRoleSave_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCustomRoleSave.Execute
Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace
' Dim _PermissionMatrix_Collection As XPCollection(Of PermissionMatrix) = New XPCollection(Of PermissionMatrix)(_ocur.Session, CriteriaOperator.Parse("IsCreate=? AND IsDelete=? AND IsNavigate=? AND IsRead=? AND IsWrite=?", _
' ePermissionType.NotSet, ePermissionType.NotSet, ePermissionType.NotSet, ePermissionType.NotSet, ePermissionType.NotSet))
Dim _ObjectName As String = ""
Dim _PermissionMatrix_Collection As XPCollection(Of PermissionMatrix) = New XPCollection(Of PermissionMatrix)(_ocur.Session, CriteriaOperator.Parse("1=1"))
Dim _Role_Collection As XPCollection(Of Role) = New XPCollection(Of Role)(_ocur.Session, CriteriaOperator.Parse("Oid=Oid"))
Dim _PersistentPermission_Collection As XPCollection = _ocur.CreateCollection(GetType(PersistentPermission), CriteriaOperator.Parse("1=1"))
For Each _Role As Role In _Role_Collection
For Each _PermissionMatrix As PermissionMatrix In _PermissionMatrix_Collection
If _PermissionMatrix.Role Is _Role Then
Dim _PersistentPermissionXPColl As XPCollection = _ocur.CreateCollection(GetType(PersistentPermission), CriteriaOperator.Parse("Role=?", _Role))
For Each _PersistentPermission As PersistentPermission In _PersistentPermissionXPColl
If TryCast(_PersistentPermission.Permission, EditModelPermission) IsNot Nothing Then
_ObjectName = TryCast(_PersistentPermission.Permission, EditModelPermission).GetType.ToString
End If
If TryCast(_PersistentPermission.Permission, ObjectAccessPermission) IsNot Nothing Then
_ObjectName = TryCast(_PersistentPermission.Permission, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName
End If
Dim _ObjectNameArry As String() = _ObjectName.Split(New [Char]() {"."c})
If _ObjectNameArry(_ObjectNameArry.Length - 2) = "Win" Then
_ObjectName = _ObjectNameArry(_ObjectNameArry.Length - 2) & "." & _ObjectNameArry(_ObjectNameArry.Length - 1)
End If
If _ObjectName <> _PermissionMatrix.ObjectType And _ObjectNameArry(_ObjectNameArry.Length - 1) <> _PermissionMatrix.ObjectType Then
If _PermissionMatrix.IsCreate <> ePermissionType.NotSet And _
_PermissionMatrix.IsDelete <> ePermissionType.NotSet And _
_PermissionMatrix.IsNavigate <> ePermissionType.NotSet And _
_PermissionMatrix.IsRead <> ePermissionType.NotSet And _
_PermissionMatrix.IsWrite <> ePermissionType.NotSet Then
Dim _ActRole As Role = _PermissionMatrix.Role
Dim _ActPersistentPermission As XPCollection = _ocur.CreateCollection(GetType(PersistentPermission), CriteriaOperator.Parse("Role=?", _PermissionMatrix.Role))
Dim _ObjectAccessPermission As New ObjectAccessPermission
_ObjectAccessPermission.ObjectType = ReflectionHelper.FindType(_PermissionMatrix.ObjectType)
Select Case _PermissionMatrix.IsRead
Case ePermissionType.Allow
_ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Allow
Case ePermissionType.Deny
_ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Deny
End Select
Select Case _PermissionMatrix.IsWrite
Case ePermissionType.Allow
_ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Allow
Case ePermissionType.Deny
_ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Deny
End Select
Select Case _PermissionMatrix.IsNavigate
Case ePermissionType.Allow
_ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Allow
Case ePermissionType.Deny
_ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Deny
End Select
Select Case _PermissionMatrix.IsDelete
Case ePermissionType.Allow
_ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Allow
Case ePermissionType.Deny
_ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Deny
End Select
Select Case _PermissionMatrix.IsCreate
Case ePermissionType.Allow
_ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Allow
Case ePermissionType.Deny
_ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Deny
End Select
_ActRole.AddPermission(_ObjectAccessPermission)
End If
End If
Next
End If
Next
Next
'Dim _ObjectName As String = ""
'Dim _Needpermission As Boolean = False
'For Each _ActRole As Role In _Role_Collection
' For Each _MatrixElement As PermissionMatrix In _PermissionMatrix_Collection
' If Equals(_ActRole, _MatrixElement.Role) Then
' If _MatrixElement.IsCreate <> ePermissionType.NotSet And _
' _MatrixElement.IsDelete <> ePermissionType.NotSet And _
' _MatrixElement.IsNavigate <> ePermissionType.NotSet And _
' _MatrixElement.IsRead <> ePermissionType.NotSet And _
' _MatrixElement.IsWrite <> ePermissionType.NotSet Then
' Dim _ObjectAccessPermission As New ObjectAccessPermission
' Dim _ActPersistentPermission As XPCollection = _ocur.CreateCollection(GetType(PersistentPermission), CriteriaOperator.Parse("Role=?", _MatrixElement.Role))
' If _ActPersistentPermission.Count > 0 Then
' For Each _PersistentPermission As PersistentPermission In _ActPersistentPermission
' If TryCast(_PersistentPermission.Permission, EditModelPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, EditModelPermission).GetType.ToString
' End If
' If TryCast(_PersistentPermission.Permission, ObjectAccessPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName
' End If
' If _ObjectName <> _MatrixElement.ObjectType Then
' _Needpermission = True
' End If
' Next
' End If
' If _Needpermission Then
' _ObjectAccessPermission.ObjectType = ReflectionHelper.FindType(_MatrixElement.ObjectType)
' Select Case _MatrixElement.IsRead
' Case ePermissionType.Allow
' _ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _MatrixElement.IsWrite
' Case ePermissionType.Allow
' _ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _MatrixElement.IsNavigate
' Case ePermissionType.Allow
' _ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _MatrixElement.IsDelete
' Case ePermissionType.Allow
' _ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _MatrixElement.IsCreate
' Case ePermissionType.Allow
' _ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Deny
' End Select
' _ActRole.AddPermission(_ObjectAccessPermission)
' _Needpermission = False
' End If
' End If
' End If
' Next
'Next
'Dim _NotExistPerimissons As New XPCollection
'For Each _PermissionMatrix As PermissionMatrix In _PermissionMatrix_Collection
' For Each _PersistentPermission As PersistentPermission In _PersistentPermission_Collection
' If TryCast(_PersistentPermission.Permission, EditModelPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, EditModelPermission).GetType.ToString
' End If
' If TryCast(_PersistentPermission.Permission, ObjectAccessPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName
' End If
' Next
'Next
'For Each _PermissionMatrix As PermissionMatrix In _PermissionMatrix_Collection
' For Each _PersistentPermission As PersistentPermission In _PersistentPermission_Collection
' If TryCast(_PersistentPermission.Permission, EditModelPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, EditModelPermission).GetType.ToString
' End If
' If TryCast(_PersistentPermission.Permission, ObjectAccessPermission) IsNot Nothing Then
' _ObjectName = TryCast(_PersistentPermission.Permission, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName
' End If
' If Not Equals(_PersistentPermission.Role, _PermissionMatrix.Role) Then
' If _PermissionMatrix.IsCreate <> ePermissionType.NotSet And _
' _PermissionMatrix.IsDelete <> ePermissionType.NotSet And _
' _PermissionMatrix.IsNavigate <> ePermissionType.NotSet And _
' _PermissionMatrix.IsRead <> ePermissionType.NotSet And _
' _PermissionMatrix.IsWrite <> ePermissionType.NotSet Then
' Dim _ObjectAccessPermission As New ObjectAccessPermission
' Dim _Role As Role = _PermissionMatrix.Role
' _ObjectAccessPermission.ObjectType = ReflectionHelper.FindType(_PermissionMatrix.ObjectType)
' Select Case _PermissionMatrix.IsRead
' Case ePermissionType.Allow
' _ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.ReadAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _PermissionMatrix.IsWrite
' Case ePermissionType.Allow
' _ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.WriteAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _PermissionMatrix.IsNavigate
' Case ePermissionType.Allow
' _ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.NavigateAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _PermissionMatrix.IsDelete
' Case ePermissionType.Allow
' _ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.DeleteAccess = ObjectAccessModifier.Deny
' End Select
' Select Case _PermissionMatrix.IsCreate
' Case ePermissionType.Allow
' _ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Allow
' Case ePermissionType.Deny
' _ObjectAccessPermission.CreateAccess = ObjectAccessModifier.Deny
' End Select
' '_Role.AddPermission(_ObjectAccessPermission)
' End If
' End If
' Next
'Next
End Sub
Private Sub aCustomRoleGroupSetUp_Cancel(sender As Object, e As System.EventArgs) Handles aCustomRoleGroupSetUp.Cancel
_noselect = False
End Sub
Private Sub aCustomRoleGroupSetUp_CustomizePopupWindowParams(sender As System.Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCustomRoleGroupSetUp.CustomizePopupWindowParams
_noselect = True
If _selection.Count > 0 Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CustomRoleGroupSetUpPopUp As CustomRoleGroupSetUpPopUp = _onew.CreateObject(Of CustomRoleGroupSetUpPopUp)()
e.View = Application.CreateDetailView(_onew, "CustomRoleGroupSetUpPopUp_DetailView", False, _CustomRoleGroupSetUpPopUp)
Else
_noselect = False
'_______________________________________TESZT MIATT____________________>>>>
Throw New Exception("*Nincs kiválasztott sor(ok)!")
'_______________________________________TESZT MIATT____________________<<<<
End If
End Sub
Private Sub aCustomRoleGroupSetUp_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCustomRoleGroupSetUp.Execute
Dim _ocur As Xpo.XPObjectSpace = e.PopupWindow.View.ObjectSpace
Dim _CustomRoleGroupSetUpPopUp As CustomRoleGroupSetUpPopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), CustomRoleGroupSetUpPopUp)
Dim _IsCreate As ePermissionType = _CustomRoleGroupSetUpPopUp.IsCreate
Dim _IsDelete As ePermissionType = _CustomRoleGroupSetUpPopUp.IsDelete
Dim _IsWrite As ePermissionType = _CustomRoleGroupSetUpPopUp.IsWrite
Dim _IsRead As ePermissionType = _CustomRoleGroupSetUpPopUp.IsRead
Dim _IsNavigate As ePermissionType = _CustomRoleGroupSetUpPopUp.IsNavigate
For Each _PermissionMatrix As PermissionMatrix In _selection
_PermissionMatrix.IsCreate = _IsCreate
_PermissionMatrix.IsDelete = _IsDelete
_PermissionMatrix.IsWrite = _IsWrite
_PermissionMatrix.IsRead = _IsRead
_PermissionMatrix.IsNavigate = _IsNavigate
_PermissionMatrix.Save()
Next
_ocur.CommitChanges()
_noselect = False
End Sub
Private Sub aCreateCustomRoleObjectTypes_CustomizePopupWindowParams(sender As System.Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateCustomRoleObjectTypes.CustomizePopupWindowParams
If View.SelectedObjects.Count > 0 Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _PermissionMatrix As PermissionMatrix = TryCast(View.SelectedObjects(0), PermissionMatrix)
Dim _CreateCustomRoleObjectTypes As CreateCustomRoleObjectTypes
Dim _FullObjectList As New ArrayList
Dim _ActobjectList As New ArrayList
Dim _CS As New CollectionSource(_onew, GetType(CreateCustomRoleObjectTypes))
' _CreateCustomRoleObjectTypes.Role = _onew.GetObject(_PermissionMatrix.Role)
Dim _PersistentPermission As XPCollection = _onew.CreateCollection(GetType(PersistentPermission), CriteriaOperator.Parse("1=1"))
For Each _Permission As PersistentPermission In _PersistentPermission
If TryCast(_Permission.Permission, ObjectAccessPermission) IsNot Nothing Then
_FullObjectList.Add(TryCast(_Permission.Permission, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName)
End If
If TryCast(_Permission.Permission, EditModelPermission) IsNot Nothing Then
_FullObjectList.Add(TryCast(_Permission.Permission, EditModelPermission).GetType.ToString)
End If
Next
For Each _Permissions As IPermission In _PermissionMatrix.Role.Permissions
If TryCast(_Permissions, ObjectAccessPermission) IsNot Nothing Then
_ActobjectList.Add(_onew.GetObject(TryCast(_Permissions, ObjectAccessPermission).AccessItemList(0).ObjectTypeInfo.FullName))
End If
If TryCast(_Permissions, EditModelPermission) IsNot Nothing Then
_ActobjectList.Add(_onew.GetObject(TryCast(_Permissions, EditModelPermission).GetType.ToString))
End If
Next
Dim _Exist As Boolean = False
For Each _s In _FullObjectList
For Each _sa In _ActobjectList
If _s = _sa Then
_Exist = True
Exit For
End If
Next
If Not _Exist Then
_CreateCustomRoleObjectTypes = _onew.CreateObject(Of CreateCustomRoleObjectTypes)()
_CreateCustomRoleObjectTypes.Role = _onew.GetObject(_PermissionMatrix.Role)
_CreateCustomRoleObjectTypes.MissingObjectType = _s
_cs.add(_CreateCustomRoleObjectTypes)
End If
_Exist = False
Next
e.View = Application.CreateListView("CreateCustomRoleObjectTypes_ListView", _CS, False)
Else
'_______________________________________TESZT MIATT____________________>>>>
Throw New Exception("*Nincs kiválasztott sor!")
'_______________________________________TESZT MIATT____________________<<<<
End If
End Sub
Private Sub aCreateCustomRoleObjectTypes_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateCustomRoleObjectTypes.Execute
If e.PopupWindow.View.SelectedObjects.Count > 0 Then
Dim _Role As Role = TryCast(View.SelectedObjects(0), PermissionMatrix).Role
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
For Each _CreateCustomRoleObjectTypes As CreateCustomRoleObjectTypes In e.PopupWindow.View.SelectedObjects
Dim _PermissionMatrix As PermissionMatrix = _ocur.CreateObject(Of PermissionMatrix)()
_PermissionMatrix.Role = _Role
_PermissionMatrix.ObjectType = _CreateCustomRoleObjectTypes.MissingObjectType
_PermissionMatrix.IsCreate = ePermissionType.NotSet
_PermissionMatrix.IsDelete = ePermissionType.NotSet
_PermissionMatrix.IsNavigate = ePermissionType.NotSet
_PermissionMatrix.IsRead = ePermissionType.NotSet
_PermissionMatrix.IsWrite = ePermissionType.NotSet
_PermissionMatrix.Save()
Next
_ocur.CommitChanges()
Else
'_______________________________________TESZT MIATT____________________>>>>
Throw New Exception("*Legalább egy sort ki kell választani!")
'_______________________________________TESZT MIATT____________________<<<<
End If
End Sub
End Class
@@ -0,0 +1,43 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions()> _
<NonPersistent()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class CreateCustomRoleObjectTypes
Inherits BaseObject
Private _Role As Role
Private _MissingObjectType As String
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
Property Role As Role
Get
Return _Role
End Get
Set(ByVal value As Role)
SetPropertyValue("Role", _Role, value)
End Set
End Property
Property MissingObjectType As String
Get
Return _MissingObjectType
End Get
Set(value As String)
SetPropertyValue("MissingObjectType", _MissingObjectType, value)
End Set
End Property
End Class
@@ -0,0 +1,70 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions()> _
<NonPersistent()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class CustomRoleGroupSetUpPopUp
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
Private _IsCreate As ePermissionType = -1
Private _IsDelete As ePermissionType = -1
Private _IsWrite As ePermissionType = -1
Private _IsRead As ePermissionType = -1
Private _IsNavigate As ePermissionType = -1
Property IsCreate As ePermissionType
Get
Return _IsCreate
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsCreate", _IsCreate, value)
End Set
End Property
Property IsDelete As ePermissionType
Get
Return _IsDelete
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsDelete", _IsDelete, value)
End Set
End Property
Property IsWrite As ePermissionType
Get
Return _IsWrite
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsWrite", _IsWrite, value)
End Set
End Property
Property IsRead As ePermissionType
Get
Return _IsRead
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsRead", _IsRead, value)
End Set
End Property
Property IsNavigate As ePermissionType
Get
Return _IsNavigate
End Get
Set(ByVal value As ePermissionType)
SetPropertyValue("IsNavigate", _IsNavigate, value)
End Set
End Property
End Class