// This is the core visit method the others are using. The permission must have been set before // getting here. internal User doTheVisit(string sitecode, AbstractCredentials credentials, AbstractPermission permission) { Site site = mySession.SiteTable.getSite(sitecode); DataSource src = site.getDataSourceByModality("HIS"); if (src == null) { throw new Exception("No HIS data source at site " + sitecode); } AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol)); myCxn = factory.getConnection(src); myCxn.Account.AuthenticationMethod = mySession.DefaultVisitMethod; if (!MdwsUtils.isValidCredentials(myCxn.Account.AuthenticationMethod, credentials, permission)) { throw new Exception("Invalid credentials"); } object result = null; if (myCxn.Account.AuthenticationMethod == VistaConstants.BSE_CREDENTIALS_V2WEB) { result = myCxn.authorizedConnect(credentials, permission, new DataSource() { ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString }); } else { result = myCxn.authorizedConnect(credentials, permission, null); } if (result.GetType().Name.EndsWith("Exception")) { throw (Exception)result; } else { return((User)result); } }
public static AbstractConnection authorizedConnect(string theUser, bool isBse) { string securityPhrase = (isBse ? "" : "NON-BSE"); MockApp theApp = getTheApp(securityPhrase); DataSource src = VistaSetups.getSrc(theApp.SiteTable, theApp.LoginSitecode); AbstractDaoFactory f = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol)); AbstractConnection cxn = f.getConnection(src); AbstractCredentials credentials = getVisitCredentials(theApp); AbstractPermission permission = new MenuOption(theApp.User.PermissionString); theApp.User = (User)cxn.authorizedConnect(credentials, permission, null); return(cxn); }