private AdminLinksViewModel CreateAdminLinksViewModel(AdminHomeNavigationSection? section = null)
        {
            var showApproveNewInternalUserLink = Task.Run(() =>
                authorizationService.AuthorizeActivity(typeof(SetUserApprovals)))
                .Result;

            var showAddNewEntryOrExitPointLink = Task.Run(() =>
                authorizationService.AuthorizeActivity(typeof(AddEntryOrExitPoint)))
                .Result;

            var showManageExistingInternalUserLink = Task.Run(() =>
                authorizationService.AuthorizeActivity(typeof(GetExistingInternalUsers)))
                .Result;

            var showDeleteNotificationLink = Task.Run(() =>
                authorizationService.AuthorizeActivity(typeof(DeleteExportNotification)))
                .Result;

            var model = new AdminLinksViewModel
            {
                ShowApproveNewInternalUserLink = showApproveNewInternalUserLink,
                ShowAddNewEntryOrExitPointLink = showAddNewEntryOrExitPointLink,
                ShowManageExistingInternalUserLink = showManageExistingInternalUserLink,
                ShowDeleteNotificationLink = showDeleteNotificationLink
            };

            if (section.HasValue)
            {
                model.ActiveSection = section.Value;
            }

            return model;
        }
Esempio n. 2
0
 public AdministrationController(CompositionContainer container
                                 , ShellViewModel shellViewModel
                                 , AdministrationViewModel _AdministrationViewModel
                                 , AdminTatScheduleViewModel _tatScheduleViewModel
                                 , VolumeAdjustmentsViewModel _volumeAdjustmentsViewModel
                                 , AdminLinksViewModel _adminLinksViewModel
                                 , PasswordChangeViewModel _passwordChangeViewMod
                                 )
 {
     this.container = container;
     this.administrationViewModel = _AdministrationViewModel;
     tatScheduleViewModel         = _tatScheduleViewModel;
     passwordChangeViewModel      = _passwordChangeViewMod;
     adminLinksViewModel          = _adminLinksViewModel;
     volumeAdjustmentsViewModel   = _volumeAdjustmentsViewModel;
     this.shellViewModel          = shellViewModel;
 }
Esempio n. 3
0
        private AdminLinksViewModel CreateAdminLinksViewModel(AdminHomeNavigationSection?section = null)
        {
            var showApproveNewInternalUserLink = Task.Run(() =>
                                                          authorizationService.AuthorizeActivity(typeof(SetUserApprovals)))
                                                 .Result;

            var showAddNewEntryOrExitPointLink = Task.Run(() =>
                                                          authorizationService.AuthorizeActivity(typeof(AddEntryOrExitPoint)))
                                                 .Result;

            var showManageExistingInternalUserLink = Task.Run(() =>
                                                              authorizationService.AuthorizeActivity(typeof(GetExistingInternalUsers)))
                                                     .Result;

            var showDeleteNotificationLink = Task.Run(() =>
                                                      authorizationService.AuthorizeActivity(typeof(DeleteExportNotification)))
                                             .Result;

            var showManageExternalUserLink = Task.Run(() =>
                                                      authorizationService.AuthorizeActivity(typeof(SetExternalUserStatus)))
                                             .Result;

            var model = new AdminLinksViewModel
            {
                ShowApproveNewInternalUserLink     = showApproveNewInternalUserLink,
                ShowAddNewEntryOrExitPointLink     = showAddNewEntryOrExitPointLink,
                ShowManageExistingInternalUserLink = showManageExistingInternalUserLink,
                ShowDeleteNotificationLink         = showDeleteNotificationLink,
                ShowManageExternalUserLink         = showManageExternalUserLink,
                ShowNotificationLinks = !User.IsInRole("readonly")
            };

            if (section.HasValue)
            {
                model.ActiveSection = section.Value;
            }

            return(model);
        }