Exemplo n.º 1
0
        public UserModule(IUserRepository userRepo, ICreateUserCommand createUserCommand, IUpdateUserPasswordCommand updateUserPasswordCommand, IDeleteUserCommand deleteUserCommand) : base()
        {
            _userRepo                  = userRepo;
            _createUserCommand         = createUserCommand;
            _updateUserPasswordCommand = updateUserPasswordCommand;
            _deleteUserCommand         = deleteUserCommand;

            Get[Actions.User.Default] = (x) =>
            {
                AddScript(Scripts.UserView);
                return(Default());
            };
            Post[Actions.User.Delete] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserDelete });
                return(DeleteUser());
            };
            Get[Actions.User.List] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserList });
                return(List());
            };
            Post[Actions.User.ChangePassword] = (x) =>
            {
                return(ChangePassword());
            };
            Post[Actions.User.Save] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserAdd });
                return(Save());
            };
        }
Exemplo n.º 2
0
 public UserController(IAddUserCommand addUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand, IGetAllUsersQuery getAllUsersQuery)
 {
     _addUserCommand = addUserCommand;
     _editUserCommand = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _getAllUsersQuery = getAllUsersQuery;
 }
Exemplo n.º 3
0
 public UsersController(IGetUsersCommand getUsers, IGetSingleUserCommand getSingleUser, IInsertUserCommand insertUser, IUpdateUserCommand updateUser, IDeleteUserCommand deleteUser)
 {
     _getUsers      = getUsers;
     _getSingleUser = getSingleUser;
     _insertUser    = insertUser;
     _updateUser    = updateUser;
     _deleteUser    = deleteUser;
 }
Exemplo n.º 4
0
 public UsersController(ICreateUserCommand createUser, IGetUsersCommand getUsers, IEditUserCommand editUser, IDeleteUserCommand deleteUser, Context baza)
 {
     this.createUser = createUser;
     this.getUsers   = getUsers;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
     this.baza       = baza;
 }
 public DeleteOrganizationCommand(IDatabaseProvider connection, 
     IDeleteUserCommand deleteUserCommand, 
     IGetUsersByOrganizationQuery getUsersByOrganizationQuery)
 {
     _connection = connection;
     _deleteUserCommand = deleteUserCommand;
     _getUsersByOrganizationQuery = getUsersByOrganizationQuery;
 }
Exemplo n.º 6
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     _getUsers   = getUsers;
     _getUser    = getUser;
     _addUser    = addUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
 }
 public void Setup()
 {
     _mockedAddUserCommand = MockRepository.GenerateMock<IAddUserCommand>();
     _mockedEditUserCommand = MockRepository.GenerateMock<IEditUserCommand>();
     _mockedDeleteUserCommand = MockRepository.GenerateMock<IDeleteUserCommand>();
     _mockedGetAllUsersQuery = MockRepository.GenerateMock<IGetAllUsersQuery>();
     _controller = new UserController(_mockedAddUserCommand, _mockedEditUserCommand, _mockedDeleteUserCommand, _mockedGetAllUsersQuery);
 }
Exemplo n.º 8
0
 public UserController(IGetOneUserCommand getOneUser, ICreateUserCommand createUser, IGetUserCommand getUser, IDeleteUserCommand deleteUser, IUpdateUserCommand updateUser)
 {
     _getOneUser = getOneUser;
     _createUser = createUser;
     _getUser    = getUser;
     _deleteUser = deleteUser;
     _updateUser = updateUser;
 }
Exemplo n.º 9
0
 public UsersController(IGetUserCommand getOneCommand, IGetUsersCommand getCommand, IAddUserCommand addCommand, IDeleteUserCommand deleteCommand, IUpdateUserCommand updateCommand)
 {
     _getOneCommand = getOneCommand;
     _getCommand    = getCommand;
     _addCommand    = addCommand;
     _deleteCommand = deleteCommand;
     _updateCommand = updateCommand;
 }
