Esempio n. 1
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                Console.Out.Write($"  *** Enter password for user '{_user.UserName}' *** : ");
                var decryptedPass = StandardInput.GetHiddenInput();
                Console.Out.WriteLine();

                _ = _service.User_SetPasswordV1(_user.Id,
                                                new PasswordAddV1()
                {
                    EntityId           = _user.Id,
                    NewPassword        = decryptedPass,
                    NewPasswordConfirm = decryptedPass,
                }).Result;

                var user = _service.User_GetV1(_user.Id.ToString())
                           .Result;

                FormatOutput.Users(_uow, new List <E_User> {
                    _map.Map <E_User>(user)
                });

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 2
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                if (_isLockedOut.HasValue)
                {
                    _user.IsLockedOut = _isLockedOut.Value;
                }

                if (_isDeletable.HasValue)
                {
                    _user.IsDeletable = _isDeletable.Value;
                }

                var user = _service.User_UpdateV1(_map.Map <UserV1>(_user))
                           .Result;

                FormatOutput.Users(_uow, new List <E_User> {
                    _map.Map <E_User>(user)
                }, true);

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 3
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                FormatOutput.Users(_uow, new List <E_User> {
                    _user
                });
                Console.Out.WriteLine();

                Console.Out.Write("  *** Enter 'yes' to delete user *** : ");
                var input = StandardInput.GetInput();
                Console.Out.WriteLine();

                if (input.ToLower() == "yes")
                {
                    _ = _service.User_DeleteV1(_user.Id)
                        .Result;
                }

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 4
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                var expression = QueryExpressionFactory.GetQueryExpression <E_User>();

                if (!string.IsNullOrEmpty(_filter))
                {
                    expression = expression.Where(x => x.UserName.Contains(_filter));
                }

                _users = _uow.Users.Get(expression.ToLambda(),
                                        new List <Expression <Func <E_User, object> > >()
                {
                    x => x.UserClaims,
                    x => x.UserLogins,
                    x => x.UserRoles,
                })
                         .TakeLast(_count);

                FormatOutput.Users(_uow, _users.OrderBy(x => x.UserName));

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 5
0
        public override int Run(string[] remainingArguments)
        {
            UserV1 user = null;

            try
            {
                if (_human)
                {
                    user = _service.User_CreateV1(
                        new UserV1()
                    {
                        UserName     = _userName,
                        Email        = _userName,
                        FirstName    = _firstName,
                        LastName     = _lastName,
                        IsLockedOut  = false,
                        IsHumanBeing = true,
                        IsDeletable  = true,
                    }).Result;
                }
                else
                {
                    user = _service.User_CreateV1NoConfirm(
                        new UserV1()
                    {
                        UserName     = _userName,
                        Email        = _userName,
                        FirstName    = _firstName,
                        LastName     = _lastName,
                        IsLockedOut  = false,
                        IsHumanBeing = false,
                        IsDeletable  = true,
                    }).Result;
                }

                _ = _service.User_AddToLoginV1(user.Id, _login.Id)
                    .Result;

                FormatOutput.Users(_uow, new List <E_User> {
                    _map.Map <E_User>(user)
                });

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 6
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                FormatOutput.Users(_uow, new List <E_User> {
                    _user
                }, true);

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
Esempio n. 7
0
        public override int Run(string[] remainingArguments)
        {
            try
            {
                _ = _service.User_RemoveFromRoleV1(_user.Id, _role.Id)
                    .Result;

                var user = _service.User_GetV1(_user.Id.ToString())
                           .Result;

                FormatOutput.Users(_uow, new List <E_User> {
                    _map.Map <E_User>(user)
                });

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }