Integration/User-Types.md
... ...
@@ -51,31 +51,15 @@ public class CustomAdHocConfig : DatabaseAdHocConfig
51 51
//AdHocSettings.PdfPrintMode = PdfMode.EOPDF;
52 52
//PhantomJS PDF uses an EXE on the web server that produces the export
53 53
AdHocSettings.PdfPrintMode = PdfMode.PhantomJs;
54
-
55
- //Get cookie values from a cookie named Authentication
56
- //This assumes there are only 3 values separated by a |
57
- //Assuming the first value is username and second is tenant setting it below
58
- if(Request.Cookies["Authentication"] != null)
59
- {
60
- string authVals = Request.Cookies["Authentication"].Value;
61
- string[] cookieVals = authVals.Split(new char[] {'|'});
62
- AdHocSettings.CurrentUserName = cookieVals[0];
63
- }
64 54
65
- //Pull new Datasource from DB based on user name
66 55
//Remember to add <%@ Import Namespace="System.Data" %> to your imports
67
- DataSet dsDataSource = AdHocContext.Driver.GetDataSet(AdHocContext.Driver.CreateCommand(string.Format("SELECT agDSN,agSqlServer,XenID FROM Agencies WHERE agID = {0}", AdHocSettings.CurrentUserName)));
56
+ DataSet tables = AdHocContext.Driver.GetDataSet(AdHocContext.Driver.CreateCommand(
57
+ string.Format("SELECT roleName FROM EmployeeRoles WHERE EmployeeID = {0}", AdHocSettings.CurrentUserName)));
58
+ string[] userRoles = new string[tables.Tables[0].Rows.Count];
59
+ for (int i = 0; i < tables.Tables[0].Rows.Count; i++)
60
+ userRoles [i] = tables.Tables[0].Rows[i][0].ToString();
68 61
69
- string[] dbResults = new string[ds.Tables[0].Rows.Count];
70
-
71
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
72
- results[i] = ds.Tables[0].Rows[i][0].ToString();
73
-
74
- AdHocSettings.SqlServerConnectionString = "Put Together Connection String";
75
-
76
- //Get and set role from cookie value
77
- //Assuming insight is the second value of the cookie
78
- AdHocSettings.CurrentUserRoles = new string[] { cookieVals[1] };
62
+ AdHocSettings.CurrentUserRoles = userRoles ;
79 63
//Set the number of available drop downs for roles in the misc tab of the designer
80 64
//+1 is for the default value of Everyone
81 65
AdHocSettings.NumSharedDropdowns = AdHocSettings.CurrentUserRoles.Length + 1;