Example #1
0
    //-------------------------------------------------------------------------------------------
    public static Boolean IsAuthorized(MetaColumn column)
    {
        var securedColumns = column.GetColumnPermissions(System.Web.Security.Roles.GetRolesForUser());
          if (securedColumns.Contains(ColumnActions.DenyRead))
               return false;

          return true;
    }
Example #2
0
    //-------------------------------------------------------------------------------------------
    public static Boolean IsShown(MetaColumn column)
    {
        // need to get the current page template
          var page = (System.Web.UI.Page)System.Web.HttpContext.Current.CurrentHandler;
          var pageTemplate = page.GetPageTemplate();

          var hideIn = column.GetAttribute<HideColumnInAttribute>();
          if (hideIn != null && (hideIn.PageTemplates.Contains(pageTemplate)))
               return false;

          var hideIfFiltered = column.GetAttribute<HideIfFiltered>();
          if (hideIfFiltered != null &&
               (System.Web.HttpContext.Current.Request[column.Name] != null ||
                    (hideIfFiltered.FilterName != null &&
                     System.Web.HttpContext.Current.Request[hideIfFiltered.FilterName] != null))
               )
               return false;

          var securedColumns = column.GetColumnPermissions(System.Web.Security.Roles.GetRolesForUser());
          if (securedColumns.Contains(ColumnActions.DenyRead))
               return false;

          //foreach (var secureColumn in securedColumns)
          //{
          //     if (securedColumn
          //}

          return true;
    }