StrataFrame Forum

Slight problem with SecurityUser accessing Security Editor

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

By Charles Thomas Blankenship - 10/9/2014

When I log into the application using "secusr" and password, I can test to see if that account has the permission to access the security editor or not (and appropriately enable or disable the associated button).  But, when I launch the form as "secusr" I receive a unhelpful error message "Access denied".

Here is a short video. 

if (SecurityBasics.CurrentUser.GetPermission("Security Editor").Action == PermissionAction.Grant)
   {
      cmdSecurity.Enabled = true;
   }
   else if (SecurityBasics.CurrentUser.UserPK == -2)
   {
      cmdSecurity.Enabled = true;
   }
   else
   {
   cmdSecurity.Enabled = false;
   }


Another oddity that shouldn't "be" is the request for "Security Editor" permission should be "Grant" for both the "secusr" and "administrator" account ... isn't that the way of it?
By Ivan George Borges - 10/9/2014

In the "AppMain.vb / Program.cs", have you set the SecurityMaintenanceUserName as bellow?

        SecurityBasics.SecurityMaintenanceUserName = "YourSecurityMaintenanceUsername"
        SecurityBasics.SecurityMaintenancePassword = "YourSecurityMaintenancePassword"
        SecurityBasics.SecurityMaintenanceUserPk = -2
By Charles Thomas Blankenship - 10/13/2014

Yes ...

SecurityBasics.SecurityMaintenanceUserName = "SecurityUser";
SecurityBasics.SecurityMaintenancePassword = "secusr" + DateTime.Now.Day.ToString();
SecurityBasics.SecurityMaintenanceUserPk = -2;
By Ivan George Borges - 10/13/2014

It might just be a typo then, but in your original message you stated that you use "secusr" to login, but then you have set your security user as "SecurityUser", according to your last message.
By Charles Thomas Blankenship - 10/13/2014

The code snippet is the accurate data ... here is an illustration of the problem ... the video is still appropriate too.
By Ivan George Borges - 10/15/2014

I have tried to reproduce this issue on my environment and haven't been able to. If you don't mind creating a small sample application using the SF Sample Database which reproduces this behavior, please do it and upload it over here so I can see if I am able to find something.
By Charles Thomas Blankenship - 10/21/2014

Hi Ivan:

Here is an example of the problem in a brand new StrataFrame WinForms app with Security.

Here is the project all zipped up ... I included the .bak file for the associated database but you probably will not need that.

Thanks for the continued support.

C. T.
By Ivan George Borges - 10/21/2014

Hi Charles.

Your sample helped a lot, since as you stated, it didn't work over here either!

The thing is, I was testing with my applications, and I never remembered I had a fix on them already to make it work. It seems that there is a bug in the Security Module about the "SecurityMaintenanceKeyPrefix" and you can find all explanation about it on the following thread:

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

Anyway, the short answer for this is to add the following line in your Program.cs and then you should be fine:

SecurityBasics.SecurityMaintenanceKeyPrefix = "Security ";


Hope it helps.

Cheers.

Ivan
By Charles Thomas Blankenship - 10/21/2014

Yep ... works great ... thanks for saving me the time of digging into the security module myself!

C. T.
By Ivan George Borges - 10/21/2014

You're most welcome. Cool