Esempio n. 1
0
 public async Task AddNewUserAsync(IUserCategory category, TaskContext context)
 {
     var authentication = context.Authentication;
     var index          = RandomUtility.Next(int.MaxValue);
     var authority      = RandomUtility.NextEnum <Authority>();
     var userID         = $"{authority.ToString().ToLower()}_bot_{index}";
     var userName       = "******" + index;
     await category.AddNewUserAsync(authentication, userID, ToSecureString("1111"), userName, authority);
 }
Esempio n. 2
0
        public static async Task <IUser> GenerateUserAsync(this IUserCategory userCategory, Authentication authentication, Authority authority)
        {
            var userCollection = userCategory.GetService(typeof(IUserCollection)) as IUserCollection;
            var newID          = await userCollection.GenerateNewUserIDAsync("user");

            var newName  = newID.Replace("user", $"{authority}User");
            var password = authority.ToString().ToLower().ToSecureString();

            return(await userCategory.AddNewUserAsync(authentication, newID, password, newName, authority));
        }