Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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;
         }
     }
 }
Exemplo n.º 3
0
 public void RemoveStandardCategory(NavCategory category)
 {
     category.Selection -= OnCategorySelected;
     this.StandardNavButton.Items.Remove(category);
 }
Exemplo n.º 4
0
 public void AddStandardCategory(NavCategory category)
 {
     category.Selection -= OnCategorySelected;
     category.Selection += OnCategorySelected;
     this.StandardNavButton.Items.Add(category);
 }