public static bool EqualTabItem(MenuTabItem first, MenuTabItem second) { if (ReferenceEquals(first, second)) return true; if (first == null || second == null) return false; return first.Position == second.Position; }
public bool AllowDisplayElement(IEnumerable<IPluginArgument> arguments, MenuTabItem menuTabItem) { var result = false; foreach (var dvsAuthorizeFilterAttribute in menuTabItem.ControllerType.GetCustomAttributes(typeof(DVSAuthorizeFilterAttribute), true).Cast<DVSAuthorizeFilterAttribute>()) { if (dvsAuthorizeFilterAttribute.AllowedRoles.Any(roleType => _securityContext.GetAllRoles().Contains(roleType))) { result = true; } } return result; }
public bool AllowDisplayElement(IEnumerable<IPluginArgument> arguments, MenuTabItem menuTabItem) { var orderFulfillmentMenuTab = menuTabItem.MenuTubPluginAttribute as OrderFulfillmentMenuTabAttribute; if (orderFulfillmentMenuTab == null) return true; var userAccessHelper = new UserAccessHelper(_securityContext); var controllerAttribute = menuTabItem.ControllerType.GetCustomAttributes(true).FirstOrDefault(e => e.GetType() == typeof(DVSAuthorizeFilterAttribute)) as DVSAuthorizeFilterAttribute; if (controllerAttribute != null) { if (!userAccessHelper.IsActionAvaibleByStatus(menuTabItem.ControllerName, menuTabItem.DefaultActionName, controllerAttribute.AllowedRoles.Select(r => r.ToString()).ToArray())) { return false; } } if (_securityContext.CurrentUser.Roles.Select(r => r.RoleType).Any(rt => OrderAccessSecurity.OrderFulfillmentAccessUsers.AppraiserRoles.Contains(rt))) { var controllerThanNotAllowDraftAndPendingAssignment = new[] { typeof(ContactInfoController), typeof(UpdateOrderController), typeof(CommunicationController), typeof(DocumentsController), typeof(ImportantDatesController), typeof(OrderHistoryController), typeof(ConditionsController) }; var isTabThatNotVisibleInDraftPendingAssignment = controllerThanNotAllowDraftAndPendingAssignment.Contains(menuTabItem.ControllerType); if (isTabThatNotVisibleInDraftPendingAssignment) { var orderId = arguments.Find<RoutingDetailsPluginArgument>().GetOrderIdFromRoutes(); if (!orderId.HasValue) { return false; } var currentOrder = _orderManager.GetOrderById(orderId.Value); return currentOrder.OrderStatus != OrderStatus.Draft && currentOrder.OrderStatus != OrderStatus.PendingAssignment; } } return true; }
public bool IsCurrent(MenuTabItem menuTabItem) { return MenuTabItem.EqualTabItem(Current, menuTabItem); }
public CurrentMenuPluginResule(IEnumerable<MenuTabItem> menuTabItems, MenuTabItem current) { _menuTabItems = ValidationUtil.CheckOnNullAndThrowIfNull(menuTabItems); _current = ValidationUtil.CheckOnNullAndThrowIfNull(current); }