StrataFrame Forum

How to show the RBS Deny message programmatically?

http://forum.strataframe.net/Topic18885.aspx

By Edhy Rijo - 9/1/2008

Well, it is time to get into the RBS (even without printed documents BigGrin).  I have some menu options that will call SF features like MicroFour.StrataFrame.Data.ConnectionManager.ShowAvailableConnectionStrings().

I created a Security Permission named "DatabaseConnection" and assigned a Deny action to some Users, now here is the code I am using to test the security and show the Available Connection Strings form:

Private Sub SetDatabaseConnection()

     Dim customViewSecurityKey As String = "DatabaseConnection"

     If SecurityBasics.CurrentUser.GetPermission(customViewSecurityKey).Action = PermissionAction.Deny Then

          '-- Establish locals

          Dim loEventArgs As CheckSecurityEventArgs

          '-- Create the event args

          loEventArgs = New CheckSecurityEventArgs(customViewSecurityKey)

          '-- Raise the denied event

          Me.OnSecurityDenied(New SecurityDeniedEventArgs(customViewSecurityKey, loEventArgs.PermissionInfo), True)

          Exit Sub

     End If

     '-- Show the connection dialog and allow a connection to be selected

     If MicroFour.StrataFrame.Data.ConnectionManager.ShowAvailableConnectionStrings() Then

          '-- Since a connection was selected, then all of the existing dialogs need to be closed

          ' since their connection is established to the original source.

          For Each loForm As Form In Me.MdiChildren

               loForm.Close()

               loForm.Dispose()

          Next

          '-- Force the connections to be reset

          MicroFour.StrataFrame.Data.ConnectionManager.SetConnections()

     End If

End Sub

I got part of the code that deals with Me.OnSecurityDeny from the SF BaseForm class.  This code is working fine, but I wonder this:

  1. Am I using this code correctly to show the Deny message?
  2. Or should I just simply be calling the Me.ShowMessageByKey(customViewSecurityKey)?
  3. Or is there a method somewhere that will accept the customViewSecurityKey and show the Deny Message form?

 

By Dustin Taylor - 9/2/2008

Howdy Smile

You are typically going to use ShowMessageByKey to show a custom security denied message if you are setting up your permissions with a "Message Key" denied action message, otherwise, you would just do a ShowMessage() with the message text.

Either way, you can get the message key or the message text via SecurityBasics.CurrentUser.GetPermission("YourKey").BlockedMessageOrKey

Hope it helps!

By Edhy Rijo - 9/2/2008

Hi Dustin,

Thanks for the clarification.