BugNET

Open source issue tracking & project management

Forums

HomeHomeDevelopment and...Development and...General Develop...General Develop...More membership provider…More membership provider…
Previous
 
Next
New Post
11/23/2009 1:31 PM
 

I downloaded the latest code from SVN and did see a new Membership provider where there is a new implementation of a custom membership user. The membership provider is creating a new CustomMembershipUser and populates some data from the profile. As same reason as my previous post http://bugnetproject.com/Forums/tabid... this is not a preferred way to handle the membership and profile concept, now there is a hard coded reference to the CustomMembershipUser object and I need to implement the ExtendedSqlMembershipProvider or at least inherit from it.


The preferred way is to handle the user and profile separate, create a MembershipUser object anytime you need access to the basic user information and create a ProfileBase object when you need the profile data. If you only need to get users email it’s much more overhead to load the profile.

If you insist to have a custom membership user object for easy access to information it’s much better if for example the ITUser class GetUser method creates the object and populate the profile data.

//Kalle

 
New Post
11/30/2009 7:49 AM
 

/Kalle, I have added this to the previous issue I logged.

http://support.bugnetproject.com/Bugs...


Follow me on twitter: @stewartmoss http://www.twitter.com/stewartmoss
Follow BugNETProject on twitter: @bugnetproject http://www.twitter.com/bugnetproject
 
New Post
11/30/2009 9:17 AM
 
Kalle wrote:

I downloaded the latest code from SVN and did see a new Membership provider where there is a new implementation of a custom membership user. The membership provider is creating a new CustomMembershipUser and populates some data from the profile. As same reason as my previous post http://bugnetproject.com/Forums/tabid... this is not a preferred way to handle the membership and profile concept, now there is a hard coded reference to the CustomMembershipUser object and I need to implement the ExtendedSqlMembershipProvider or at least inherit from it.


The preferred way is to handle the user and profile separate, create a MembershipUser object anytime you need access to the basic user information and create a ProfileBase object when you need the profile data. If you only need to get users email it’s much more overhead to load the profile.

If you insist to have a custom membership user object for easy access to information it’s much better if for example the ITUser class GetUser method creates the object and populate the profile data.

//Kalle

The membership implementation in BugNET is truely custom as you have no doubt noticed. On one hand, it is not portable or easily shared with multiple authentication providers but on the other hand the current implimentation provides referential integrity on the user tables to other records.

I wouldn't be so fast to completely rewrite the current implimentation. Obviously it depends on your situation which you require a shared authentication system. I supposed guids could be replaced with the username and contraints be put on the username field. If you ever had to change a username it would be a costly process though.


Davin Dubeau

follow us on twitter facebook users group google plus
 
New Post
11/30/2009 1:06 PM
 

I have rethought about the username as a unique key, as you said there can be some problem with the referential integrity and also problem if you want to delete a user or changing the username.


I have spent some time to digging into the BugNET source code and the database design, I can see two options to solve the MembershipProvider implementation.


1. Use the GUID from the MembershipUser.ProviderUserKey to reference the user in tables, the only downside I can see with this implementation is that you “hard code” the data type to a GUID as the user ID. The upside is that is not too much work to rewrite the membership implementation because BugNET is already using a GUID to identify the user, change the store procedures to accept a userId instead of username and remove the SQL code where you select the userId from the aspnet_membershipUser table.

2. The second option is to create a mapping table where you save a reference from the username to the userId. In this case you do not need to rewrite the C# code but just the store procedure, instead of selecting the userId from aspnet_membershipUser table you select the userId from the mapping table. The downside is if you add a new user from another application, you do not have the reference between username and userId in the mapping table.

I more than love to help out with the rewrite of the implementation though I see we are going to use BugNet in our daily business.

//Kalle

 
New Post
12/2/2009 6:57 AM
 

Like you said, if we use option 1 and use the user id GUID throughout the application it would be a lot less work and essentially a change to the application and stored procedures to switch the use of usernames to userid to be consistant throughout the application. The user id would be gotten from the user provider key so it would be pulled from the provider and not tied to BugNET.

I don't think its an easy change as quite a bit of sql code would have to be changed and the data layer. There are quite a few places in views etc that joins to the asp.net tables are done in which user names etc are done and would all have to be changed to use the provider as well. Ultimately it would be very easy to switch the provider after this is done though as BugNET would have no depencies on a specific user table etc.

Roles are not quite provider based either and very custom to bugnet. The default role provider falls down for our needs.


Davin Dubeau

follow us on twitter facebook users group google plus
 
Previous
 
Next
HomeHomeDevelopment and...Development and...General Develop...General Develop...More membership provider…More membership provider…


Forum Policy

These Discussion Forums are dedicated to the discussion of the BugNET issue tracker.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:
1. No Advertising.
2. No Flaming or Trolling.
3. No Profanity, Racism, or Prejudice.
4. Site Moderators have the final word on approving/removing a thread or post or comment.
5. English language posting only, please.