API/AdHocConfig.md
... ...
@@ -78,7 +78,6 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
78 78
79 79
//Pass User Credentials. Set user-specific settings after we initialize the user
80 80
AdHocSettings.CurrentUserName = HttpContext.Current.Session["UserName"] as string;
81
- AdHocSettings.CurrentUserIsAdmin = HttpContext.Current.Request.Params["UserIsAdmin"] == null ? false : HttpContext.Current.Request.Params["UserIsAdmin"].ToString().ToLower() == "true" ? true : false;
82 81
AdHocSettings.VisibleDataSources = new string[] { "Orders", "Employees", "AdminData" };
83 82
84 83
//Filters results for data sources containing ClientID
... ...
@@ -86,6 +85,7 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
86 85
87 86
//Multi-Role Scenario - Apply specific limitations to certain roles
88 87
string role = HttpContext.Current.Session["Role"] as string;
88
+ AdHocSettings.CurrentUserIsAdmin = role == "Administrator" ? true : false;
89 89
if (!role.Equals("Administrator"))
90 90
{
91 91
// Limit user to the orders table
... ...
@@ -97,6 +97,14 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
97 97
AdHocSettings.ShowSettingsButton = false;
98 98
AdHocSettings.HiddenCategories = new string[] { "Admin Reports", "Sensitive Reports" };
99 99
}
100
+ if (role.Equals("Viewer"))
101
+ {
102
+ //Limit users' ability to save, modify, or delete reports
103
+ AdHocsettings.ShowSaveControls = false;
104
+ AdHocSettings.AllowDeletingReports = false;
105
+ //Limit users' ability to design reports
106
+ AdHocSettings.ShowDesignLinks = false;
107
+ }
100 108
HttpContext.Current.Session("ReportingInitialized") = True;
101 109
}
102 110