StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



User SecurityExpand / Collapse
Author
Message
Posted 01/18/2006 12:19:55 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
I want to implement user security.  Am I correct in understanding that I should use the CheckSecurity method on the business object to determine that an action is to be allowed or denied THEN use the SecurityDenied method in the object on the form to display the denied message to the user?

If this is the correct procedure would passing "Denied messages\reasons" to the SecurityDenied method thru the brokenrules collection be appropriate?  I want my BO to determine why access is being denied and just let the UI display the message to the user.

On the same topic, to determine who the current logged in user is I am using a static property on the AppMain class.  My problem here is I can not see the AppMain object and its properties from my BO project.  How do I have a "global" user object yet keep the BO independent.  How should this be handled?

Post #450
Posted 01/18/2006 1:15:15 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 1:09:23 PM
Posts: 2,686, Visits: 1,888
I want to implement user security. Am I correct in understanding that I should use the CheckSecurity method on the business object to determine that an action is to be allowed or denied THEN use the SecurityDenied method in the object on the form to display the denied message to the user?


Yes, you are correct there.

Within the SecurityDenied event handler, the event arguments tell you what action was denied. Beyond that, you will need to store off any additional information necessary to provide a complete message to the end user. Your best bet for storing off information (including storing off a "global" business object) is to create a sealed class within your application's root namespace called "Globals" or some other name that makes sense to you. Then you can place a static (shared) member/property combination to store the global users business object and another member/property pair to store off any other information necessary.

namespace RootNamespace
{
public sealed class Globals
{

#region Private Fields

private static UsersBO _CurrentUser = new UsersBO();
private static string _ErrorMessage = "";

#endregion

#region Public Properties

public static UsersBO CurrentUser
{
get
{
return Globals._CurrentUser;
}
set
{
Globals._CurrentUser = value;
}
}

public static string ErrorMessage
{
get
{
return Globals._ErrorMessage;
}
set
{
Globals._ErrorMessage = value;
}
}

#endregion

}
}

You could then access these properties from anywhere by accessing RootNamespace.Globals.CurrentUser or RootNamespace.Globals.ErrorMessage.

Hope that makes sense


www.bungie.net
Post #451
Posted 01/18/2006 2:44:57 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 04/13/2007 5:21:30 PM
Posts: 18, Visits: 193
Ben,

So what you are saying is that the entire project should be in the same namespace ? What if the namespaces are different. For example we have a business object library that is in QuoteBoLib and the UI portion of our project is in SFQuote. There is no way to add the SFQuote namespace to the QuoteBoLib. So should we change the namespace so that each section is in it's own subsection. For example IMS.WinForms.SFQuote for our forms and then IMS.Business for our business objects ?

Thanks,

Randy

Post #453
Posted 01/19/2006 8:35:37 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 1:09:23 PM
Posts: 2,686, Visits: 1,888
No, your entire project doesn't have to be in the same namespace (all of the StrataFrame components are most certainly not in the same namespace). All I'm saying is that to have a global object that you can reference from anywhere (including other namespaces, by typing the full name) you need to define it as static. All static variables are instantiated when the application initializes and are available throughout the life of the AppDomin (the life of the application). You can place your static variable in the root namespace, or 10 namespaces deep. As long as it's public, you can access it by referencing the full name.


www.bungie.net
Post #457
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:32am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 9 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.