public DetailViewData(FirmaSession currentFirmaSession, Person personToView, Project.UserProjectGridSpec userProjectGridSpec, string basicProjectInfoGridName, string basicProjectInfoGridDataUrl, UserNotificationGridSpec userNotificationGridSpec, string userNotificationGridName, string userNotificationGridDataUrl, string activateInactivateUrl, ActionItemsUserGridSpec actionItemsUserGridSpec, string actionItemsGridName, string actionItemsGridDataUrl) : base(currentFirmaSession) { Person = personToView; PageTitle = personToView.GetFullNameFirstLast() + (!personToView.IsActive ? " (inactive)" : string.Empty); EntityName = "User"; EditPersonOrganizationPrimaryContactUrl = SitkaRoute <PersonOrganizationController> .BuildUrlFromExpression(c => c.EditPersonOrganizationPrimaryContacts(personToView)); IndexUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index()); if (FirmaWebConfiguration.AuthenticationType == AuthenticationType.LocalAuth) { EditDetailBasicsUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.EditUser(personToView.PrimaryKey)); ChangePasswordUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.ChangePassword(personToView.PrimaryKey)); } // And again, here we should take Current FirmaSession, not the person. -- SLG & SG UserHasPersonViewPermissions = new UserViewFeature().HasPermission(currentFirmaSession, personToView).HasPermission; UserHasPersonManagePermissions = new UserEditFeature().HasPermissionByFirmaSession(currentFirmaSession); UserHasAdminPermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); CurrentPersonCanBeImpersonatedByCurrentUser = new FirmaImpersonateUserFeature().HasPermission(currentFirmaSession, personToView).HasPermission; IsViewingSelf = !currentFirmaSession.IsAnonymousUser() && currentFirmaSession.PersonID == personToView.PersonID; EditRolesLink = UserHasAdminPermissions ? ModalDialogFormHelper.MakeEditIconLink(SitkaRoute <UserController> .BuildUrlFromExpression(c => c.EditRoles(personToView)), $"Edit Roles for User - {personToView.GetFullNameFirstLast()}", true) : new HtmlString(string.Empty); UserProjectGridSpec = userProjectGridSpec; BasicProjectInfoGridName = basicProjectInfoGridName; BasicProjectInfoGridDataUrl = basicProjectInfoGridDataUrl; UserNotificationGridSpec = userNotificationGridSpec; UserNotificationGridName = userNotificationGridName; UserNotificationGridDataUrl = userNotificationGridDataUrl; ActivateInactivateUrl = activateInactivateUrl; TenantHasStewardshipAreas = MultiTenantHelpers.GetProjectStewardshipAreaType() != null; ActionItemsUserGridSpec = actionItemsUserGridSpec; ActionItemsGridName = actionItemsGridName; ActionItemsGridDataUrl = actionItemsGridDataUrl; }
public GridJsonNetJObjectResult <ActionItem> ActionItemsUserGridJsonData(PersonPrimaryKey personPrimaryKey) { var person = personPrimaryKey.EntityObject; var gridSpec = new ActionItemsUserGridSpec(CurrentFirmaSession); var actionItems = person.ActionItemsWhereYouAreTheAssignedToPerson.OrderByDescending(x => x.DueByDate).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ActionItem>(actionItems, gridSpec); return(gridJsonNetJObjectResult); }
public ViewResult Detail(PersonPrimaryKey personPrimaryKey) { ShowWarningAboutInactivatedUserForOrganizationPrimaryContact(personPrimaryKey.EntityObject); var person = personPrimaryKey.EntityObject; var userNotificationGridSpec = new UserNotificationGridSpec(); var userNotificationGridDataUrl = SitkaRoute <UserController> .BuildUrlFromExpression( x => x.UserNotificationsGridJsonData(personPrimaryKey)); var basicProjectInfoGridSpec = new Views.Project.UserProjectGridSpec(CurrentFirmaSession, person) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} where {person.GetFullNameFirstLast()} is a Contact", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} where {person.GetFullNameFirstLast()} is a Contact", SaveFiltersInCookie = true }; const string basicProjectInfoGridName = "userProjectListGrid"; var basicProjectInfoGridDataUrl = SitkaRoute <UserController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(person)); var activateInactivateUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.ActivateInactivatePerson(person)); var actionItemsGridSpec = new ActionItemsUserGridSpec(CurrentFirmaSession); var actionItemsGridName = "actionItems"; var actionItemsGridDataUrl = SitkaRoute <ActionItemController> .BuildUrlFromExpression(c => c.ActionItemsUserGridJsonData(person)); var viewData = new DetailViewData(this.CurrentFirmaSession, person, basicProjectInfoGridSpec, basicProjectInfoGridName, basicProjectInfoGridDataUrl, userNotificationGridSpec, "userNotifications", userNotificationGridDataUrl, activateInactivateUrl, actionItemsGridSpec, actionItemsGridName, actionItemsGridDataUrl); return(RazorView <Detail, DetailViewData>(viewData)); }