Exemple #1
0
 /// <summary>
 /// Método construtor
 /// </summary>
 /// <param name="logger">Instância do serviço de logs.</param>
 /// <param name="configuration">Instância do container de configurações.</param>
 /// <param name="systemUser">Instância do usuário do sistema.</param>
 /// <param name="accessor">Instância do accessor do contexto http.</param>
 public DefaultPermissionsAuthorizationService(ILogger <DefaultPermissionsAuthorizationService> logger, IConfiguration configuration, ISystemUser systemUser, IHttpContextAccessor accessor)
 {
     this.Configuration = configuration;
     this.Logger        = logger;
     this.SystemUser    = systemUser;
     this.Accessor      = accessor;
 }
 public SystemManagerController(ISystemUser systemUser, ISystemRole systemRole, IRoleRelationship roleRelationship, IAuthority authority)
 {
     this._authority        = authority;
     this._systemRole       = systemRole;
     this._systemUser       = systemUser;
     this._roleRelationship = roleRelationship;
 }
Exemple #3
0
 public AccountController(
     SignInManager <UserIdentity> signInManager,
     UserManager <UserIdentity> userManager,
     IUserAppService userAppService,
     IGlobalConfigurationAppService globalConfigurationAppService,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IAuthenticationSchemeProvider schemeProvider,
     IEventService events,
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler bus,
     IConfiguration configuration,
     IUserManageAppService userManageAppService,
     ISystemUser user,
     ILogger <AccountController> logger)
 {
     Bus             = bus;
     _signInManager  = signInManager;
     _userManager    = userManager;
     _userAppService = userAppService;
     _globalConfigurationAppService = globalConfigurationAppService;
     _interaction          = interaction;
     _clientStore          = clientStore;
     _schemeProvider       = schemeProvider;
     _events               = events;
     _configuration        = configuration;
     _userManageAppService = userManageAppService;
     _user          = user;
     _logger        = logger;
     _notifications = (DomainNotificationHandler)notifications;
 }
Exemple #4
0
        public LecturerPageVM(string dbcontextName, ISystemUser loggedInLectuer) : base(dbcontextName)
        {
            try
            {
                rowsToReturn   = 20;
                IsConfirmed    = false;
                SubgridContext = SubgridContext.Groups;
                //commands
                NewModeCmd         = new NewModeCmd(this);
                SaveFormCmd        = new SaveCmd(this);
                DeleteCmd          = new DeleteCmd(this);
                CancelCmd          = new CancelCmd(this);
                NewPassHashCmd     = new NewPassHashCmd(this);
                ToggleAdminRoleCmd = new ToggleAdminRoleCmd(this);
                //TODO: will likely need to attach lecturer to the DbContext..
                User             = UnitOfWork.LecturerRepo.Get(loggedInLectuer.Id);
                SearchTxt        = "";
                SelectedLecturer = new Lecturer();
                //TODO: figure out Async with EF and Pagination/ limit the results (limit probably best)
                List <Lecturer> results = UnitOfWork.LecturerRepo.GetTopXFromSearch(null, rowsToReturn).ToList();
                Lecturers = new ObservableCollection <Lecturer>(results);

                Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.Message, FeedbackType.Error);
            }
        }
