protected internal static bool IsDenyInDescription(MenuReportDescriptionAttribute attribute) { if (attribute == null) { return(true); } bool denyPermission = false; if (attribute.PermissionObjects != null) { foreach (EIDSSPermissionObject permission in attribute.PermissionObjects) { if (permission != 0 && attribute.PermissionActions != null) { foreach (string action in attribute.PermissionActions) { switch (action) { case PermissionHelper.Select: denyPermission = !EidssUserContext.User.HasPermission(PermissionHelper.SelectPermission(permission)); break; case PermissionHelper.Execute: denyPermission = !EidssUserContext.User.HasPermission(PermissionHelper.ExecutePermission(permission)); break; case PermissionHelper.Insert: denyPermission = !EidssUserContext.User.HasPermission(PermissionHelper.InsertPermission(permission)); break; case PermissionHelper.Update: denyPermission = !EidssUserContext.User.HasPermission(PermissionHelper.UpdatePermission(permission)); break; case PermissionHelper.Delete: denyPermission = !EidssUserContext.User.HasPermission(PermissionHelper.DeletePermission(permission)); break; } } if (denyPermission) { break; } } } } return(denyPermission); }
protected void RegisterAllStandartReports() { DataView lookup = GetDeniedReportsLookup(); foreach (MethodInfo info in typeof(IReportFactory).GetMethods()) { MenuReportDescriptionAttribute attribute = GetMenuActionDescriptionAttribute(info); if (!IsDenyInDescription(attribute) && !IsDenyInDataGroup(info) && !IsDenyInCustomization(info)) { lookup.RowFilter = string.Format("strReportAlias = '{0}'", attribute.Caption); bool avaliable = lookup.Count == 0; IMenuAction category; if (avaliable && TryGetSubMenuCategory(attribute.SubMenu, out category)) { RegisterStandartReport(category, attribute, info); } } } }
protected abstract void RegisterStandartReport(IMenuAction category, MenuReportDescriptionAttribute attribute, MethodInfo info);