Exemplo n.º 1
0
 public GroupUserService(
     IAuthorizedUserHelper authorizedUserHelper,
     IGroupUserRepository groupUserRepository,
     IGroupUserStore groupUserStore,
     IGroupEventService groupEventService,
     IGroupRepository groupRepository,
     IChannelEventService channelEventService,
     IChannelUserRepository channelUserRepository,
     IChannelUserStore channelUserStore,
     IChatEventService chatEventService,
     IChatUserRepository chatUserRepository,
     IChatUserStore chatUserStore,
     IChatService chatService,
     IUserRepository userRepository,
     IMailService mailService,
     IMapper mapper
     )
 {
     _groupUserRepository   = groupUserRepository;
     _groupUserStore        = groupUserStore;
     _groupEventService     = groupEventService;
     _groupRepository       = groupRepository;
     _channelEventService   = channelEventService;
     _channelUserRepository = channelUserRepository;
     _channelUserStore      = channelUserStore;
     _chatUserRepository    = chatUserRepository;
     _chatUserStore         = chatUserStore;
     _chatEventService      = chatEventService;
     _chatService           = chatService;
     _userRepository        = userRepository;
     _mailService           = mailService;
     _mapper         = mapper;
     _authorizedUser = authorizedUserHelper.GetAuthorizedUser();
 }
Exemplo n.º 2
0
        public GroupResponse Create(string name, string description)
        {
            var group = new Models.Group
            {
                Id          = Guid.NewGuid(),
                Name        = name,
                Description = description
            };

            var user              = _authorizedUserHelper.GetAuthorizedUser();
            var groupUser         = new GroupUser(user, group, Role.Admin);
            var documentGroupUser = new Documents.GroupUser(user.Id, group.Id);

            _groupUserRepository.Add(groupUser);
            _groupUserStore.AddToBus(documentGroupUser);

            _groupEventService.AddGroupCreatedEvent(group, _user);
            _groupEventService.AddUserAddedToGroupEvent(group, _user, _user);

            _mailService.SendMail(
                user.Email,
                "CallGate - New group created successfully",
                $"Congratz! You created a new group '{name}'."
                );

            return(_mapper.Map <GroupResponse>(group));
        }
        public void RequireValidPasswordForAuthorizedUser(string password)
        {
            var authorizedUser = _authorizedUserHelper.GetAuthorizedUser();
            var user           = _authenticationService.GetUserByUserNameAndPassword(authorizedUser.Username, password);

            if (user == null)
            {
                throw new ParseApiException("Invalid password");
            }
        }
Exemplo n.º 4
0
 public GroupValidationService(
     IAuthorizedUserHelper authorizedUserHelper,
     IGroupUserRepository groupUserRepository,
     IUserValidationService userValidationService
     )
 {
     _groupUserRepository   = groupUserRepository;
     _authorizedUser        = authorizedUserHelper.GetAuthorizedUser();
     _userValidationService = userValidationService;
 }
Exemplo n.º 5
0
 public UserService(
     IAuthorizedUserHelper authorizedUserHelper,
     IUserRepository userRepository,
     IMailService mailService,
     IMapper mapper
     )
 {
     _userRepository = userRepository;
     _mailService    = mailService;
     _mapper         = mapper;
     _authorizedUser = authorizedUserHelper.GetAuthorizedUser();
 }
 public ChatValidationService(
     IAuthorizedUserHelper authorizedUserHelper,
     IChatUserRepository chatUserRepository,
     IChatRepository chatRepository,
     IGroupValidationService groupValidationService,
     IUserValidationService userValidationService
     )
 {
     _chatUserRepository     = chatUserRepository;
     _groupValidationService = groupValidationService;
     _chatRepository         = chatRepository;
     _userValidationService  = userValidationService;
     _authorizedUser         = authorizedUserHelper.GetAuthorizedUser();
 }
Exemplo n.º 7
0
 public ChannelService(
     IAuthorizedUserHelper authorizedUserHelper,
     IGroupRepository groupRepository,
     IChannelUserRepository channelUserRepository,
     IChannelEventService channelEventService,
     IChannelUserStore channelUserStore,
     IChannelRepository channelRepository,
     IMapper mapper
     )
 {
     _groupRepository       = groupRepository;
     _channelUserRepository = channelUserRepository;
     _channelEventService   = channelEventService;
     _authorizedUser        = authorizedUserHelper.GetAuthorizedUser();
     _channelUserStore      = channelUserStore;
     _channelRepository     = channelRepository;
     _mapper = mapper;
 }
Exemplo n.º 8
0
 public GroupService(
     IAuthorizedUserHelper authorizedUserHelper,
     IGroupUserRepository groupUserRepository,
     IGroupUserStore groupUserStore,
     IGroupRepository groupRepository,
     IGroupEventService groupEventService,
     IMailService mailService,
     IMapper mapper
     )
 {
     _authorizedUserHelper = authorizedUserHelper;
     _groupUserRepository  = groupUserRepository;
     _groupUserStore       = groupUserStore;
     _groupRepository      = groupRepository;
     _groupEventService    = groupEventService;
     _mailService          = mailService;
     _mapper = mapper;
     _user   = authorizedUserHelper.GetAuthorizedUser();
 }