Exemple #5
0
 public MyGroupsLecturerPageVM(ISystemUser appUser, Group selectedGroup, string dbcontextName) : base(dbcontextName)
 {
     //Initial Setup
     try
     {
         IsConfirmed = false;
         User        = (Lecturer)appUser;
         UserRole    = Role.Lecturer;
         RowLimit    = 10;
         //if group passed in load it else start in create mode.
         if (selectedGroup.Id != 0)
         {
             SelectedGroup = UnitOfWork.GroupRepository.Get(selectedGroup.Id);
         }
         else
         {
             SelectedGroup = new Group();
         }
         SubgridContext = SubgridContext.Students;
         ChangeSubgridContext(SubgridContext);
         GroupSearchTxt = "";
         Groups         = new ObservableCollection <Group>(UnitOfWork.GroupRepository.GetTop(RowLimit).ToList());
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
        public AuditLog CreateLogRecord(ISystemUser user)
        {
            Type entityType = DbEntry.Entity.GetType().GetEntityType();

            if (!EntityTrackingConfiguration.IsTrackingEnabled(entityType))
            {
                return(null);
            }

            DateTime changeTime = DateTime.UtcNow;
            var      newlog     = new AuditLog
            {
                UserId       = user.UserId,
                ClinicId     = user.ClinicId,
                EventDateUTC = changeTime,
                EventType    = _eventType,
                TypeId       = EntityTrackingConfiguration.GetTypeId(entityType),
                RecordId     = RecordId
            };

            var logDetails = _changeLogDetailsAuditor.GetLogDetails();

            logDetails.ForEach(x => x.Log = newlog);
            newlog.LogDetails             = logDetails;

            if (newlog.LogDetails.Any())
            {
                return(newlog);
            }
            else
            {
                return(null);
            }
        }
 public MyGroupsStudentPageVM(ISystemUser appUser, Group selectedGroup, string dbcontextName) : base(dbcontextName)
 {
     //Initial Setup
     try
     {
         IsConfirmed = false;
         User        = (Student)appUser;
         UserRole    = Role.Student;
         RowLimit    = 10;
         //if group passed into page select it. otherwise go into new mode.
         if (selectedGroup.Id != 0)
         {
             SelectedGroup = UnitOfWork.GroupRepository.Get(selectedGroup.Id);
         }
         else
         {
             SelectedGroup = new Group();
         }
         SubgridContext = SubgridContext.Students;
         ChangeSubgridContext(SubgridContext);
         GroupSearchTxt = "";
         Groups         = new ObservableCollection <Group>(UnitOfWork.GroupRepository.GetForStudent((Student)User, RowLimit).ToList());
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
        public void Should_send_forgotten_password_email_when_email_address_exists()
        {
            MailMessage forgottenPasswordEmail = new MailMessage();

            MockRepository mocks = new MockRepository();
            ISystemUser    user  = mocks.CreateMock <ISystemUser>();
            IForgottenPasswordMailFactory mailFactory      = mocks.CreateMock <IForgottenPasswordMailFactory>();
            ISystemUserRepository         repository       = mocks.CreateMock <ISystemUserRepository>();
            IEncryptionEngine             encryptionEngine = mocks.CreateMock <IEncryptionEngine>();
            IMailSender sender = mocks.CreateMock <IMailSender>();

            using (mocks.Record())
            {
                Expect.Call(repository.GetByEmailAddress("*****@*****.**")).Return(user);
                Expect.Call(user.Password).Return("encryptedPassword");
                Expect.Call(encryptionEngine.Decrypt("encryptedPassword")).Return("clearTextPassword");

                Expect.Call(mailFactory.CreateEmail("*****@*****.**", "clearTextPassword")).Return(forgottenPasswordEmail);

                sender.SendMail(forgottenPasswordEmail);
            }

            using (mocks.Playback())
            {
                IForgottenPasswordMailer mailer = new ForgottenPasswordMailer(encryptionEngine, mailFactory, sender);
                bool emailWasSent = mailer.SendForgottenPasswordEmail("*****@*****.**", repository);
                Assert.That(emailWasSent);
            }

            mocks.VerifyAll();
        }
Exemple #9
0
 public Tracker(DbContext context, ISystemUser user, ILogPersister persister)
 {
     _dbContext    = context;
     _systemUser   = user;
     _logPersister = persister;
     _logBuilders  = new List <LogBuilder>();
 }
 public InSessoinLecturerQandAVM(ISystemUser appUser, Question selectedQuestion, string dbcontextName) : base(appUser, dbcontextName)
 {
     try
     {
         //Setup
         if (selectedQuestion != null)
         {
             if (selectedQuestion.Id != 0)
             {
                 SelectedSession  = UnitOfWork.SessionRepository.GetSessionWithQuestion(selectedQuestion);//Might need to attach this to the UoW. not sure yet
                 SelectedQuestion = UnitOfWork.QuestionRepository.Get(selectedQuestion.Id);
                 QandAMode        = QandAMode.Question;
                 Questions        = new ObservableCollection <Question>(UnitOfWork.QuestionRepository.GetFromSession(SelectedSession).ToList());
                 ///Answers loaded when question selected
             }
             else
             {
                 ShowFeedback($"Cannot load session for question with id value: {selectedQuestion.Id}", FeedbackType.Error);
             }
         }
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
Exemple #11
0
        internal void MarkSigned(short value, EPVDatabase Database, ISystemUser User)
        {
            SignedFlag = value;
            Signer     = (SecurityUser)User;
            SignDate   = DateTime.Now;

            Save(Database, User);
        }
Exemple #12
0
        internal void MarkCreated(short value, EPVDatabase database, ISystemUser user)
        {
            CreateFlag = value;
            Creator    = (SecurityUser)user;
            CreateDate = DateTime.Now;

            Save(database, user);
        }
        private void SaveModifiedRow(EPVDatabase database, ISystemUser user)
        {
            QueryParameters parameters = CreateParameters();

            parameters.Add("userId", user.Id);

            database.ExecuteQuery(UpdateQuery, parameters);
        }
Exemple #14
0
 public ClientsController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IClientAppService clientAppService, ISystemUser user) : base(notifications, mediator)
 {
     _clientAppService = clientAppService;
     _user             = user;
 }
 public AccountController(
     IUserManageAppService userAppService,
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     ISystemUser systemUser) : base(notifications, mediator)
 {
     _userAppService = userAppService;
     _systemUser     = systemUser;
 }
 public EmailController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IEmailAppService emailAppService,
     ISystemUser systemUser) : base(notifications, mediator)
 {
     _emailAppService = emailAppService;
     _systemUser      = systemUser;
 }
Exemple #17
0
 public BaseLecturerQandAPageVM(ISystemUser appUser, string dbcontextName) : base(dbcontextName)
 {
     QandAMode    = QandAMode.Question;
     UserRole     = Role.Lecturer;
     User         = UnitOfWork.LecturerRepo.Get(appUser.Id);
     IsConfirmed  = false;
     QandAMode    = QandAMode.Answer;
     ImageHandler = new ImageHandler("public_html/honors/images");
 }
 public GlobalConfigurationController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IGlobalConfigurationAppService globalConfigurationSettingsAppService,
     ISystemUser systemUser) : base(notifications, mediator)
 {
     _globalConfigurationSettingsAppService = globalConfigurationSettingsAppService;
     _systemUser = systemUser;
 }
        /* Só a primeira execução vai demorar os dois segundos a outras 5 vai ser rapida, pois vai retornar da memória */
        public List<SystemUserAddressProtocol> GetAddresses()
        {
            if(_realUser == null)
                _realUser = new AdminUser(FirstName,UserName);

            if(_realUserAddresses ==  null)
                _realUserAddresses = _realUser.GetAddresses();

            return _realUserAddresses;     
        }
 public UserAdminController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IUserManageAppService userManageAppService,
     ISystemUser user,
     IRoleManagerAppService roleManagerAppService) : base(notifications, mediator)
 {
     _userManageAppService = userManageAppService;
     _user = user;
 }
 public PermessDataController(IBuyer buyer, IProduct product, IStock stock, IPermess permess, ISalesInvoice sales, PermessDbContext context, ISystemUser user)
 {
     _buyer   = buyer;
     _product = product;
     _stock   = stock;
     _permess = permess;
     _sales   = sales;
     _context = context;
     _user    = user;
 }
        public void SetUserContext()
        {
            IIdentity userIdentity = _webContext.GetUserIdentity();

            if (userIdentity != null)
            {
                ISystemUser systemUser = _repository.GetByEmailAddress(userIdentity.Name);
                _webContext.SetItem(CURRENT_USER, systemUser);
            }
        }
        public GlobalConfigurationAppService(
            IGlobalConfigurationSettingsRepository globalConfigurationSettingsRepository,
            ISystemUser systemUser,
            IMediatorHandler bus)
        {
            Bus     = bus;
            _mapper = GlobalConfigurationMapping.Mapper;
            _globalConfigurationSettingsRepository = globalConfigurationSettingsRepository;

            _systemUser = systemUser;
        }
Exemple #24
0
        internal void ClearNew(EPVDatabase database, ISystemUser user)
        {
            string          query      = DispatcherService.Resources.Doc.MaterialPermit.ClearNew;
            QueryParameters parameters = new QueryParameters("documentId", Id);

            parameters.Add("userId", user.Id);

            database.ExecuteQuery(query, parameters);

            IsNew = false;
        }
 public GlobalConfigurationAppService(
     IMapper mapper,
     IGlobalConfigurationSettingsRepository globalConfigurationSettingsRepository,
     ISsoUnitOfWork unitOfWork,
     ISystemUser systemUser)
 {
     _mapper = mapper;
     _globalConfigurationSettingsRepository = globalConfigurationSettingsRepository;
     _unitOfWork = unitOfWork;
     _systemUser = systemUser;
 }
 public ManagementController(
     IUserManageAppService userAppService,
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IMapper mapper,
     ISystemUser systemUser) : base(notifications, mediator)
 {
     _userAppService = userAppService;
     this._mapper    = mapper;
     _systemUser     = systemUser;
 }
Exemple #27
0
 public EventsController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IEventStoreAppService eventStoreAppService,
     IIdentityServerEventStore identityServerEventStore,
     ISystemUser user) : base(notifications, mediator)
 {
     _eventStoreAppService     = eventStoreAppService;
     _identityServerEventStore = identityServerEventStore;
     _user = user;
 }
Exemple #28
0
 public PersistedGrantsController(
     INotificationHandler <DomainNotification> notifications,
     IMediatorHandler mediator,
     IPersistedGrantAppService persistedGrantAppService,
     ISystemUser systemUser,
     UserManager <UserIdentity> manager) : base(notifications, mediator)
 {
     _persistedGrantAppService = persistedGrantAppService;
     _systemUser = systemUser;
     _manager    = manager;
 }
 public BaseStudentQandA(ISystemUser appUser, string dbcontextName) : base(dbcontextName)
 {
     //commands
     NewModeWithParamCmd = new NewModePrivateQuestionCmd(this);
     //setup
     UserRole     = Role.Student;
     User         = UnitOfWork.StudentRepo.Get(appUser.Id);
     IsConfirmed  = false;
     QandAMode    = QandAMode.Question;
     ImageHandler = new ImageHandler("public_html/honors/images");
 }
Exemple #30
0
 public UserManagementCommandHandler(
     IUnitOfWork uow,
     IMediatorHandler bus,
     INotificationHandler <DomainNotification> notifications,
     IUserService userService,
     ISystemUser user)
     : base(uow, bus, notifications)
 {
     _userService = userService;
     _user        = user;
 }