Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amir Khan 934 posts 1840 karma points
    Apr 08, 2015 @ 18:59
    Amir Khan
    0

    Import Users not Members

    Is there any way to import Umbraco Users? Via API or otherwise?

    Thanks,
    Amir

  • Chris Randle 61 posts 149 karma points c-trib
    Apr 08, 2015 @ 20:49
    Chris Randle
    0

    Sure! There are a few different ways I can think of.

    1. manually create users
    2. manually create using Selenium to physically create a user entry (hacky but hey - I'm brainstorming here!)
    3. Using custom logic - so if you are on the latest versions of Umbraco 7 you could use the Umbraco UserService
    4. Custom SQL logic to create the users in the relevant tables in the database ([dbo].[umbracoUser] or [dbo].[cmsMember*] prefixed tables for Member import)

      UmbracoContext.Current.Application.Services.UserService.CreateWithIdentity("username", "email@work.com", "mybadpassword123", "myUserType");

    See this post for a similar question. Really all depends on your data source and how many you are importing. Don't forget that Umbraco uses the standard ASP.NET membership provider. There are 2 - one for Members and one for Users. They are both specified in the web.config. This means you can write your own custom provider to replace Umbraco's. A common example of this would be where you wanted to use say ActiveDirectory as the login provider.

    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear />
        <add name="UmbracoMembershipProvider" type="Umbraco.Web.Security.Providers.MembersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" useLegacyEncoding="false" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" />
        <add name="UsersMembershipProvider" type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" useLegacyEncoding="false" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
      </providers>
    </membership>
    
  • Amir Khan 934 posts 1840 karma points
    Apr 08, 2015 @ 20:59
    Amir Khan
    0

    Rockstar on the 3rd one. Worked easily.

    Is it possible to give them access to sections and set a login name separately? The process still requires manual cleanup otherwise.

    -Amir

  • Chris Randle 61 posts 149 karma points c-trib
    Apr 08, 2015 @ 23:42
    Chris Randle
    0

    The way to do it is to use different usertypes for your access configuration and then just create the with that usertype. What do you mean by cleanup?

Please Sign in or register to post replies

Write your reply to:

Draft