private bool CheckUserRights(NavCategory category) { List <Right> rights = new List <Right>(0); bool hasPrivilage = true; bool hasCreatePrivilage = true; bool hasViewOrEditPrivilage = true; if (observer != null && !observer.user.IsAdmin()) { hasPrivilage = false; hasCreatePrivilage = false; hasViewOrEditPrivilage = false; rights = observer.GetRights(category.FunctionalityCode); if (rights.Count == 0) { if (observer.hasAcendentPrivilege(category.FunctionalityCode)) { hasPrivilage = true; hasCreatePrivilage = true; hasViewOrEditPrivilage = true; } else { return(false); } } foreach (Right right in rights) { if (string.IsNullOrWhiteSpace(right.rightType)) { hasPrivilage = true; hasCreatePrivilage = true; hasViewOrEditPrivilage = true; } else if (right.rightType.Equals(RightType.CREATE.ToString())) { hasCreatePrivilage = true; } else if (right.rightType.Equals(RightType.EDIT.ToString())) { hasViewOrEditPrivilage = true; } else if (right.rightType.Equals(RightType.VIEW.ToString())) { hasViewOrEditPrivilage = true; } } } if (hasPrivilage || hasCreatePrivilage || hasViewOrEditPrivilage) { return(true); } return(false); }
private void OnCategorySelected(object item) { if (item != null && item is NavCategory) { NavCategory category = (NavCategory)item; if (category.Block != null) { category.Block.Category = category; this.DashboardLayout.AddBlock(category.Block); category.IsEnabled = false; } } }
public void RemoveStandardCategory(NavCategory category) { category.Selection -= OnCategorySelected; this.StandardNavButton.Items.Remove(category); }
public void AddStandardCategory(NavCategory category) { category.Selection -= OnCategorySelected; category.Selection += OnCategorySelected; this.StandardNavButton.Items.Add(category); }