More in this section

Forums / Developing with Sitefinity / User/Role Integration with Custom Ecommerce Database

User/Role Integration with Custom Ecommerce Database

3 posts, 0 answered
  1. Shaune Stark
    Shaune  Stark avatar
    4 posts
    Registered:
    02 Dec 2005
    04 Nov 2008
    Link to this post
    Hello!

    I'm hoping someone can help a Sitefinity newbie with some sage advice.  We have a custom ecommerce database that holds all our customer accounts, which includes email, password, security question, and answer, etc.  We would like to build a site using sitefinity that would allow anonymous visitors to login using a custom login user control and using their credentials from the ecommerce db, (without having to create sitefinity user accounts for every one of them).  Once validated against the ecommerce db, we need to be able to change the anonymous visitor's sitefinity role from anonymous to a "Customer" role that we have defined in sitefinity.  Since the visitor has no sitefinity user account, I don't think we can use any of the AddUserToRole functions in CMSUserManager or in the Roles class, as there is no sitefinity user... 

    When the user logs in, we put various data keys into their session so that our custom user controls for the shopping cart and account information manager will retrieve the visitors correct records, but we need help in figuring out how to tell Sitefinity to treat this particular visitor/session as a "Customer".  Is there any sample code in this area?

    Thanks,

    Shaune
  2. Shaune Stark
    Shaune  Stark avatar
    4 posts
    Registered:
    02 Dec 2005
    04 Nov 2008
    Link to this post
    Sorry, I forgot to mention that we previously did this in Microsoft Content Management Server, and in that environment, we were able to do something like the following:

    cmsContext.CurrentUser.Role.SetRole("Customer");

    Is there something like this in Sitefinity?

    Thanks Again,

    Shaune
  3. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    05 Nov 2008
    Link to this post
    Hello Shaune,

    Sitefinity supports Membership Services. So if you have a Membership and Role providers for your accounts data store, you can easy integrate them into Sitefinity.
    Actually it is not quite difficult to implement Membership providers for custom users database, since it is not necessary to implement all supported members. For example, probably for your scenario you will need to implement only GetUser and ValidateUser methods of the MembershipProvider, and GetRolesForUser and IsUserInRole methods of the RoleProvider.

    Helpful resources:
      Membership Providers
      Working with multiple membership and role providers in Sitefinity

    Please let us know how can we help you further.

    Kind regards,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
3 posts, 0 answered