217874a16c8eb5e13a675815b9fcab98e26e9333
Home.md
| ... | ... | @@ -72,6 +72,7 @@ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
| 72 | 72 | AdHocSettings.CurrentUserName = GetUserName(); |
| 73 | 73 | AdHocSettings.CurrentUserTenantId = GetTenantID(); |
| 74 | 74 | AdHocSettings.CurrentUserIsAdmin = (GetUserRole() == "Admin"); |
| 75 | +AdHocSettings.CurrentUserRoles = new string[] {(string)HttpContext.Current.Session["Role"]}; |
|
| 75 | 76 | AdHocSettings.VisibleDataSources = new string[] { "Products", "Orders", "Customers" }; |
| 76 | 77 | ``` |
| 77 | 78 | |
| ... | ... | @@ -87,9 +88,15 @@ if(AdHocSettings.CurrentUserIsAdmin) |
| 87 | 88 | } |
| 88 | 89 | else |
| 89 | 90 | { |
| 90 | - Izenda.AdHoc.AdHocSettings.VisibleDataSources = new string[] { "Products", "Orders", "Customers" }; |
|
| 91 | - Izenda.AdHoc.AdHocSettings.OutputTypes["sql"].ShowInToolbar = false; //Hides the SQL output icon on the toolbar for non-admins |
|
| 92 | - Izenda.AdHoc.AdHocSettings.HiddenFilters["ShipCountry"] = GetUserCountry(); |
|
| 91 | + Izenda.AdHoc.AdHocSettings.HiddenFilters["ShipCountry"] = GetUserCountry(); //Hide data that the user isn't authorized to view |
|
| 92 | + Izenda.AdHoc.AdHocSettings.VisibleDataSources = new string[] { "Products", "Orders", "Customers" }; //non-admins only see certain data sources |
|
| 93 | + Izenda.AdHoc.AdHocSettings.OutputTypes["sql"].ShowInToolbar = false; //Hides the SQL output icon on the toolbar for non-admins |
|
| 94 | + if(new List<string>(AdHocSettings.CurrentUserRoles).Contains("ReportViewer")) { |
|
| 95 | + //Role based logic |
|
| 96 | + } |
|
| 97 | + else if (new List<string>(AdHocSettings.CurrentUserRoles).Contains("ReportDesigner")) { |
|
| 98 | + //Role based logic |
|
| 99 | + } |
|
| 93 | 100 | } |
| 94 | 101 | ``` |
| 95 | 102 |