First create solution
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
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(), NavigationItem(False), CreatableItem(False)> _
|
||||
Public Class ModelActionRole
|
||||
Inherits BaseObject
|
||||
|
||||
Private _Action_ID As String
|
||||
Private _Action_Controller As String
|
||||
Private _Role As Role
|
||||
|
||||
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
|
||||
|
||||
<Size(255)> _
|
||||
Property Action_ID As String
|
||||
Get
|
||||
Return _Action_ID
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("Action_ID", _Action_ID, value)
|
||||
End Set
|
||||
End Property
|
||||
<Size(255)> _
|
||||
Property Action_Controller As String
|
||||
Get
|
||||
Return _Action_Controller
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("Action_Controller", _Action_Controller, value)
|
||||
End Set
|
||||
End Property
|
||||
Property Role As Role
|
||||
Get
|
||||
Return _Role
|
||||
End Get
|
||||
Set(value As Role)
|
||||
SetPropertyValue("Role", _Role, value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,57 @@
|
||||
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
|
||||
Imports System.Drawing
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
|
||||
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), NonPersistent()> _
|
||||
Public Class ModelActions
|
||||
Inherits BaseObject
|
||||
|
||||
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.
|
||||
Action_Enabled = True
|
||||
End Sub
|
||||
|
||||
Property Action_ID As String
|
||||
Property Action_ImageName As String
|
||||
Property Action_Controller As String
|
||||
Property Action_Caption As String
|
||||
Property Action_SISGroup1 As String
|
||||
Property Action_SISGroup2 As String
|
||||
<Browsable(False)> Property Action_Enabled As Boolean
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property Image1 As Image
|
||||
Get
|
||||
Return ImageLoader.Instance.GetImageInfo(Action_ImageName).Image
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property Action_Enabled_Image As Image
|
||||
Get
|
||||
If Action_Enabled Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,106 @@
|
||||
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
|
||||
Imports System.Drawing
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
|
||||
<DefaultClassOptions(), NonPersistent(), NavigationItem(False), CreatableItem(False)> _
|
||||
Public Class ModelBOModel
|
||||
Inherits BaseObject
|
||||
|
||||
|
||||
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.
|
||||
BOModel_Create = True
|
||||
BOModel_Read = True
|
||||
BOModel_Write = True
|
||||
BOModel_Delete = True
|
||||
BOModel_Navigate = True
|
||||
End Sub
|
||||
|
||||
Property BOModel_ID As String
|
||||
Property BOModel_ImageName As String
|
||||
Property BOModel_Caption As String
|
||||
Property BOModel_SISGroup1 As String
|
||||
Property BOModel_SISGroup2 As String
|
||||
Property BOModel_IsPopup As Boolean
|
||||
Property BOModel_NonPersistent As Boolean
|
||||
<Browsable(False)> Property BOModel_Create As Boolean
|
||||
<Browsable(False)> Property BOModel_Read As Boolean
|
||||
<Browsable(False)> Property BOModel_Write As Boolean
|
||||
<Browsable(False)> Property BOModel_Delete As Boolean
|
||||
<Browsable(False)> Property BOModel_Navigate As Boolean
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property Image1 As Image
|
||||
Get
|
||||
Return ImageLoader.Instance.GetImageInfo(BOModel_ImageName).Image
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property BOModel_Create_Image As Image
|
||||
Get
|
||||
If BOModel_Create Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property BOModel_Read_Image As Image
|
||||
Get
|
||||
If BOModel_Read Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property BOModel_Write_Image As Image
|
||||
Get
|
||||
If BOModel_Write Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property BOModel_Delete_Image As Image
|
||||
Get
|
||||
If BOModel_Delete Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property BOModel_Navigate_Image As Image
|
||||
Get
|
||||
If BOModel_Navigate Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
@@ -0,0 +1,53 @@
|
||||
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
|
||||
Imports System.Drawing
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
|
||||
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DeferredDeletion(False)> _
|
||||
Public Class ModelNavigation
|
||||
Inherits HCategory
|
||||
|
||||
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
|
||||
|
||||
<Browsable(False)> Property MasterKey As Guid
|
||||
Property Navigation_Caption As String
|
||||
<Browsable(False)> Property Navigation_ImageName As String
|
||||
Property Navigation_Enabled As Boolean = True
|
||||
<Browsable(False)> Property Index As Long
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property Image1 As Image
|
||||
Get
|
||||
Return ImageLoader.Instance.GetImageInfo(Navigation_ImageName).Image
|
||||
End Get
|
||||
End Property
|
||||
<VisibleInDetailView(False)> _
|
||||
ReadOnly Property ImageDeny As Image
|
||||
Get
|
||||
If Navigation_Enabled Then
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
|
||||
Else
|
||||
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
@@ -0,0 +1,207 @@
|
||||
Partial Class RolesModelSecurity
|
||||
|
||||
<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.aRoleActionEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleNavigationEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleNavigationDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleActionDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleNavigationView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
Me.aRoleBOModelEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleBOModelView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
Me.aRoleBOModelDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aRoleActionView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
'
|
||||
'aRoleActionEnable
|
||||
'
|
||||
Me.aRoleActionEnable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleActionEnable.CancelButtonCaption = Nothing
|
||||
Me.aRoleActionEnable.Caption = "aRole Action Enable"
|
||||
Me.aRoleActionEnable.Category = "Save"
|
||||
Me.aRoleActionEnable.ConfirmationMessage = Nothing
|
||||
Me.aRoleActionEnable.Id = "aRoleActionEnable"
|
||||
Me.aRoleActionEnable.ImageName = Nothing
|
||||
Me.aRoleActionEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleActionEnable.Shortcut = Nothing
|
||||
Me.aRoleActionEnable.Tag = Nothing
|
||||
Me.aRoleActionEnable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleActionEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleActionEnable.TargetViewId = Nothing
|
||||
Me.aRoleActionEnable.ToolTip = Nothing
|
||||
Me.aRoleActionEnable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleNavigationEnable
|
||||
'
|
||||
Me.aRoleNavigationEnable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleNavigationEnable.CancelButtonCaption = Nothing
|
||||
Me.aRoleNavigationEnable.Caption = "aRole Navigation Enable"
|
||||
Me.aRoleNavigationEnable.Category = "Save"
|
||||
Me.aRoleNavigationEnable.ConfirmationMessage = Nothing
|
||||
Me.aRoleNavigationEnable.Id = "aRoleNavigationEnable"
|
||||
Me.aRoleNavigationEnable.ImageName = Nothing
|
||||
Me.aRoleNavigationEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleNavigationEnable.Shortcut = Nothing
|
||||
Me.aRoleNavigationEnable.Tag = Nothing
|
||||
Me.aRoleNavigationEnable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleNavigationEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleNavigationEnable.TargetViewId = Nothing
|
||||
Me.aRoleNavigationEnable.ToolTip = Nothing
|
||||
Me.aRoleNavigationEnable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleNavigationDisable
|
||||
'
|
||||
Me.aRoleNavigationDisable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleNavigationDisable.CancelButtonCaption = Nothing
|
||||
Me.aRoleNavigationDisable.Caption = "aRole Navigation Disable"
|
||||
Me.aRoleNavigationDisable.Category = "Save"
|
||||
Me.aRoleNavigationDisable.ConfirmationMessage = Nothing
|
||||
Me.aRoleNavigationDisable.Id = "aRoleNavigationDisable"
|
||||
Me.aRoleNavigationDisable.ImageName = Nothing
|
||||
Me.aRoleNavigationDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleNavigationDisable.Shortcut = Nothing
|
||||
Me.aRoleNavigationDisable.Tag = Nothing
|
||||
Me.aRoleNavigationDisable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleNavigationDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleNavigationDisable.TargetViewId = Nothing
|
||||
Me.aRoleNavigationDisable.ToolTip = Nothing
|
||||
Me.aRoleNavigationDisable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleActionDisable
|
||||
'
|
||||
Me.aRoleActionDisable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleActionDisable.CancelButtonCaption = Nothing
|
||||
Me.aRoleActionDisable.Caption = "aRole Action Disable"
|
||||
Me.aRoleActionDisable.Category = "Save"
|
||||
Me.aRoleActionDisable.ConfirmationMessage = Nothing
|
||||
Me.aRoleActionDisable.Id = "aRoleActionDisable"
|
||||
Me.aRoleActionDisable.ImageName = Nothing
|
||||
Me.aRoleActionDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleActionDisable.Shortcut = Nothing
|
||||
Me.aRoleActionDisable.Tag = Nothing
|
||||
Me.aRoleActionDisable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleActionDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleActionDisable.TargetViewId = Nothing
|
||||
Me.aRoleActionDisable.ToolTip = Nothing
|
||||
Me.aRoleActionDisable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleNavigationView
|
||||
'
|
||||
Me.aRoleNavigationView.Caption = "aRole Navigation View"
|
||||
Me.aRoleNavigationView.Category = "View"
|
||||
Me.aRoleNavigationView.ConfirmationMessage = Nothing
|
||||
Me.aRoleNavigationView.Id = "aRoleNavigationView"
|
||||
Me.aRoleNavigationView.ImageName = Nothing
|
||||
Me.aRoleNavigationView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aRoleNavigationView.Shortcut = Nothing
|
||||
Me.aRoleNavigationView.Tag = Nothing
|
||||
Me.aRoleNavigationView.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleNavigationView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleNavigationView.TargetViewId = Nothing
|
||||
Me.aRoleNavigationView.ToolTip = Nothing
|
||||
Me.aRoleNavigationView.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleBOModelEnable
|
||||
'
|
||||
Me.aRoleBOModelEnable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleBOModelEnable.CancelButtonCaption = Nothing
|
||||
Me.aRoleBOModelEnable.Caption = "aRole BOModel Enable"
|
||||
Me.aRoleBOModelEnable.Category = "Save"
|
||||
Me.aRoleBOModelEnable.ConfirmationMessage = Nothing
|
||||
Me.aRoleBOModelEnable.Id = "aRoleBOModelEnable"
|
||||
Me.aRoleBOModelEnable.ImageName = Nothing
|
||||
Me.aRoleBOModelEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleBOModelEnable.Shortcut = Nothing
|
||||
Me.aRoleBOModelEnable.Tag = Nothing
|
||||
Me.aRoleBOModelEnable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleBOModelEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleBOModelEnable.TargetViewId = Nothing
|
||||
Me.aRoleBOModelEnable.ToolTip = Nothing
|
||||
Me.aRoleBOModelEnable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleBOModelView
|
||||
'
|
||||
Me.aRoleBOModelView.Caption = "aRole BOModel View"
|
||||
Me.aRoleBOModelView.Category = "View"
|
||||
Me.aRoleBOModelView.ConfirmationMessage = Nothing
|
||||
Me.aRoleBOModelView.Id = "aRoleBOModelView"
|
||||
Me.aRoleBOModelView.ImageName = Nothing
|
||||
Me.aRoleBOModelView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aRoleBOModelView.Shortcut = Nothing
|
||||
Me.aRoleBOModelView.Tag = Nothing
|
||||
Me.aRoleBOModelView.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleBOModelView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleBOModelView.TargetViewId = Nothing
|
||||
Me.aRoleBOModelView.ToolTip = Nothing
|
||||
Me.aRoleBOModelView.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleBOModelDisable
|
||||
'
|
||||
Me.aRoleBOModelDisable.AcceptButtonCaption = Nothing
|
||||
Me.aRoleBOModelDisable.CancelButtonCaption = Nothing
|
||||
Me.aRoleBOModelDisable.Caption = "aRole BOModel Disable"
|
||||
Me.aRoleBOModelDisable.Category = "Save"
|
||||
Me.aRoleBOModelDisable.ConfirmationMessage = Nothing
|
||||
Me.aRoleBOModelDisable.Id = "aRoleBOModelDisable"
|
||||
Me.aRoleBOModelDisable.ImageName = Nothing
|
||||
Me.aRoleBOModelDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
|
||||
Me.aRoleBOModelDisable.Shortcut = Nothing
|
||||
Me.aRoleBOModelDisable.Tag = Nothing
|
||||
Me.aRoleBOModelDisable.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleBOModelDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleBOModelDisable.TargetViewId = Nothing
|
||||
Me.aRoleBOModelDisable.ToolTip = Nothing
|
||||
Me.aRoleBOModelDisable.TypeOfView = Nothing
|
||||
'
|
||||
'aRoleActionView
|
||||
'
|
||||
Me.aRoleActionView.Caption = "aRole Action View"
|
||||
Me.aRoleActionView.Category = "View"
|
||||
Me.aRoleActionView.ConfirmationMessage = Nothing
|
||||
Me.aRoleActionView.Id = "aRoleActionView"
|
||||
Me.aRoleActionView.ImageName = Nothing
|
||||
Me.aRoleActionView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aRoleActionView.Shortcut = Nothing
|
||||
Me.aRoleActionView.Tag = Nothing
|
||||
Me.aRoleActionView.TargetObjectsCriteria = Nothing
|
||||
Me.aRoleActionView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
|
||||
Me.aRoleActionView.TargetViewId = Nothing
|
||||
Me.aRoleActionView.ToolTip = Nothing
|
||||
Me.aRoleActionView.TypeOfView = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aRoleActionEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleNavigationEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleNavigationDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleActionDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleNavigationView As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
Friend WithEvents aRoleBOModelEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleBOModelView As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
Friend WithEvents aRoleBOModelDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aRoleActionView As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,150 @@
|
||||
<?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="aRoleActionEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 329</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleNavigationEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 290</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleNavigationDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 251</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleActionDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 212</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleNavigationView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 173</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleBOModelEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 134</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleBOModelView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 95</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleBOModelDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 56</value>
|
||||
</metadata>
|
||||
<metadata name="aRoleActionView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>190, 56</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,498 @@
|
||||
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.Data.Filtering
|
||||
Imports DevExpress.ExpressApp.Model
|
||||
Imports DevExpress.ExpressApp.SystemModule
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.Xpo
|
||||
Imports System.IO
|
||||
Imports System.Security
|
||||
Imports System.Xml
|
||||
Imports System.Security.Principal
|
||||
Imports DevExpress.Persistent.Base.Security
|
||||
Imports DevExpress.ExpressApp.Security
|
||||
Imports DevExpress.ExpressApp.Updating
|
||||
|
||||
Public Class RolesModelSecurity
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Component Designer.
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
|
||||
End Sub
|
||||
Protected Overrides Sub OnFrameAssigned()
|
||||
MyBase.OnFrameAssigned()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnActivated()
|
||||
MyBase.OnActivated()
|
||||
'// Ideiglenes tiltás
|
||||
'Frame.GetController(Of RolesModelSecurity).aRoleActionDisable.Active.SetItemValue("", False)
|
||||
'Frame.GetController(Of RolesModelSecurity).aRoleActionEnable.Active.SetItemValue("", False)
|
||||
Frame.GetController(Of RolesModelSecurity).aRoleBOModelDisable.Active.SetItemValue("", False)
|
||||
Frame.GetController(Of RolesModelSecurity).aRoleBOModelEnable.Active.SetItemValue("", False)
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _LoggedUser As User = TryCast(SecuritySystem.CurrentUser, User)
|
||||
If _LoggedUser IsNot Nothing Then
|
||||
For Each _Role As Role In _LoggedUser.Roles
|
||||
Dim _ModelActionRole_Collection As New XPCollection(Of ModelActionRole)(_ocur.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
|
||||
|
||||
For Each _ModelActionRole As ModelActionRole In _ModelActionRole_Collection
|
||||
For Each _Controller As Controller In Frame.Controllers
|
||||
If Replace(_Controller.Name, ".Win", "") = _ModelActionRole.Action_Controller Then
|
||||
For Each _Action As ActionBase In _Controller.Actions
|
||||
If _Action.Id = _ModelActionRole.Action_ID Then
|
||||
_Action.Active.SetItemValue("NuvolarSecurity", False)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
If Replace(_Controller.Name, ".Web", "") = _ModelActionRole.Action_Controller Then
|
||||
For Each _Action As ActionBase In _Controller.Actions
|
||||
If _Action.Id = _ModelActionRole.Action_ID Then
|
||||
_Action.Active.SetItemValue("NuvolarSecurity", False)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleActionEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleActionEnable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
|
||||
Dim _ModelActions As ModelActions
|
||||
Dim _Action As IModelAction
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
If _Role IsNot Nothing Then
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
|
||||
_CS.EndUpdateCriteria()
|
||||
|
||||
For Each _Action In Application.Model.ActionDesign.Actions
|
||||
If _Action.Controller.Name Like "SIS*" Then
|
||||
_ModelActions = _onew.CreateObject(Of ModelActions)()
|
||||
_ModelActions.Action_ID = _Action.Id
|
||||
_ModelActions.Action_Caption = _Action.Caption
|
||||
_ModelActions.Action_ImageName = _Action.ImageName
|
||||
_ModelActions.Action_Controller = _Action.Controller.Name
|
||||
|
||||
Dim _ModelActionRole As ModelActionRole = _onew.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
|
||||
_ModelActions.Action_ID, _ModelActions.Action_Controller, _onew.GetObject(_Role)))
|
||||
If _ModelActionRole IsNot Nothing Then
|
||||
_ModelActions.Action_Enabled = False
|
||||
Else
|
||||
_ModelActions.Action_Enabled = True
|
||||
End If
|
||||
|
||||
_CS.Add(_ModelActions)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
e.View = Application.CreateListView("ModelActions_ListView", _CS, False)
|
||||
End Sub
|
||||
Private Sub aRoleActionEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleActionEnable.Execute
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
If _Role IsNot Nothing Then
|
||||
For Each _ModelActions As ModelActions In e.PopupWindow.View.SelectedObjects
|
||||
Dim _ModelActionRole As ModelActionRole = _ocur.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
|
||||
_ModelActions.Action_ID, _ModelActions.Action_Controller, _Role))
|
||||
If _ModelActionRole IsNot Nothing Then
|
||||
_ocur.Delete(_ModelActionRole)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
_ocur.CommitChanges()
|
||||
End Sub
|
||||
Private Sub aRoleActionView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleActionView.Execute
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
|
||||
Dim _ModelActions As ModelActions
|
||||
Dim _Action As IModelAction
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
|
||||
_CS.EndUpdateCriteria()
|
||||
|
||||
For Each _Action In Application.Model.ActionDesign.Actions
|
||||
If _Action.Controller.Name Like "SIS*" Then
|
||||
_ModelActions = _onew.CreateObject(Of ModelActions)()
|
||||
_ModelActions.Action_ID = _Action.Id
|
||||
_ModelActions.Action_Caption = _Action.Caption
|
||||
_ModelActions.Action_ImageName = _Action.ImageName
|
||||
_ModelActions.Action_Controller = _Action.Controller.Name
|
||||
|
||||
_ModelActions.Action_SISGroup1 = TryCast(_Action, IModelActionExtender).SISGroup1
|
||||
_ModelActions.Action_SISGroup2 = TryCast(_Action, IModelActionExtender).SISGroup2
|
||||
|
||||
_CS.Add(_ModelActions)
|
||||
End If
|
||||
Next
|
||||
|
||||
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelActions_ListView", _CS, True)
|
||||
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleNavigationEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleNavigationEnable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
||||
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
|
||||
|
||||
Select Case GLOBAL_SQLType
|
||||
Case eSQLType.PostgreSQL
|
||||
_onew.Session.ExecuteNonQuery("delete from ""ModelNavigation"" where ""MasterKey""='" & _MasterKey.ToString & "'")
|
||||
_onew.CommitChanges()
|
||||
Case Else
|
||||
_onew.Session.ExecuteNonQuery("delete from ModelNavigation where MasterKey='" & _MasterKey.ToString & "'")
|
||||
_onew.CommitChanges()
|
||||
End Select
|
||||
|
||||
If View.SelectedObjects.Count = 1 Then
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
If _Role IsNot Nothing Then
|
||||
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
|
||||
Dim _IModelNavigationItems As IModelNavigationItems
|
||||
Dim _IModelNavigationItem As IModelNavigationItem
|
||||
|
||||
Dim _NavigationItems As IModelRootNavigationItems = DirectCast(Application.Model, IModelApplicationNavigationItems).NavigationItems
|
||||
_IModelNavigationItems = TryCast(_NavigationItems.Items, IModelNavigationItems)
|
||||
For Each _IModelNavigationItem In _IModelNavigationItems
|
||||
RecursiveAddModelNavigation(_uow, _MasterKey, Nothing, _IModelNavigationItem)
|
||||
Next
|
||||
_uow.CommitChanges()
|
||||
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
|
||||
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("MasterKey=?", _MasterKey))
|
||||
_CS.EndUpdateCriteria()
|
||||
_CS.Sorting.Add(New SortProperty("Index", DB.SortingDirection.Ascending))
|
||||
|
||||
For Each _ModelNavigation In _CS.Collection
|
||||
For Each _NavigationItemRole In _NavigationItemRole_Collection
|
||||
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
|
||||
RecursiveDeny(_ModelNavigation)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
e.View = Application.CreateListView("ModelNavigation_ListView", _CS, False)
|
||||
If _Role IsNot Nothing Then
|
||||
e.View.Caption += " (" & _Role.Name & ")"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aRoleNavigationEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleNavigationEnable.Execute
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
Dim _ocur As IObjectSpace = View.ObjectSpace
|
||||
|
||||
Dim _Role As Role
|
||||
|
||||
For Each _Role In View.SelectedObjects
|
||||
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
|
||||
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("Role.Oid=? and ChoiceActionItemId=?", _Role.Oid, _ModelNavigation.Name))
|
||||
If _NavigationItemRole IsNot Nothing Then
|
||||
_ocur.Delete(_NavigationItemRole)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleNavigationDisable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleNavigationDisable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
||||
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
|
||||
|
||||
|
||||
Select Case GLOBAL_SQLType
|
||||
Case eSQLType.PostgreSQL
|
||||
_onew.Session.ExecuteNonQuery("delete from ""ModelNavigation"" where ""MasterKey""='" & _MasterKey.ToString & "'")
|
||||
_onew.CommitChanges()
|
||||
Case Else
|
||||
_onew.Session.ExecuteNonQuery("delete from ModelNavigation where MasterKey='" & _MasterKey.ToString & "'")
|
||||
_onew.CommitChanges()
|
||||
End Select
|
||||
|
||||
If View.SelectedObjects.Count = 1 Then
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
If _Role IsNot Nothing Then
|
||||
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
|
||||
Dim _IModelNavigationItems As IModelNavigationItems
|
||||
Dim _IModelNavigationItem As IModelNavigationItem
|
||||
|
||||
Dim _NavigationItems As IModelRootNavigationItems = DirectCast(Application.Model, IModelApplicationNavigationItems).NavigationItems
|
||||
_IModelNavigationItems = TryCast(_NavigationItems.Items, IModelNavigationItems)
|
||||
For Each _IModelNavigationItem In _IModelNavigationItems
|
||||
RecursiveAddModelNavigation(_uow, _MasterKey, Nothing, _IModelNavigationItem)
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
|
||||
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("MasterKey=?", _MasterKey))
|
||||
_CS.EndUpdateCriteria()
|
||||
_CS.Sorting.Add(New SortProperty("Index", DB.SortingDirection.Ascending))
|
||||
|
||||
For Each _ModelNavigation In _CS.Collection
|
||||
For Each _NavigationItemRole In _NavigationItemRole_Collection
|
||||
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
|
||||
RecursiveDeny(_ModelNavigation)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
e.View = Application.CreateListView("ModelNavigation_ListView", _CS, False)
|
||||
If _Role IsNot Nothing Then
|
||||
e.View.Caption += " (" & _Role.Name & ")"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub aRoleNavigationDisable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleNavigationDisable.Execute
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
Dim _ocur As IObjectSpace = View.ObjectSpace
|
||||
|
||||
Dim _Role As Role
|
||||
|
||||
For Each _Role In View.SelectedObjects
|
||||
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
|
||||
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("Role.Oid=? and ChoiceActionItemId=?", _Role.Oid, _ModelNavigation.Name))
|
||||
If _NavigationItemRole Is Nothing Then
|
||||
_NavigationItemRole = _ocur.CreateObject(Of NavigationItemRole)()
|
||||
_NavigationItemRole.Role = _ocur.GetObject(_Role)
|
||||
_NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleNavigationView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleNavigationView.Execute
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
|
||||
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
|
||||
For Each _ModelNavigation In _CS.Collection
|
||||
For Each _NavigationItemRole In _NavigationItemRole_Collection
|
||||
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
|
||||
RecursiveDeny(_ModelNavigation)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelNavigation_ListView", _CS, True)
|
||||
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleBOModelEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleBOModelEnable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelBOModel))
|
||||
Dim _ModelBOModel As ModelBOModel
|
||||
Dim _IModelClass As IModelClass
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
|
||||
_CS.EndUpdateCriteria()
|
||||
|
||||
For Each _IModelClass In Application.Model.BOModel
|
||||
If _IModelClass.Name Like "SIS*" Then
|
||||
_ModelBOModel = _onew.CreateObject(Of ModelBOModel)()
|
||||
_ModelBOModel.BOModel_ID = _IModelClass.Name
|
||||
_ModelBOModel.BOModel_Caption = _IModelClass.Caption
|
||||
_ModelBOModel.BOModel_ImageName = _IModelClass.ImageName
|
||||
_ModelBOModel.BOModel_SISGroup1 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup1
|
||||
_ModelBOModel.BOModel_SISGroup2 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup2
|
||||
_ModelBOModel.BOModel_NonPersistent = TryCast(_IModelClass, IModelClassAllowSort).NonPersistent
|
||||
_ModelBOModel.BOModel_IsPopup = TryCast(_IModelClass, IModelClassAllowSort).IsPopup
|
||||
_CS.Add(_ModelBOModel)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
e.View = Application.CreateListView("ModelBOModel_ListView", _CS, False)
|
||||
End Sub
|
||||
Private Sub aRoleBOModelEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleBOModelEnable.Execute
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub aRoleBOModelView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleBOModelView.Execute
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelBOModel))
|
||||
Dim _ModelBOModel As ModelBOModel
|
||||
Dim _IModelClass As IModelClass
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), 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 = 0
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
|
||||
_CS.EndUpdateCriteria()
|
||||
|
||||
For Each _IModelClass In Application.Model.BOModel
|
||||
If _IModelClass.Name Like "SIS*" Then
|
||||
_ModelBOModel = _onew.CreateObject(Of ModelBOModel)()
|
||||
_ModelBOModel.BOModel_ID = _IModelClass.Name
|
||||
_ModelBOModel.BOModel_Caption = _IModelClass.Caption
|
||||
_ModelBOModel.BOModel_ImageName = _IModelClass.ImageName
|
||||
_ModelBOModel.BOModel_SISGroup1 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup1
|
||||
_ModelBOModel.BOModel_SISGroup2 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup2
|
||||
_ModelBOModel.BOModel_NonPersistent = TryCast(_IModelClass, IModelClassAllowSort).NonPersistent
|
||||
_ModelBOModel.BOModel_IsPopup = TryCast(_IModelClass, IModelClassAllowSort).IsPopup
|
||||
_CS.Add(_ModelBOModel)
|
||||
End If
|
||||
Next
|
||||
'// For Each _Permission In _Role.Permissions
|
||||
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")
|
||||
For Each _ModelBOModel In _CS.List
|
||||
If _ModelBOModel.BOModel_ID = _XmlNode1.Attributes("objectType").Value.ToString Then
|
||||
Select Case _XmlNode1.Attributes("access").Value.ToString
|
||||
Case "Create"
|
||||
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Create = False
|
||||
Case "Read"
|
||||
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Read = False
|
||||
Case "Write"
|
||||
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Write = False
|
||||
Case "Delete"
|
||||
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Delete = False
|
||||
Case "Navigate"
|
||||
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Navigate = False
|
||||
End Select
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelBOModel_ListView", _CS, True)
|
||||
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
|
||||
End Sub
|
||||
|
||||
Sub RecursiveAddModelNavigation(_uow As UnitOfWork, _MasterKey As Guid, _ModelNavigationParent As ModelNavigation, _IModelNavigationItem As IModelNavigationItem)
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
Dim _IModelNavigationItem_Child As IModelNavigationItem
|
||||
|
||||
_ModelNavigation = New ModelNavigation(_uow)
|
||||
|
||||
_ModelNavigation.Parent = _ModelNavigationParent
|
||||
_ModelNavigation.Name = _IModelNavigationItem.Id
|
||||
_ModelNavigation.Navigation_Caption = _IModelNavigationItem.Caption
|
||||
_ModelNavigation.Navigation_ImageName = _IModelNavigationItem.ImageName
|
||||
_ModelNavigation.MasterKey = _MasterKey
|
||||
'If _IModelNavigationItem.Index IsNot Nothing Then
|
||||
' _ModelNavigation.Index = CLng(_IModelNavigationItem.Index)
|
||||
'Else
|
||||
|
||||
'End If
|
||||
|
||||
|
||||
_uow.CommitChanges()
|
||||
|
||||
If _IModelNavigationItem.Items.Count > 0 Then
|
||||
For Each _IModelNavigationItem_Child In _IModelNavigationItem.Items
|
||||
RecursiveAddModelNavigation(_uow, _MasterKey, _ModelNavigation, _IModelNavigationItem_Child)
|
||||
Next
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Sub RecursiveDeny(_ModelNavigation As ModelNavigation)
|
||||
Dim _ModelNavigation_Children As ModelNavigation
|
||||
_ModelNavigation.Navigation_Enabled = False
|
||||
If _ModelNavigation.Children.Count > 0 Then
|
||||
For Each _ModelNavigation_Children In _ModelNavigation.Children
|
||||
RecursiveDeny(_ModelNavigation_Children)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aRoleActionDisable_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aRoleActionDisable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
|
||||
Dim _ModelActions As ModelActions
|
||||
Dim _Action As IModelAction
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
_CS.BeginUpdateCriteria()
|
||||
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
|
||||
_CS.EndUpdateCriteria()
|
||||
|
||||
For Each _Action In Application.Model.ActionDesign.Actions
|
||||
If _Action.Controller.Name Like "SIS*" Then
|
||||
_ModelActions = _onew.CreateObject(Of ModelActions)()
|
||||
_ModelActions.Action_ID = _Action.Id
|
||||
_ModelActions.Action_Caption = _Action.Caption
|
||||
_ModelActions.Action_ImageName = _Action.ImageName
|
||||
_ModelActions.Action_Controller = _Action.Controller.Name
|
||||
|
||||
Dim _ModelActionRole As ModelActionRole = _onew.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
|
||||
_ModelActions.Action_ID, _ModelActions.Action_Controller, _onew.GetObject(_Role)))
|
||||
If _ModelActionRole IsNot Nothing Then
|
||||
_ModelActions.Action_Enabled = False
|
||||
Else
|
||||
_ModelActions.Action_Enabled = True
|
||||
End If
|
||||
|
||||
_CS.Add(_ModelActions)
|
||||
End If
|
||||
Next
|
||||
|
||||
e.View = Application.CreateListView("ModelActions_ListView", _CS, False)
|
||||
End Sub
|
||||
Private Sub aRoleActionDisable_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aRoleActionDisable.Execute
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
|
||||
If _Role IsNot Nothing Then
|
||||
For Each _ModelActions As ModelActions In e.PopupWindow.View.SelectedObjects
|
||||
Dim _ModelActionRole As ModelActionRole = _ocur.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
|
||||
_ModelActions.Action_ID, _ModelActions.Action_Controller, _Role))
|
||||
If _ModelActionRole Is Nothing Then
|
||||
_ModelActionRole = New ModelActionRole(_ocur.Session)
|
||||
With _ModelActionRole
|
||||
.Role = _Role
|
||||
.Action_Controller = _ModelActions.Action_Controller
|
||||
.Action_ID = _ModelActions.Action_ID
|
||||
End With
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
_ocur.CommitChanges()
|
||||
End Sub
|
||||
End Class
|
||||
@@ -0,0 +1,36 @@
|
||||
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
|
||||
Imports DevExpress.Persistent.Base.Security
|
||||
Imports DevExpress.Utils
|
||||
|
||||
<DefaultClassOptions()> _
|
||||
Public Class SecuritySystemHelper
|
||||
Public Shared Function IsUserInRole(ByVal userWithRoles As IUserWithRoles, ByVal roleName As String) As Boolean
|
||||
'Guard.ArgumentNotNull(userWithRoles, "userWithRoles")
|
||||
If userWithRoles Is Nothing Then Return True
|
||||
For Each role As IRole In userWithRoles.Roles
|
||||
If role.Name = roleName Then
|
||||
Return True
|
||||
End If
|
||||
Next role
|
||||
Return False
|
||||
End Function
|
||||
Public Shared Function IsUserInRoleCurrentUser(ByVal roleName As String) As Boolean
|
||||
Return IsUserInRole(TryCast(SecuritySystem.CurrentUser, IUserWithRoles), roleName)
|
||||
End Function
|
||||
Public Shared Function IsUserInRole(ByVal roleName As String, ByVal user As User) As Boolean
|
||||
Return IsUserInRole(TryCast(user, IUserWithRoles), roleName)
|
||||
End Function
|
||||
Public Shared Function IsUserAdministrator(ByVal simpleUser As ISimpleUser) As Boolean
|
||||
Guard.ArgumentNotNull(simpleUser, "simpleUser")
|
||||
Return simpleUser.IsAdministrator
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user