Exemplo n.º 1
0
        }//END GetFormList class

        //  ==================================================================================
        /// <summary>
        /// This class returns a list of user options objects.
        /// </summary>
        /// <returns>List of EvOption: a list of user options objects</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Execute the method for retrieving a list of user objects
        ///
        /// 2. Return the list of user objects.
        /// </remarks>
        //  ----------------------------------------------------------------------------------
        private List <EvOption> GetUserList( )
        {
            EdUserprofiles  users = new EdUserprofiles( );
            List <EvOption> list  = users.GetList(String.Empty, String.Empty, true);

            return(list);
        }//END GetUserList class
Exemplo n.º 2
0
        // ==================================================================================
        /// <summary>
        /// This method gets the application object from the list.
        ///
        /// </summary>
        /// <returns>ClientApplicationData</returns>
        // ----------------------------------------------------------------------------------
        private bool loadUserProfile(
            Evado.UniForm.Model.Command PageCommand)
        {
            this.LogMethod("loadUserProfile");
            this.LogDebug("ServiceUserProfile UserId: " + this.ServiceUserProfile.UserId);
            this.LogDebug("UserAuthenticationState: " + this.ServiceUserProfile.UserAuthenticationState);

            //
            // Initialise the methods variables and objects.
            //
            Evado.Digital.Bll.EdUserprofiles userProfiles =
                new Evado.Digital.Bll.EdUserprofiles(this.ClassParameters);
            //
            // if an anonoymous command is encountered create a user profile for a patient.
            //
            if (PageCommand.Type == Evado.UniForm.Model.CommandTypes.Anonymous_Command ||
                this.ServiceUserProfile.UserAuthenticationState == EvUserProfileBase.UserAuthenticationStates.Anonymous_Access)
            {
                this.LogEvent("Anonymous command encountered");

                this.Session.UserProfile            = new EdUserProfile( );
                this.Session.UserProfile.UserId     = this.ServiceUserProfile.UserId;
                this.Session.UserProfile.CommonName = this.ServiceUserProfile.UserId;
                this.Session.UserProfile.Roles      = String.Empty;

                this.ClassParameters.UserProfile = this.Session.UserProfile;

                return(true);
            }

            //
            // IF the profile tokens match for token access return true.
            //
            if (this.ServiceUserProfile.UserAuthenticationState == EvUserProfileBase.UserAuthenticationStates.Token_Access)
            {
                this.LogDebug("Token Access");

                if (this.Session.UserProfile.Token == this.ServiceUserProfile.Token)
                {
                    this.ClassParameters.UserProfile = this.Session.UserProfile;

                    this.LogDebug("User profile for {0} EXISTS IN SESSION", this.ServiceUserProfile.UserId);

                    return(true);
                }

                this.LogDebug("User profile for token {0} IS EMPTY GENERATING NEW PROFILE.", this.ServiceUserProfile.Token);

                this.Session.UserProfile = userProfiles.getItem(this.ServiceUserProfile.Token);

                this.LogAdapter(userProfiles.Log);
            }

            else
            {
                //
                // Not user id exist false.
                //
                if (this.ServiceUserProfile.UserId == String.Empty)
                {
                    this.LogEvent("Error: User DOES NOT EXIST");

                    return(false);
                }
                //
                // IF the profile exists and matches the current user return true.
                //
                if (this.Session.UserProfile.UserId.ToLower( ) == this.ServiceUserProfile.UserId.ToLower( ) &&
                    this.ServiceUserProfile.UserId != String.Empty)
                {
                    this.ClassParameters.UserProfile = this.Session.UserProfile;

                    this.LogDebug("User profile for {0} EXISTS IN SESSION", this.ServiceUserProfile.UserId);

                    return(true);
                }

                //
                // Try to get the user profile form the passed user profile object.
                //
                if (this.Session.UserProfile.UserId == String.Empty)
                {
                    this.LogDebug("User profile for {0} IS EMPTY GENERATING NEW PROFILE.", this.ServiceUserProfile.UserId);

                    this.Session.UserProfile = userProfiles.getItem(this.ServiceUserProfile.UserId);

                    this.LogDebugClass(userProfiles.Log);
                }
            }

            this.ClassParameters.UserProfile = this.Session.UserProfile;
            this.ServiceUserProfile.UserId   = this.Session.UserProfile.UserId;

            //
            // if the user profile does not exist exit false.
            //
            this.LogDebug("Expired Date {0}", this.Session.UserProfile.ExpiryDate);

            if (this.Session.UserProfile.ExpiryDate <= DateTime.Now)
            {
                this.LogEvent("User profile for {0} HAS EXPIRED.", this.Session.UserProfile.UserId);

                return(false);
            }

            //
            // if the user profile does not exist exit false.
            //
            if (this.Session.UserProfile.UserId == String.Empty)
            {
                this.LogAction("User profile for " + this.ServiceUserProfile.UserId + " DOES NOT EXIST.");

                return(false);
            }

            this.LogAction("User profile for " + this.Session.UserProfile.UserId + " GENERATED");

            this.LogDebug(this.Session.UserProfile.getUserProfile(true));

            this.ClassParameters.UserProfile = this.Session.UserProfile;
            if (this.Session.UserProfile.hasAdministrationAccess == false &&
                this.Session.UserProfile.hasEvadoManagementAccess == false)
            {
                this.Session.SelectedOrgId  = this.Session.UserProfile.OrgId;
                this.Session.SelectedUserId = this.Session.UserProfile.UserId;
            }
            return(true);
        }//END loadUserProfile method.