Example #1
1
 public UserArray(IList<User> mdo)
 {
     if (mdo == null || mdo.Count == 0)
     {
         return;
     }
     User[] userAry = new User[mdo.Count];
     mdo.CopyTo(userAry, 0);
     buildArray(userAry);
 }
Example #2
0
        public UserArray(User[] mdoUsers)
        {
            if (mdoUsers == null)
            {
                return;
            }

            buildArray(mdoUsers);
        }
Example #3
0
 void buildArray(User[] mdo)
 {
     users = new UserTO[mdo.Length];
     for (int i = 0; i < mdo.Length; i++)
     {
         users[i] = new UserTO(mdo[i]);
     }
     count = mdo.Length;
 }
Example #4
0
 public User getLdapUser()
 {
     IApplicationContext ctx = ContextRegistry.GetContext();
     StringTestObject testObj = (StringTestObject)ctx.GetObject("LDAP");
     User user = new User();
     user.Domain = testObj.get("domain");
     user.UserName = testObj.get("username");
     user.Pwd = testObj.get("password");
     return user;
 }
Example #5
0
 public static User getDodUser()
 {
     User result = new User();
     result.setSSN("");
     result.setName("");
     result.Uid = "";
     result.LogonSiteId = new SiteId("", "");
     result.PermissionString = VistaConstants.CAPRI_CONTEXT;
     return result;
 }
Example #6
0
 public TaggedUserArray(string tag, User user)
 {
     this.tag = tag;
     if (user == null)
     {
         this.count = 0;
         return;
     }
     this.users = new UserTO[1];
     this.users[0] = new UserTO(user);
     this.count = 1;
 }
Example #7
0
 public UserArray(User[] mdoUsers)
 {
     if (mdoUsers == null)
     {
         return;
     }
     users = new UserTO[mdoUsers.Length];
     for (int i = 0; i < mdoUsers.Length; i++)
     {
         users[i] = new UserTO(mdoUsers[i]);
     }
     count = mdoUsers.Length;
 }
Example #8
0
 internal static User getTestUser(string userTag)
 {
     IApplicationContext ctx = ContextRegistry.GetContext();
     StringTestObject testObj = (StringTestObject)ctx.GetObject(userTag);
     User user = new User();
     user.Uid = testObj.get("userDUZ");
     user.Name = new PersonName(testObj.get("userName"));
     user.SSN = new SocSecNum(testObj.get("userSSN"));
     user.LogonSiteId = new SiteId(testObj.get("siteCode"), testObj.get("siteName"));
     user.UserName = testObj.get("accessCode");
     user.Pwd = testObj.get("verifyCode");
     user.PermissionString = testObj.get("context");
     return user;
 }
Example #9
0
 public TaggedUserArray(string tag, User[] mdoUsers)
 {
     this.tag = tag;
     if (mdoUsers == null)
     {
         this.count = 0;
         return;
     }
     users = new UserTO[mdoUsers.Length];
     for (int i = 0; i < mdoUsers.Length; i++)
     {
         users[i] = new UserTO(mdoUsers[i]);
     }
     count = mdoUsers.Length;
 }
Example #10
0
 public UserTO(User mdoUser)
 {
     if (mdoUser == null)
     {
         return;
     }
     this.name = mdoUser.Name == null ? "" : mdoUser.Name.getLastNameFirst();
     this.SSN = mdoUser.SSN == null ? "" : mdoUser.SSN.toString();
     this.DUZ = mdoUser.Uid;
     this.siteId = mdoUser.LogonSiteId == null ? "" : mdoUser.LogonSiteId.Id;
     this.office = mdoUser.Office;
     this.phone = mdoUser.Phone;
     this.pager = mdoUser.VoicePager;
     if (mdoUser.Service != null)
     {
         this.service = mdoUser.Service.Name;
     }
     this.title = mdoUser.Title;
     this.orderRole = mdoUser.OrderRole;
     this.userClass = mdoUser.UserClass;
     this.greeting = mdoUser.Greeting;
     this.emailAddress = mdoUser.EmailAddress;
     this.username = mdoUser.UserName;
     this.demographics = new DemographicSetTO(mdoUser.Demographics);
     this.domain = mdoUser.Domain;
     //if (mdoUser.SecurityKeys != null)
     //{
     //    this.securityKeys = new UserSecurityKeyArray(mdoUser.SecurityKeys);
     //}
     //if (mdoUser.MenuOptions != null)
     //{
     //    this.menuOptions = new UserOptionArray(mdoUser.MenuOptions);
     //}
     //if (mdoUser.DelegatedOptions != null)
     //{
     //    this.delegatedOptions = new UserOptionArray(mdoUser.DelegatedOptions);
     //}
     //if (mdoUser.Divisions != null)
     //{
     //    this.divisions = new TaggedTextArray(mdoUser.Divisions);
     //}
 }
