API/AdHocConfig.md
... ...
@@ -22,6 +22,9 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
22 22
//Initialize System
23 23
AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
24 24
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
25
+ AdHocSettings.AllowOverwritingReports = true;
26
+ AdHocSettings.AllowDeletingReports = true;
27
+ //After initializing, set global settings applicable to all users
25 28
AdHocSettings.GenerateThumbnails = True;
26 29
AdHocSettings.DashboardViewer = "Dashboards.aspx";
27 30
AdHocSettings.ShowSimpleModeViewer = True;
... ...
@@ -30,22 +33,8 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
30 33
AdHocSettings.ReportCssUrl = "Resources/css/Report.css";
31 34
AdHocSettings.ShowBetweenDateCalendar = True;
32 35
AdHocSettings.AdHocConfig = New CustomAdHocConfig();
33
- HttpContext.Current.Session("ReportingInitialized") = True;
34
-
35
- }
36
- // Store all global code here that applies to all users.
37
- public override void ConfigureSettings()
38
- {
39
- AdHocSettings.AllowOverwritingReports = true;
40
- AdHocSettings.AllowDeletingReports = true;
41
- }
42 36
43
- // AdHocSettings.AdHocConfig.PostLogin() must be called from
44
- // your application's login page after the user is authenticated
45
- // Place ALL user-specific or role-specific code here
46
- public override void PostLogin()
47
- {
48
- //Pass User Credentials
37
+ //Pass User Credentials. Set user-specific settings after we initialize the user
49 38
AdHocSettings.CurrentUserName = HttpContext.Current.Session["UserName"] as string;
50 39
AdHocSettings.CurrentUserIsAdmin = true;
51 40
AdHocSettings.VisibleDataSources = new string[] { "Orders", "Employees", "AdminData" };
... ...
@@ -58,7 +47,7 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
58 47
if (!role.Equals("Administrator"))
59 48
{
60 49
// Limit user to the orders table
61
- AdHocSettings.VisibleDataSources = new string[] { "Orders" };
50
+ AdHocSettings.VisibleDataSources = new string[] { "Orders" }; //Will override the previous setting
62 51
// Prevent the user from seeing private reports and overwriting shared reports
63 52
// Disable access to settings button.
64 53
AdHocSettings.CurrentUserIsAdmin = false;
... ...
@@ -66,6 +55,7 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
66 55
AdHocSettings.ShowSettingsButton = false;
67 56
AdHocSettings.HiddenCategories = new string[] { "Admin Reports", "Sensitive Reports" };
68 57
}
58
+ HttpContext.Current.Session("ReportingInitialized") = True;
69 59
}
70 60
71 61
// Gets a list of ReportInfo objects for all loadable reports stored.
... ...
@@ -274,6 +264,9 @@ public override void ProcessDataSet(DataSet ds, string reportPart)
274 264
'Initialize System
275 265
AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
276 266
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
267
+ 'After initializing, set global settings applicable to all users
268
+ AdHocSettings.AllowOverwritingReports = True
269
+ AdHocSettings.AllowDeletingReports = True
277 270
AdHocSettings.GenerateThumbnails = True
278 271
AdHocSettings.DashboardViewer = "Dashboards.aspx"
279 272
AdHocSettings.ShowSimpleModeViewer = True
... ...
@@ -283,19 +276,8 @@ public override void ProcessDataSet(DataSet ds, string reportPart)
283 276
AdHocSettings.ShowBetweenDateCalendar = True
284 277
AdHocSettings.AdHocConfig = New CustomAdHocConfig()
285 278
HttpContext.Current.Session("ReportingInitialized") = True
286
- End Sub
287 279
288
-'Store all global code here that applies to all users.
289
- Public Overrides Sub ConfigureSettings()
290
- AdHocSettings.AllowOverwritingReports = True
291
- AdHocSettings.AllowDeletingReports = True
292
- End Sub
293
-
294
- 'AdHocSettings.AdHocConfig.PostLogin() must be called from
295
- 'your application's login page after the user is authenticated
296
- 'Place ALL user-specific or role-specific code here
297
- Public Overrides Sub PostLogin()
298
- 'Pass User Credentials
280
+ 'Pass User Credentials. Set user-specific settings after we initialize the user
299 281
AdHocSettings.CurrentUserName = HttpContext.Current.Session("UserName").ToString()
300 282
AdHocSettings.CurrentUserIsAdmin = True
301 283
AdHocSettings.VisibleDataSources = New String() {"Orders", "Employees", "AdminData"}