예제 #1
0
        private NewUserWelcomeMailTemplate MapEmailTemplate(AddUserCommand user)
        {
            var template = new NewUserWelcomeMailTemplate();

            template.FirstName         = user.FirstName;
            template.LastName          = user.LastName;
            template.TemporaryPassword = new HtmlString(user.Password);

            return(template);
        }
        private NewUserWelcomeMailTemplate MapEmailTemplate(AddUserCommand user, GeneralSiteSettings siteSettings)
        {
            var template = new NewUserWelcomeMailTemplate();

            template.FirstName         = user.FirstName;
            template.LastName          = user.LastName;
            template.TemporaryPassword = new HtmlString(user.Password);
            template.ApplicationName   = siteSettings.ApplicationName;

            return(template);
        }
        private AddUserCommand MapCommand(AddCofoundryUserCommand command, IExecutionContext executionContext)
        {
            var newUserCommand = new AddUserCommand();

            newUserCommand.FirstName             = command.FirstName;
            newUserCommand.LastName              = command.LastName;
            newUserCommand.Email                 = command.Email;
            newUserCommand.Password              = _passwordGenerationService.Generate();
            newUserCommand.RequirePasswordChange = true;
            newUserCommand.UserAreaCode          = CofoundryAdminUserArea.AreaCode;
            newUserCommand.RoleId                = command.RoleId;

            return(newUserCommand);
        }
 private string GetDisplayName(AddUserCommand command)
 {
     return((command.FirstName + " " + command.LastName).Trim());
 }
        public async Task <int> AddAsync(AddUserCommand command)
        {
            await ExtendableContentRepository.ExecuteCommandAsync(command);

            return(command.OutputUserId);
        }
예제 #6
0
 /// <summary>
 /// A generic user creation command for use with Cofoundry users and
 /// other non-Cofoundry users. Does not send any email notifications.
 /// </summary>
 /// <param name="executionContext">Optional execution context to use when executing the command. Useful if you need to temporarily elevate your permission level.</param>
 public Task AddUserAsync(AddUserCommand command, IExecutionContext executionContext = null)
 {
     return(_commandExecutor.ExecuteAsync(command, executionContext));
 }