Exemplo n.º 10
0
 public UsersController(IDeleteUserCommand deleteUserCommand, IGetUserCommand getUserCommand, IGetUsersCommand getUsersCommand, IInsertUserCommand insertUserCommand, IUpdateUserCommand updateUserCommand)
 {
     this.deleteUserCommand = deleteUserCommand;
     this.getUserCommand    = getUserCommand;
     this.getUsersCommand   = getUsersCommand;
     this.insertUserCommand = insertUserCommand;
     this.updateUserCommand = updateUserCommand;
 }
Exemplo n.º 11
0
 public UserController(IGetUsersCommand getCommand, IGetUserCommand getOneCommand, ICreateUserCommand createUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand)
 {
     _getCommand        = getCommand;
     _getOneCommand     = getOneCommand;
     _createUserCommand = createUserCommand;
     _editUserCommand   = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
 }
Exemplo n.º 12
0
 public UsersController(ICreateUserCommand userCreate, IEditUserCommand userEdit, IGetUserCommand userGet, IGetUsersPaginatedCommand usersGet, IDeleteUserCommand deleteUser)
 {
     _userCreate = userCreate;
     _userEdit   = userEdit;
     _userGet    = userGet;
     _usersGet   = usersGet;
     _deleteUser = deleteUser;
 }
Exemplo n.º 13
0
 public UserController(IGetUsersCommand getUsersCommand, IAddUserCommand addUserCommand, IGetUserCommand getUserCommand, IDeleteUserCommand deleteUsersCommand, IEditUserCommand editUserCommand)
 {
     _getUsersCommand    = getUsersCommand;
     _addUserCommand     = addUserCommand;
     _getUserCommand     = getUserCommand;
     _deleteUsersCommand = deleteUsersCommand;
     _editUserCommand    = editUserCommand;
 }
Exemplo n.º 14
0
 public UserController(IAddUserCommand createUser, IGetUsersQuery getUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser, ProjekatContext context)
 {
     this.createUser = createUser;
     this.getUser    = getUser;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
     this.context    = context;
 }
Exemplo n.º 15
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     this.getUsers   = getUsers;
     this.getUser    = getUser;
     this.addUser    = addUser;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
 }
Exemplo n.º 16
0
 public UsersController(IGetUserCommand getUser, IGetUsersCommand getUsers, ICreateUserCommand createUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     _getUser    = getUser;
     _getUsers   = getUsers;
     _createUser = createUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
 }
Exemplo n.º 17
0
 public UserController(IGetUserCommand getUserCommand, IGetUsersCommand getUsersCommand, IEditUserCommand editUserCommand, IAddUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, LoggedUser loggedUser)
 {
     _getUsersCommand   = getUsersCommand;
     _getUserCommand    = getUserCommand;
     _editUserCommand   = editUserCommand;
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _loggedUser        = loggedUser;
 }
Exemplo n.º 18
0
 public UsersController(IGetUsersCommand searchUsersCommand, IGetUserCommand getOneUserCommand, ICreateUserCommand createUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand, WebNewsContext context)
 {
     _searchUsersCommand = searchUsersCommand;
     _getOneUserCommand  = getOneUserCommand;
     _createUserCommand  = createUserCommand;
     _editUserCommand    = editUserCommand;
     _deleteUserCommand  = deleteUserCommand;
     _context            = context;
 }
Exemplo n.º 19
0
 public UsersController(Context context, IGetUsersCommand getCommand, IGetUserCommand getOneCommand, IAddUserCommand addUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand)
 {
     _context           = context;
     _getCommand        = getCommand;
     _getOneCommand     = getOneCommand;
     _addUserCommand    = addUserCommand;
     _editUserCommand   = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
 }
