コード例 #1
0
        public void Import(WindowsIdentity identity)
        {
            var service = new EFMembershipService();
            if (service.GetUser(identity.Name) == null)
            {
                service.CreateUser(identity.Name, "imported", identity.Name, "None", "None");

                if (!String.Equals(ConfigurationManager.AppSettings["ShouldImportWindowsUserAsAdministrator"], "true", StringComparison.InvariantCultureIgnoreCase))
                    return;

                var roleProvider = new EFRoleProvider();
                roleProvider.AddUsersToRoles(new[] { identity.Name }, new[] { Definitions.Roles.Administrator });
            }
        }
コード例 #2
0
 private UserModel AddUser()
 {
     EFMembershipService memberService = new EFMembershipService { CreateContext = GetContext };
     memberService.CreateUser("fred", "letmein", "Fred", "FredBlogs", "fred@aol");
     return memberService.GetUserModel("fred");
 }
コード例 #3
0
 protected override UserModel AddUserFred()
 {
     IMembershipService memberService = new EFMembershipService { CreateContext = GetContext };
     memberService.CreateUser("fred", "letmein", "Fred", "Blogs", "fred@aol");
     return memberService.GetUserModel("fred");
 }