Example #11
0
 public void close()
 {
     _cxnSet.disconnectAll();
     _user = null;
     _patient = null;
 }
Example #12
0
 internal User toUserFromGetUser(string[] response)
 {
     if (response == null || response.Length == 0)
     {
         return null;
     }
     string[] rex = StringUtils.split(response[0], StringUtils.CRLF);
     rex = StringUtils.trimArray(rex);
     if (rex.Length != 1)
     {
         throw new Exception("Multiple records returned");
     }
     string[] flds = StringUtils.split(rex[0], StringUtils.CARET);
     User result = new User();
     result.Uid = flds[0];
     result.Name = new PersonName(flds[1]);
     result.Phone = flds[2];
     result.VoicePager = flds[3];
     if (flds[4] != "")
     {
         result.VoicePager += (flds[3] != "" ? "/" : "") + flds[4];
     }
     result.Office = flds[5];
     if (flds[6] != "")
     {
         result.Title = getUserTitle(flds[6]);
     }
     result.SSN = new SocSecNum(flds[7]);
     if (flds[8] != "")
     {
         result.Service = getUserService(flds[8]);
     }
     return result;
 }
Example #13
0
        /// <summary>
        /// Visit multiple data sources without a login.
        /// </summary>
        /// <remarks>
        /// Requires no previous login.  Used by daemon apps to visit multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionStr">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string userSitecode, string userName, string DUZ, string SSN, string permissionStr)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing pwd");
            }
            else if (String.IsNullOrEmpty(sourceList))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(userSitecode))
            {
                result.fault = new FaultTO("Missing userSitecode");
            }
            else if (String.IsNullOrEmpty(userName))
            {
                result.fault = new FaultTO("Missing userName");
            }
            else if (String.IsNullOrEmpty(DUZ))
            {
                result.fault = new FaultTO("Missing DUZ");
            }
            else if (String.IsNullOrEmpty(SSN))
            {
                result.fault = new FaultTO("Missing SSN");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(permissionStr))
            {
                permissionStr = mySession.DefaultPermissionString;
            }

            try
            {
                // Build the credentials
                Site site = mySession.SiteTable.getSite(userSitecode);
                DataSource src = site.getDataSourceByModality("HIS");

                AbstractCredentials creds = new VistaCredentials();
                creds.AuthenticationSource = src;
                creds.AuthenticationToken = userSitecode + '_' + DUZ;
                creds.FederatedUid = SSN;
                creds.LocalUid = DUZ;
                creds.SecurityPhrase = pwd;
                creds.SubjectName = userName;
                creds.SubjectPhone = "";

                User user = new User();
                user.UserName = userName;
                user.Uid = DUZ;
                user.SSN = new SocSecNum(SSN);

                mySession.PrimaryPermission = new MenuOption(permissionStr);

                // Make next call think there's been a login
                mySession.Credentials = creds;
                mySession.User = user;

                // visitSites
                return visitSites(pwd, sourceList, permissionStr);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return result;
        }
Example #14
0
 internal User[] toUsers(String rtn)
 {
     ArrayList lst = new ArrayList();
     String[] entries = StringUtils.split(rtn, StringUtils.CRLF);
     for (int i = 0; i < entries.Length; i++)
     {
         if (entries[i] == "")
         {
             continue;
         }
         String[] flds = StringUtils.split(entries[i], StringUtils.CARET);
         if (StringUtils.isNumeric(flds[0]))
         {
             User user = new User();
             user.Uid = flds[0];
             user.setName(flds[1]);
             if (flds.Length > 2 && !String.IsNullOrEmpty(flds[2]))
             {
                 user.Title = flds[2];
             }
             lst.Add(user);
         }
     }
     return (User[])lst.ToArray(typeof(User));
 }
Example #15
0
 //-----------------------------------------------------------------------------------------
 //internal string decodeProviderType(string value)
 //{
 //    if (value == "1")
 //    {
 //        return "FULL TIME";
 //    }
 //    if (value == "2")
 //    {
 //        return "PART TIME";
 //    }
 //    if (value == "3")
 //    {
 //        return "C & A";
 //    }
 //    if (value == "4")
 //    {
 //        return "FEE BASIS";
 //    }
 //    if (value == "5")
 //    {
 //        return "HOUSE STAFF";
 //    }
 //    throw new ArgumentException("Invalid value");
 //}
 internal void toUserFromLogin(string response, User user)
 {
     if (response == "")
     {
         return;
     }
     string[] flds = StringUtils.split(response, StringUtils.CRLF);
     user.Uid = flds[0];
     user.Name = new PersonName(flds[1]);
     string[] subflds = StringUtils.split(flds[3], StringUtils.CARET);
     user.LogonSiteId = new SiteId(subflds[2], subflds[1]);
     user.Title = flds[4];
     if (flds[5] != "")
     {
         user.Service = new Service();
         user.Service.Name = flds[5];
     }
 }