Exemplo n.º 20
0
 public UserController(IGetUsersCommand getUsersCommand, IGetUserCommand getUserCommand, IAddNewUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, IEmailSender emailSender, IEditUserCommand editUserCommand)
 {
     _getUsersCommand   = getUsersCommand;
     _getUserCommand    = getUserCommand;
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _emailSender       = emailSender;
     _editUserCommand   = editUserCommand;
 }
Exemplo n.º 21
0
 public UserController(IAddUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, IGetUserCommand getUserCommand, IEditUserCommand editUserCommand, IGetUsersCommand getUsersCommand, IEmailSender sender)
 {
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _getUserCommand    = getUserCommand;
     _editUserCommand   = editUserCommand;
     _getUsersCommand   = getUsersCommand;
     _sender            = sender;
 }
Exemplo n.º 22
0
 public UsersController(ICreateUserCommand createUser, IActivateUserCommand activateUser, IGetUsersCommand getUsers, IDeleteUserCommand deleteUser, IEditUserEmailCommand editUserEmail, IEditUserPasswordCommand editUserPassword, IAuthenticateUserCommand authUser)
 {
     _createUser       = createUser;
     _activateUser     = activateUser;
     _getUsers         = getUsers;
     _deleteUser       = deleteUser;
     _editUserEmail    = editUserEmail;
     _editUserPassword = editUserPassword;
     _authUser         = authUser;
 }
Exemplo n.º 23
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IGetRolesCommand getRoles, IEditUserCommand editUser, IDeleteUserCommand deleteUser, UseCaseExecutor executor, IAddUserCasesCommand addUserCases)
 {
     this.getUsers     = getUsers;
     this.getUser      = getUser;
     this.addUser      = addUser;
     this.getRoles     = getRoles;
     this.editUser     = editUser;
     this.deleteUser   = deleteUser;
     this.executor     = executor;
     this.addUserCases = addUserCases;
 }
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     try
     {
         executor.ExecuteCommand(command, id);
         return(StatusCode(204, "User deleted"));
     }
     catch
     {
         return(StatusCode(422, "Fail"));
     }
 }
Exemplo n.º 25
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     try
     {
         executor.ExecuteCommand(command, id);
         return(NoContent());
     }
     catch (EntityNotFoundException ex)
     {
         return(NotFound());
     }
 }
Exemplo n.º 26
0
 public UsersController(IAddUserCommand _addUserCommand,
                        IGetUserCommand _getUserCommand,
                        IGetUsersCommand _getUsersCommand,
                        IEditUserCommand _editUserCommand,
                        IDeleteUserCommand _deleteUserCommand)
 {
     this._addUserCommand    = _addUserCommand;
     this._getUserCommand    = _getUserCommand;
     this._getUsersCommand   = _getUsersCommand;
     this._editUserCommand   = _editUserCommand;
     this._deleteUserCommand = _deleteUserCommand;
 }
