Custom User Table questions

Mar 25, 2009 at 11:23 PM
Andrea,

First, here in Montana we had an espresso in your honor today. Great job on the project. I'm using NetSqlAzMan to checkaccess against my own users table. But I'm having  a litle trouble because of it. Programaticly I've been using, the GetDBUser(ByVal customSid As NetSqlAzMan.Interfaces.IAzManSid) fuunction (Which is working great), but....when I try to use the helper classes, all of the CheckAccess (For DB) functions take a USER name as string. Unfortunately, I query my user table by IAzManSid or user name AND password.(a hash of the password)

Could you add another CheckAccess to your helper classes that takes a IAzManSid? Or do you have any other suggestions? What happens in your UsersDemo table when you have two rows that have the same UserName?

Thanks,
Craig

Coordinator
Mar 25, 2009 at 11:32 PM

Hi Craig,

tanks for the espresso J

Could you post a photo ? J

 

I remand you to this post in which I talk about retrieving DBUsers from SIDs instead usernames.

http://netsqlazman.codeplex.com/Thread/View.aspx?ThreadId=50769

 

Let me know if it works.

Regards,

Andrea.

Mar 26, 2009 at 5:36 PM
I guess you missed my question....I'm am doing exactly what is in this link http://netsqlazman.codeplex.com/Thread/View.aspx?ThreadId=50769 (Which is good) But upon reading your documentation I noticed another more streamlined way to checkAccess, the CheckAccessHelper class(*1). The cool thing about the Helper class, is it auto generates your Roles, Tasks, and Operations ENUM's for you. But it does Not take a IAzManDBUser in the constructor and all of the codes (*2) overridden method signatures do not take a IAzManDBUser, but a DBuserName as string. I've Written my own "Helper" class, but the auto-generated code would be easier to maintain. If the "Generate CheckAccesHelper" fucntion also included overided methods that took a IAzmanDBUser I wouldn't have to manually update my roles, tasks, and operations Enum (Which I  will spell wrong and wonder why its not working).

So, Could you add another overriden CheckAccess function to your helper classes that takes a IAzManDBUser?

if, not, no big deal, I'll just manually upadate my own helper class.

Thanks


1) #######################
string cs = "data source=eidosis4-afr;Initial
Catalog=NetSqlAzManStorage;Integrated Security = SSPI;";
My_Application.Security.CheckAccessHelper helper = new
My_Application.Security.CheckAccessHelper(cs, WindowsIdentity.GetCurrent());

helper.OpenConnection();

bool result = helper.CheckAccess(My_Application.Security.CheckAccessHelper.Operation.Op1);
helper.CloseConnection();

//Use result for your business logic
if (result == true)
{
//Allow or AllowWithDelegation
}
else
{
//Deny or Neutral
}


#END 1) ##########################################

#2)#####################################

Public Overridable Overloads Function GetAuthorizationType
Protected Overridable Overloads Function CheckAccess

#End 2#################################
Coordinator
Mar 27, 2009 at 8:16 AM
Edited Mar 27, 2009 at 8:18 AM
Hi Cmacholz,
now I have understood. :-)

I have opened a new work item based on your request:
[workitem:2431] - http://netsqlazman.codeplex.com/WorkItem/View.aspx?WorkItemId=2431

Regards,
Andrea.
Coordinator
Apr 3, 2009 at 1:38 PM

The requested feature is implemented in the 3.5.3.0 beta version.


Regards,

Andrea.

Apr 3, 2009 at 6:01 PM
Andrea,

Sorry I didn't get back to you. I have been using the Mar 27<abbr></abbr> version of the source code. Yesterday was the first time I used the new helper class. Looks pretty good, the only thing I had to change in the code was adding a constructor to the helper class that took only a connection string.Since I'm not using AD users and only checking against the custom db users table I only needed to access the checkaccess functions that took a Custom SID.

So, far today I haven't see any problems. Thanks again.

Craig
Coordinator
Apr 4, 2009 at 9:27 AM
Edited Apr 4, 2009 at 9:30 AM
Hi Craig,
you have right.
I have added this constructor to the latest source code changeset.

Regards,
Andrea.

 

 

#region Constructors

        /// <summary>

        /// Initializes a new instance of the <see cref="T:CheckAccessHelper"/> class.

        /// </summary>

        /// <param name="storageConnectionString">The storage connection string.</param>

        /// <param name="windowsIdentity">The Windows Principal Identity.</param>

        public CheckAccessHelper(string storageConnectionString, System.Security.Principal.WindowsIdentity windowsIdentity)

        {

            this.mStorage = new NetSqlAzMan.SqlAzManStorage(storageConnectionString);

            this.windowsIdentity = windowsIdentity;

        }

        /// <summary>

        /// Initializes a new instance of the <see cref="T:CheckAccessHelper"/> class [DB Users ONLY].

        /// </summary>

        /// <param name="storageConnectionString">The storage connection string.</param>

        public CheckAccessHelper(string storageConnectionString)

        {

            this.mStorage = new NetSqlAzMan.SqlAzManStorage(storageConnectionString);

        }

        #endregion