Example #16
0
 public User getUserInfo(string duz)
 {
     User result = new User();
     result.Uid = duz;
     result.LogonSiteId = cxn.DataSource.SiteId;
     setUserInfo(result);
     return result;
 }
Example #17
0
 internal User[] toUsers(string[] response)
 {
     if (response == null || response.Length == 0)
     {
         return null;
     }
     response = StringUtils.trimArray(response);
     User[] result = new User[response.Length];
     for (int i = 0; i < response.Length; i++)
     {
         string[] flds = StringUtils.split(response[i], StringUtils.CARET);
         result[i] = new User();
         result[i].Uid = flds[0];
         result[i].Name = new PersonName(flds[1]);
         result[i].Phone = flds[2];
         result[i].Office = flds[4];
         //flds[5] is FM access
         result[i].Gender = flds[6];
         result[i].DOB = VistaTimestamp.toUtcString(flds[7]);
         //flds[8] is disuser
         result[i].Title = flds[9];
         result[i].SSN = new SocSecNum(flds[10]);
         //flds[11] is nickname
         result[i].SigText = flds[12] + "\r\n" + flds[13];
         //flds[14] is service IEN
         if (flds[15] != "")
         {
             result[i].Service = new Service();
             result[i].Service.Name = flds[15];
         }
         //flds[16] is Provider Class IEN
         result[i].UserClass = flds[17];
         result[i].PrimaryPermission = new MenuOption(flds[19], flds[20]);
     }
     return result;
 }
Example #18
0
 public void setLoginSiteProperties(User user)
 {
     if (user == null || StringUtils.isEmpty(user.Uid))
     {
         throw new ArgumentException("No user ID for site");
     }
     VistaQuery vq = new VistaQuery("ORWU USERINFO");
     string rtn = (String)cxn.query(vq);
     if (rtn == null)
     {
         throw new DataException("Unable to get user info");
     }
     string[] parts = StringUtils.split(rtn, StringUtils.CARET);
     user.Uid = parts[0];
     user.setName(parts[1]);
     user.OrderRole = parts[5];
     vq = new VistaQuery("XWB GET VARIABLE VALUE");
     string arg = "@\"^VA(200," + user.Uid + ",1)\"";
     vq.addParameter(vq.REFERENCE, arg);
     rtn = (string)cxn.query(vq);
     if (rtn == "")
     {
         throw new DataException("Unable to get user SSN");
     }
     parts = StringUtils.split(rtn, StringUtils.CARET);
     user.SSN = new SocSecNum(parts[8]);
 }
Example #19
0
 public void setUserInfo(User user)
 {
     string DUZ = user.Uid;
     string arg = "$P($G(^VA(200," + DUZ + ",0)),\"^\",1)";
     arg += "_\"^\"_" + "$P($G(^VA(200," + DUZ + ",1)),\"^\",9)";
     arg += "_\"^\"_" + "$P($G(^VA(200," + DUZ + ",.14)),\"^\",1)";
     arg += "_\"^\"_" + "$P($G(^VA(200," + DUZ + ",.13)),\"^\",2)";
     arg += "_\"^\"_" + "$P($G(^VA(200," + DUZ + ",.13)),\"^\",8)";
     arg += "_\"^\"_" + "$P($G(^ECC(730,$S($D(^VA(200," + DUZ + ",\"QAR\")):^VA(200," + DUZ + ",\"QAR\"),1:-1),0)),\"^\",1)";
     arg += "_\"^\"_" + "$G(^DIC(3.1,$S($P(^VA(200," + DUZ + ",0),\"^\",9):$P(^VA(200," + DUZ + ",0),\"^\",9),1:-1),0))";
     string response = "";
     try
     {
         response = VistaUtils.getVariableValue(cxn, arg);
     }
     catch (Exception e)
     {
         if (e.Message.Contains("M  ERROR"))
         {
             throw new ArgumentException("No such DUZ");
         }
         else
         {
             throw e;
         }
     }
     setUserProperties(user, response);
 }
Example #20
0
 public void setUserInfoAtLogin(User user)
 {
     VistaQuery vq = new VistaQuery("XUS GET USER INFO");
     string response = (string)cxn.query(vq);
     toUserFromLogin(response, user);
 }
Example #21
0
 internal void setUserProperties(User user, string response)
 {
     if (response == "")
     {
         return;
     }
     string[] flds = StringUtils.split(response, StringUtils.CARET);
     user.Name = new PersonName(flds[0]);
     user.SSN = new SocSecNum(flds[1]);
     user.Office = flds[2];
     user.Phone = flds[3];
     user.VoicePager = flds[4];
     if (flds[5] != "")
     {
         user.Service = new Service();
         user.Service.Name = flds[5];
     }
     user.Title = flds[6];
 }
Example #22
0
 public UserPatientTO(User user, Patient patient)
 {
     this.user = new UserTO(user);
     this.patient = new PatientTO(patient);
 }