StrataFrame Forum

Copy Role Error

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

By jsantos - 2/11/2015

Hello, 

We have an issue where a user is trying to copy a role via the Role Based Security Editor. There is no error if they try and edit an existing role and try to change the Default Action.

Any ideas? Any help is much appreciated. 

Steps to Reproduce

  • Right click on a role in Security Editor, and select Copy Role
  • Click the radio button 'Create new Role' and press OK. 
  • Give the role a name (don't think this matters)
  • click on the 'Permissions' tab.
  • Select an item
  • Under the 'Default Action' drop down, choose anything and and receive an error.
"BusinessLayerException
  The CurrentRow for table '[dbo].[SFSPermissions]' could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 0.  CurrentRowIndex: -1.

Source     : MicroFour StrataFrame Business

Stack Trace: 
   at MicroFour.StrataFrame.Business.BusinessLayer.get_CurrentRow()
   at MicroFour.StrataFrame.Security.RoleEditor.SaveData(TreeNode Node, SetDataPiece SetPiece)
   at MicroFour.StrataFrame.Security.RoleEditor.cboAction_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ComboBox.WndProc(Message& m)
   at MicroFour.StrataFrame.UI.Windows.Forms.ComboBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"
By Trent L. Taylor - 2/11/2015

I've been trying to reproduce this and haven't had any luck.  Are you trying to do this in a development environment or in a production environment within your application?
By jsantos - 2/11/2015

It happens in both. It was first reported by customer then I am able to replicate it in our development environment.
By jsantos - 2/11/2015

I have been trying with SQL Profiler to find what is missing but no luck yet.
By Trent L. Taylor - 2/11/2015

What version of SF are you running?  Even looking back, I haven't seen where this has been a problem.  Also, we have thousands of users and if this was a core issue I am pretty sure it would have been caught by now.  So let's focus on your environment and see if we can inspect the structures.  First things first, have you installed the StrataFlix sample before?  I am curious if you have any issues running that.
By jsantos - 2/11/2015

Thank you for the quick replies Trent.

We are using version 1.7.0.6.

I have never installed StrataFlix, actually I don't even know what that is. I don't think anyone else here does, as most of the development team is new here and we inherited all projects.
By Trent L. Taylor - 2/11/2015

Gotcha....well, StrataFlix is a sample app that you can download through the My Account area.  It comes with a database as well as the source code.  It uses RBS as well, so my thinking was that you could try and load this and see if you are still getting an exception.  If not, then let's create a quick sample application on your side, then you give me that source and I will see if it fails on my side.  We are going to need to be able to debug what you are doing to get to the bottom of the issue...but I expect it is data related.  I think that there is a broken foreign key or something along those lines in your database that is potentially causing the problem.  So I was think that we should start from scratch and create a sample and a new project.  It doesn't need much, just a role and a permission.  Then we can try the development environment first.  If that works, then we can move on to the production environment.
By jsantos - 2/12/2015

Thanks Trent for the info.

I will download the StrataFlix sample app and test it here. Your foreign key comment may just point me in the right direction.

I will report back my findings.

thanks again.
By jsantos - 2/12/2015

Hi Trent, When I go through the My Account download area nothing is listed to download.
By Trent L. Taylor - 2/12/2015

Send me a PM with your serial number so I can line up your account.  Thanks.
By jsantos - 2/12/2015

Sent via email as PM says your account is full.

Thanks.
By Trent L. Taylor - 2/12/2015

I didn't get the email, but I cleared out my box.  Try a PM again please.  Thanks!
By jsantos - 2/12/2015

PM sent.
By jsantos - 2/12/2015

Thanks for the sample app.

Where in the app can I test the copying of a role? I can't find it.
By Edhy Rijo - 2/13/2015

Hi JSantos,

Do the following to test with the StrataFlix sample, my code is in VB
  1. Open the FixMain.vb main form.
  2. Drop a Button on top of the MainHeaderControl1 ex: Button1.
  3. Add the following code to the FixMain form:


Private Sub Button1_Click(sender As Object, e As EventArgsHandles Button1.Click
      ShowSecurityDialog()
End Sub

Private Sub ShowSecurityDialog()
      Dim showPermissionFlag As Boolean = False
      Dim showRestrictionSetsFlag As Boolean = False
      If MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.IsAdministrator Then
          showPermissionFlag = True
          showRestrictionSetsFlag = True
      End If
      '-- Create the form and show it
      Using loDialog As New MicroFour.StrataFrame.Security.SecurityDialog(showPermissionFlag, showRestrictionSetsFlag)
          loDialog.ShowDialog()
      End Using
End Sub


Now run the application and login with the current credentials then click your button and the Security Editor will show up.
You will have no data there since there is no really a Security metadata shipped with StrataFlix, but you can create users
and roles and then test if you can copy those roles as in your real application.

See this short video showing the same steps (sorry no audio)
http://screencast.com/t/HVxL8Fn2

Hope this help you figure out your issue.
By jsantos - 2/13/2015

Thanks Edhy for the tip.
By Trent L. Taylor - 2/13/2015

Great post, Edhy.  I appreciate your help.  Sorry I didn't get back sooner, got caught up in the mire yesterday afternoon.
By jsantos - 2/13/2015

I am able to replicate the issue using the same steps mentioned in first post.

By jsantos - 2/13/2015

Sorry for the short post. I am looking at way maybe to record my steps. Is there anything else I can give you to help?
By Trent L. Taylor - 2/13/2015

You can just capture video of it if you want.  Use something like Camtasia or Snagit Video (same company) then post it someplace.  The problem is that I know something is going on within your environment.  Which gives me an idea.  Do you have a VM environment you can use?  I am wondering if you use clean SF assemblies (those straight from us and not compiled through the SF source code you downloaded) and re-create the sample environment in a VM if we can work off of that. 
By Edhy Rijo - 2/13/2015

You are welcome Trent.

JSantos, I think that since you inherited that environment you may have a conflict with the SF assemblies somewhere.
  1. What OS version are you using?
  2. Take a look at the MicroFourxxxx assemblies in the C:\Windows\assembly\ and check let me know what is the version listed, it should be 1.7.0.0 but when you check the File Version in the properties of any of the files it should say 1.7.7.1
http://forum.strataframe.net/Uploads/Images/98806d3c-5a05-4d2c-851e-2c4a.png

Also check your project's references to make sure you have the correct SF assemblies there.
By jsantos - 2/13/2015

Sorry for the delay in getting back.

Here is a video of me replicating the issue. 

Copy Role Error


Edhy, I will now look into your questions now.

Thanks to both of you.
By jsantos - 2/13/2015

We are on Windows 8.1, Visual Studio 2008

http://forum.strataframe.net/Uploads/Images/8d2bde01-f65d-4c21-8a68-0ce7.JPG
By Edhy Rijo - 2/13/2015

JSantos,

In your video you are getting the error when trying to assign a permission, instead try this, save the record, then open it again and then assign the permission to see if that work.

I understand it is not how it should work, but that sequence may allow you to move forward until you find what is causing it to fail.
By jsantos - 2/17/2015

Hi Edhy, 

Thanks for the suggestion and I will offer that as a workaround for the issue as it worked for me.

I am still curious as to what the issue could be.

By Edhy Rijo - 2/17/2015

Hi JSantos,
Glad at least the workaround is working for you.  Still I am pretty sure there is some sort of corruption in the RBS metadata in your environment.  I use RBS in my projects all the time and never had that issue.

Also if your security logic is not too big, you may try re-creating them after truncating all the RBS tables in your project.  By the way, where are the RBS tables, in its own database or on the database of your other data?
By jsantos - 2/17/2015

The RBS tables are sitting part of our database.