Esempio n. 1
0
        public UserSecurityKeyArray getUserSecurityKeys(string uid)
        {
            UserSecurityKeyArray result = new UserSecurityKeyArray();

            if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK"))
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(uid))
            {
                result.fault = new FaultTO("Empty UID");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Dictionary <string, AbstractPermission> d = User.getPermissions(mySession.ConnectionSet.BaseConnection, uid, PermissionType.SecurityKey);
                result = new UserSecurityKeyArray(d);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Esempio n. 2
0
    /// <summary>
    /// US:866 gets MDWS security keys and transfers them to the database
    /// </summary>
    /// <param name="lUserID"></param>
    /// <param name="bTransfer"></param>
    /// <param name="lCount"></param>
    /// <returns></returns>
    public CStatus GetMDWSSecurityKeys(
        long lUserID,
        bool bTransfer,
        out long lCount)
    {
        //status
        lCount = 0;

        //check to make sure the MDWS connection is valid
        CStatus status = IsMDWSValid();

        if (!status.Status)
        {
            return(status);
        }

        //get the teams from MDWS
        //get the users security keys
        UserSecurityKeyArray usk = GetMDWSSOAPClient().getUserSecurityKeys(lUserID.ToString());

        if (usk == null || usk.fault != null)
        {
            //return new CMDWSStatus(usk.fault);
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        //in some cases we do not want to transfer the keys...
        if (bTransfer)
        {
            //transfer the patients to the checklist db
            CMDWSTransfer transfer = new CMDWSTransfer(this);
            status = transfer.TransferSecurityKeys(
                lUserID,
                usk,
                out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        return(new CStatus());
    }
Esempio n. 3
0
    /// <summary>
    /// US:840
    /// helper to determine if MDWS is valid
    /// </summary>
    /// <returns></returns>
    public CStatus IsMDWSValid()
    {
        //check the connection to MDWS, will attempt to reconnect
        //if necessary
        CAppUser appUser = new CAppUser(this);

        //get the users security keys, this is how we test the connection
        UserSecurityKeyArray usk = GetMDWSSOAPClient().getUserSecurityKeys(appUser.UserID.ToString());

        if (usk != null && usk.fault != null)
        {
            long             lUserID        = 0;
            EmrSvcSoapClient mdwsSOAPClient = null;
            CStatus          status         = MDWSLogin(
                appUser.MDWSUID.ToString(),
                appUser.MDWSPWD.ToString(),
                appUser.SiteID,
                out lUserID,
                out mdwsSOAPClient);
            if (!status.Status)
            {
                return(status);
            }
        }

        /*todo: debug
         * else
         * {
         *  string strkeys = String.Empty;
         *  foreach (UserSecurityKeyTO to in usk.keys)
         *  {
         *      strkeys += to.name + "\r\n";
         *  }
         *
         *  strkeys += "";
         * }*/

        return(new CStatus());
    }