Exemplo n.º 27
0
        public async Task <IActionResult> DeleteUserAsync(Guid userId, [FromServices] IDeleteUserCommand command)
        {
            try
            {
                await command.ExecuteAsync(userId);

                return(NoContent());
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Exemplo n.º 28
0
 public UsersController(IAddUserCommand addUserCommand,
                        IDeleteUserCommand deleteUserCommand,
                        IUpdateUserCommand updateUserCommand,
                        IGetUserByIdValueQuery getUserByIdValueQuery,
                        IGetAllUsersQuery getAllUsersQuery,
                        IGetAllUsersPaginatedQuery getAllUsersPaginatedQuery)
 {
     _addUserCommand            = addUserCommand;
     _deleteUserCommand         = deleteUserCommand;
     _updateUserCommand         = updateUserCommand;
     _getUserByIdValueQuery     = getUserByIdValueQuery;
     _getAllUsersQuery          = getAllUsersQuery;
     _getAllUsersPaginatedQuery = getAllUsersPaginatedQuery;
 }
Exemplo n.º 29
0
        public void UserModuleTest_SetUp()
        {
            _userRepo                  = Substitute.For <IUserRepository>();
            _userValidator             = Substitute.For <IUserValidator>();
            _passwordProvider          = Substitute.For <IPasswordProvider>();
            _createUserCommand         = Substitute.For <ICreateUserCommand>();
            _updateUserPasswordCommand = Substitute.For <IUpdateUserPasswordCommand>();
            _deleteUserCommand         = Substitute.For <IDeleteUserCommand>();

            Mapper.Initialize((cfg) =>
            {
                cfg.CreateMap <UserViewModel, UserModel>();
            });
        }
Exemplo n.º 30
0
 public UsersController(IGetUserCommand getUser,
                        IGetUsersCommand getUsers,
                        IAddUserCommand addUser,
                        IEditUserCommand editUser,
                        IDeleteUserCommand deleteUser,
                        IGetRolesWithoutPaginationCommand getRoles)
 {
     _getUser    = getUser;
     _getUsers   = getUsers;
     _addUser    = addUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
     _getRoles   = getRoles;
 }
Exemplo n.º 31
0
 public UserService(IDeleteUserCommand deleteUserCommand,
                    IUpdateUserCommand updateUserCommand,
                    ICreateUserCommand createUserCommand,
                    IGetUserByIdQuery getUserByIdQuery,
                    IGetAllNonDeletedUsersQuery getAllNonDeletedUsersQuery,
                    IGetUserByUsernameQuery getUserByUsernameQuery, 
                    IGetUserByEmailQuery getUserByEmailQuery)
 {
     _deleteUserCommand = deleteUserCommand;
     _updateUserCommand = updateUserCommand;
     _createUserCommand = createUserCommand;
     _getUserByIdQuery = getUserByIdQuery;
     _getAllNonDeletedUsersQuery = getAllNonDeletedUsersQuery;
     _getUserByUsernameQuery = getUserByUsernameQuery;
     _getUserByEmailQuery = getUserByEmailQuery;
 }
 public UsersController(
     ILogger <UsersController> logger,
     ICreateUserCommand createUserCommand,
     IUpdateUserCommand updateUserCommand,
     IDeleteUserCommand deleteUserCommand,
     IGetUserQuery getUserQuery,
     IGetAllUsersQuery getAllUsersQuery
     )
 {
     this.logger            = logger;
     this.createUserCommand = createUserCommand;
     this.updateUserCommand = updateUserCommand;
     this.deleteUserCommand = deleteUserCommand;
     this.getUserQuery      = getUserQuery;
     this.getAllUsersQuery  = getAllUsersQuery;
 }
Exemplo n.º 33
0
 public UsersController(IAddUserCommand addUserCommand,
                        IEditUserCommand editUserCommand,
                        IDeleteUserCommand deleteUserCommand,
                        IPagingViewModelGenerator pagingViewModelGenerator,
                        IGetUserQuery getUserQuery,
                        ISendNotificationCommand sendNotificationCommand,
                        IEncryptor encryptor,
                        IAuthenticationManager authenticationManager)
 {
     _addUserCommand           = addUserCommand;
     _editUserCommand          = editUserCommand;
     _deleteUserCommand        = deleteUserCommand;
     _pagingViewModelGenerator = pagingViewModelGenerator;
     _getUserQuery             = getUserQuery;
     _sendNotificationCommand  = sendNotificationCommand;
     _encryptor             = encryptor;
     _authenticationManager = authenticationManager;
 }
Exemplo n.º 34
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     executor.ExecuteCommand(command, id);
     return(StatusCode(StatusCodes.Status204NoContent));
 }
 public void Setup()
 {
     _userByEmailQuery = Substitute.For<IUserByEmailQuery>();
     _createUserCommand = Substitute.For<ICreateUserCommand>();
     _deleteUserCommand = Substitute.For<IDeleteUserCommand>();
 }