//Get a list of roles to which the user belongs public string[] GetUserRoles() { string[] roles; if ((this as BaseClasses.IUserRoleRecord) != null) { string role = ((BaseClasses.IUserRoleRecord) this).GetUserRole(); roles = new string[] { role }; } else { BaseClasses.IUserRoleTable roleTable = ((BaseClasses.IUserIdentityTable) this.TableAccess).GetUserRoleTable(); if (roleTable == null) { return(null); } else { ColumnValueFilter filter = BaseFilter.CreateUserIdFilter(roleTable, this.GetUserId()); BaseClasses.Data.OrderBy order = new BaseClasses.Data.OrderBy(false, false); BaseClasses.Data.BaseFilter join = null; ArrayList roleRecords = roleTable.GetRecordList( join, filter, null, order, BaseClasses.Data.BaseTable.MIN_PAGE_NUMBER, BaseClasses.Data.BaseTable.MAX_BATCH_SIZE); ArrayList roleList = new ArrayList(roleRecords.Count); foreach (BaseClasses.IUserRoleRecord roleRecord in roleRecords) { roleList.Add(roleRecord.GetUserRole()); } roles = (string[])roleList.ToArray(typeof(string)); } } return(roles); }
public void DatabindLoginsForEmail() { string logList = ""; // get the email address from the url argument string cryptarg = ""; string uemail = ""; try { cryptarg = this.Request.QueryString["Email"]; uemail = ((BaseApplicationPage)this.Page).Decrypt(cryptarg, false); } catch { EmailSetupError(GetResourceValue("Msg:ErrorProcessing")); return; } if (string.IsNullOrEmpty(uemail)) { EmailSetupError(GetResourceValue("Msg:NoEmail")); return; } // add the email address to the InformationLabel string lblInfo = this.InformationLabel.Text; if (lblInfo.IndexOf(uemail) < 0) { this.InformationLabel.Text = lblInfo + " " + uemail; } // get the table used for login info IUserIdentityTable userTable = (IUserIdentityTable)(BaseClasses.Configuration.ApplicationSettings.Current.GetUserIdentityTable()); if (userTable == null) { EmailSetupError(GetResourceValue("Msg:NoLoginTable")); return; } // get all the login records containing the email address BaseFilter fltr = new ColumnValueFilter(userTable.UserEmailColumn, uemail); GroupBy grpby = new GroupBy(false, false); OrderBy ordby = new OrderBy(false, false); ArrayList logRecs = userTable.GetRecordList(fltr, grpby, ordby, 0, 100); if (logRecs.Count < 1) { EmailSetupError(GetResourceValue("Txt:NoSigninInfo") + " " + uemail); return; } // for each login record, add the username and password to the result string h1 = GetResourceValue("Txt:UsernameCol"); string h2 = GetResourceValue("Txt:PasswordCol"); string stlTable = "style=\"font-family:Verdana, Arial, Georgia, sans serif; font-size:12px;\""; string stlName = "style=\"color: #bbbbbb; padding-bottom: 6px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\""; string stlPwd = "style=\"color: #bbbbbb; padding-bottom: 20px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\""; string stlNameval = "style=\"color: #555555; padding-bottom: 6px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\""; string stlPwdval = "style=\"color: #555555; padding-bottom: 20px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\""; logList = ""; foreach (IUserIdentityRecord logRec in logRecs) { string uname = "<td " + stlName + ">" + h1 + "</td>"; uname += "<td " + stlNameval + ">" + "<pre>" + logRec.GetUserName() + "</pre>" + "</td>"; string upwd = "<td " + stlPwd + ">" + h2 + "</td>"; upwd += "<td " + stlPwdval + ">" + "<pre>" + logRec.GetUserPassword() + "</pre>" + "</td>"; logList += "<tr>" + uname + "</tr><tr>" + upwd + "</tr>" + Environment.NewLine; } // update the textbox with the login list this.MyLoginInfo.Text = "<table width=100% " + stlTable + ">" + Environment.NewLine + logList + "</table>"; return; }