Inheritance: VistaOption
コード例 #1
0
        public override bool success(string[] flds)
        {
            AbstractPermission ddrContext = new MenuOption(VistaConstants.DDR_CONTEXT);

            acct.setContext(ddrContext);

            VistaUserDao dao = new VistaUserDao(cxn);

            cxn.Uid = dao.getUserIdBySsn(creds.FederatedUid);

            return(true);
        }
コード例 #2
0
ファイル: MockSetups.cs プロジェクト: OSEHRA/mdo
 public static AbstractConnection authorizedConnect(string theUser, bool isBse)
 {
     string securityPhrase = (isBse ? "" : "NON-BSE");
     MockApp theApp = getTheApp(theUser, securityPhrase);
     DataSource src = 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;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        public override bool success(string[] flds)
        {
            // Set DDR context in order to add the requested context
            AbstractPermission ddrContext = new MenuOption(VistaConstants.DDR_CONTEXT);

            acct.setContext(ddrContext);

            // Get the UID while we have DDR context set anyway
            VistaUserDao dao = new VistaUserDao(cxn);

            cxn.Uid = dao.getUserIdBySsn(creds.FederatedUid);

            // Add the requested context to the user's account
            //acct.addContextInVista(cxn.Uid, acct.PrimaryPermission);

            return(true);
        }
コード例 #5
0
ファイル: MockConnection.cs プロジェクト: OSEHRA/mdo
        // This constructor is needed for API level tests.
        public MockConnection(string siteId, string protocol, bool updateRpc = false)
            : base(null)
        {
            this.DataSource = new DataSource();
            this.DataSource.SiteId = new SiteId(siteId, "Mock");
            this.DataSource.Protocol = protocol;

            _sqliteCxn = new XSqliteConnection(this.DataSource);

            this.Account = new MockAccount(this);
            //this.Account.IsAuthenticated = true;
            this.updateRpc = updateRpc;

            AbstractCredentials credentials = new VistaCredentials();
            credentials.AccountName = "AccessCode";
            credentials.AccountPassword = "******";
            AbstractPermission permission = new MenuOption(VistaConstants.MDWS_CONTEXT);
            permission.IsPrimary = true;
            this.Account.Permissions.Add(permission.Name, permission);
        }
コード例 #6
0
ファイル: AccountLib.cs プロジェクト: OSEHRA/mdws
        // This does an administrative visit in order to get the true user's data
        internal User getVisitorData(string userSitecode, string DUZ, string appPwd)
        {
            Site site = mySession.SiteTable.getSite(userSitecode);
            AbstractCredentials credentials = getAdministrativeCredentials(site);
            credentials.AuthenticationToken = userSitecode + '_' + credentials.LocalUid;
            credentials.SecurityPhrase = appPwd;

            string context = MdwsConstants.MDWS_CONTEXT;
            if (mySession.DefaultVisitMethod == MdwsConstants.NON_BSE_CREDENTIALS)
            {
                context = MdwsConstants.CPRS_CONTEXT;
            }

            // Here we do NOT set mySession.PrimaryPermission.  This context is being set
            // solely for the Admin user to get the true user's credentials.  mySession.PrimaryPermission
            // is for the true user.
            AbstractPermission permission = new MenuOption(context);
            permission.IsPrimary = true;

            User u = doTheVisit(userSitecode, credentials, permission);

            UserApi userApi = new UserApi();
            User trueUser = userApi.getUser(myCxn, DUZ);
            myCxn.disconnect();
            return trueUser;
        }
コード例 #7
0
ファイル: AccountLib.cs プロジェクト: OSEHRA/mdws
        public TaggedTextArray visitDoD(string pwd)
        {
            Site site = mySession.SiteTable.getSite(MdwsConstants.DOD_SITE);
            AbstractCredentials credentials = getAdministrativeCredentials(site);
            credentials.SecurityPhrase = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_PASSWORD];

            string context = MdwsConstants.MDWS_CONTEXT;
            if (mySession.DefaultVisitMethod == MdwsConstants.NON_BSE_CREDENTIALS)
            {
                context = MdwsConstants.CPRS_CONTEXT;
            }
            AbstractPermission permission = new MenuOption(context);
            permission.IsPrimary = true;

            TaggedTextArray result = new TaggedTextArray();
            try
            {
                User u = doTheVisit(site.Id, credentials, permission);
                result.results = new TaggedText[] { new TaggedText(site.Id, u.Uid) };
                addMyCxn2CxnSet();
                mySession.Credentials = credentials;
                mySession.PrimaryPermission = permission;
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
コード例 #8
0
ファイル: VistaAccount.cs プロジェクト: kunalkot/mdo
        public override bool success(string[] flds)
        {
            AbstractPermission ddrContext = new MenuOption(VistaConstants.DDR_CONTEXT);
            acct.setContext(ddrContext);

            VistaUserDao dao = new VistaUserDao(cxn);
            cxn.Uid = dao.getUserIdBySsn(creds.FederatedUid);

            return true;
        }
コード例 #9
0
        // This constructor is needed for API level tests.
        public MockConnection(string siteId, string protocol, bool updateRpc = false)
            : base(null)
        {
            this.DataSource = new DataSource();
            this.DataSource.SiteId = new SiteId(siteId, "Mock");
            this.DataSource.Protocol = protocol;

            //DP 3/24/2011
            //I commented out the line below, the pid should not be set to
            //"0" as the default, as all of the other subclasses of
            //AbstractCollection do not set it.  This was causing conflicts
            //b/w the MockConnection.XML file and the DaoX tests.

            //I will fix the affected tests (14 now fail as the exception
            //message has changed).

            //this.Pid = "0";

            setXmlSource(siteId, updateRpc);

            this.Account = new VistaAccount(this);
            this.updateRpc = updateRpc;

            AbstractCredentials credentials = new VistaCredentials();
            credentials.AccountName = "AccessCode";
            credentials.AccountPassword = "******";
            AbstractPermission permission = new MenuOption(VistaConstants.MDWS_CONTEXT);
            permission.IsPrimary = true;
            this.Account.Permissions.Add(permission.Name, permission);
            //permission = new MenuOption(VistaConstants.DDR_CONTEXT);
            //this.Account.Permissions.Add(permission.Name, permission);
            sysFileHandler = new VistaSystemFileHandler(this);
        }
コード例 #10
0
        /// <summary>
        /// This function is the heart of the connection pool dictionary. It connects to a site
        /// and attaches the event handlers by executing a standard gettimestamp request
        /// so the connection can immediately begin processing queued query threads
        /// </summary>
        /// <param name="site">Site to which to connect</param>
        /// <param name="addToCxnCollection">Should the site be added to the pools connection collection?</param>
        /// <returns></returns>
        AbstractConnection connectWithReturn(Site site, bool addToCxnCollection)
        {
            //Site[] sites = _poolSites.ToArray();

            Site currentSite = site;
            DataSource src = currentSite.Sources[0];
            AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
            AbstractConnection c = factory.getConnection(src);
            //c.ConnectionId = new Guid();
            c.Account = _account;
            c.Account = new VistaAccount(c);
            c.Account.AuthenticationMethod = _account.AuthenticationMethod;
            c.Account.Permissions = new Dictionary<string, AbstractPermission>();
            AbstractPermission cprs = new MenuOption("OR CPRS GUI CHART");
            cprs.IsPrimary = true;
            c.Account.Permissions.Add(cprs.Name, cprs);
            // this needs to be up here so we can reference it if an error occurs
            QueryThread qt = new QueryThread("", new VistaToolsDao(null), "getTimestamp", new object[] { });
            EventHandler eh = new EventHandler(QueryThreadChanged);

            try
            {
                User user = (User)c.authorizedConnect(_credentials, cprs, src);
                c.IsAvailable = true;
                // initiliaze this connection's eventhandler by making a standard timestamp request
                qt.setConnection(c);
                qt.Changed += eh;
                _currentActiveConnections++;
                qt.execute();

                if (!(qt.Result is string))
                {
                    throw new ConnectionException("Connection does not appear to be active");
                }

                if (addToCxnCollection)
                {
                    addConnection(currentSite.Id, c);
                }
                return c;
            }
            catch (Exception)
            {
                qt.Changed -= eh;
                c.IsAvailable = false;
                _currentActiveConnections--;
                try
                {
                    c.disconnect();
                }
                catch (Exception) { }
            }
            return null;
        }
コード例 #11
0
ファイル: VistaUserDao.cs プロジェクト: OSEHRA/mdo
 internal AbstractPermission getPrimaryMenuOption(string duz)
 {
     string arg = "$P($G(^VA(200," + duz + ",201)),U,1)";
     string optionIen = VistaUtils.getVariableValue(cxn, arg);
     if (optionIen == "")
     {
         return null;
     }
     arg = "$P($G(^DIC(19," + optionIen + ",0)),U,1)";
     string optionName = VistaUtils.getVariableValue(cxn, arg);
     MenuOption result = new MenuOption();
     result.PermissionId = optionIen;
     result.Name = optionName;
     result.IsPrimary = true;
     return result;
 }
コード例 #12
0
ファイル: ConnectionPool.cs プロジェクト: kunalkot/mdo
 void connect(object obj)
 {
     ConnectionThread cxn = (ConnectionThread)obj;
     try
     {
         cxn.Connection.connect();
         // Authenticated Vista Connection Handling
         if (this.PoolSource.Credentials != null) // should be an authenticated connection!
         {
             AbstractPermission permission = new MenuOption(VistaConstants.CAPRI_CONTEXT);
             permission.IsPrimary = true;
             if (String.IsNullOrEmpty(this.PoolSource.Credentials.AccountName) || String.IsNullOrEmpty(this.PoolSource.Credentials.AccountPassword))
             {
                 cxn.Connection.Account.AuthenticationMethod = VistaConstants.NON_BSE_CREDENTIALS; // if no A/V codes, visit
             }
             else
             {
                 cxn.Connection.Account.AuthenticationMethod = VistaConstants.LOGIN_CREDENTIALS;
             }
             cxn.Connection.Account.authenticateAndAuthorize(this.PoolSource.Credentials, permission);
         }
         // END Authenticated cxn handling
         else if (cxn.Connection is VistaPoolConnection) // else if pool cxn and no creds - get default state
         {
             ((VistaPoolConnection)cxn.Connection)._rawConnectionSymbolTable = ((VistaPoolConnection)cxn.Connection).getState();
         }
         this.TotalResources++;
         cxn.Connection.setTimeout(this.PoolSource.Timeout); // now gracefully timing out connections!
     }
     catch (Exception)
     {
         cxn.Connection.IsConnected = false;
     }
 }
コード例 #13
0
ファイル: ConnectionPoolTest.cs プロジェクト: kunalkot/mdo
 void login(AbstractConnection cxn)
 {
     AbstractPermission permission = new MenuOption(VistaConstants.CPRS_CONTEXT);
     permission.IsPrimary = true;
     cxn.Account.AuthenticationMethod = VistaConstants.LOGIN_CREDENTIALS;
     AbstractCredentials creds = new VistaCredentials();
     //creds.AccountName = "1programmer";
     //creds.AccountPassword = "******";
     creds.AccountName = "CLERKWARD01";
     creds.AccountPassword = "******";
     cxn.Account.authenticateAndAuthorize(creds, permission);
 }