예제 #1
0
        /// <summary>
        /// Gets users content interaction by contentId
        /// </summary>
        /// <param name="userId">The userId</param>
        /// <param name="contentId">The id of the content to get.</param>
        /// <param name="contentType">0=All or Empty string;1=Rate;</param>
        /// <returns>List<MemberContentInteraction></MemberContentInteraction></returns>
        public List <MemberContentInteraction> GetInteractions(string memberId, string contentId, string contentType)
        {
            const string logMethodName = ".GetInteractions(string memberId, string contentId, string contentType) - ";

            Log.Debug(logMethodName + "Begin Method");

            Int32 iContentType = 0;

            Int32.TryParse(contentType, out iContentType);

            return(IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserInteractions(Int32.Parse(memberId), contentId, iContentType).ToDomainObject());
        }
예제 #2
0
        public IdentityResult RetrieveIdentity(Dictionary <string, object> context)
        {
            const string logMethodName = ".RetrieveIdentity(Dictionary<string, object> context) - ";

            _log.Debug(logMethodName + "Begin Method");

            // Based on partner name, Populate sso custom attributes from ASAMember Model retrieved by call to SAL
            String         partnerName   = (String)context["partnerName"];
            String         optionalParam = (String)context["optionalParam"];
            IdentityResult result        = new IdentityResult();

            try
            {
                string          memberPath     = UtilityMethods.ReadConfigValue("pathGetMember");
                string          memberResponse = WebServiceRequester.MakeServiceCall(memberPath);
                SiteMemberModel memberModel    = UtilityMethods.DeserializeResponse <SiteMemberModel>(memberResponse);

                bool getsAdditionalValues = true;

                //Connection with Interships.com
                if (partnerName == "SaltIDP/Internships/PSP_OAuthDevConnection_To_Internships" || partnerName == "SaltIDP/Internships/PSP_OAuthProdConnection_To_Internships")
                {
                    getsAdditionalValues = false;
                    result = AddInternshipsAttributes(result, context, optionalParam, memberModel.PrimaryEmailKey);
                }

                //Connection with community Jive Prod
                if (partnerName.Contains("SaltIDP/Jive"))
                {
                    result = AddJiveAttributes(result, memberModel, optionalParam);
                }
                //Connection with remote Learner
                else if (partnerName == "SaltIDP/RemoteLearner/PSP_Dev_ConnectionTo_MoodlePortal" || partnerName == "SaltIDP/RemoteLearner/PSP_Test_ConnectionTo_MoodlePortal" || partnerName == "SaltIDP/RemoteLearner/PSP_Stage_ConnectionTo_MoodlePortal" || partnerName == "SaltIDP/RemoteLearner/PSP_Prod_ConnectionTo_MoodlePortal")
                {
                    result = AddRemoteLearnerAttributes(result, memberModel);

                    //Setup (create/update) user in Courses
                    MoodleUser mu = new MoodleUser(memberModel);
                    mu.SetupUser();
                }

                result = AddSSOCoreAttributes(result, memberModel, partnerName, getsAdditionalValues);
            }
            catch (Exception ex)
            {
                _log.Error(logMethodName + ex);
                throw ex;
            }
            _log.Debug(logMethodName + "End Method");

            return(result);
        }
예제 #3
0
        public bool DeleteLoan(string id)
        {
            int loanId          = Convert.ToInt32(id);
            var userId          = _memberAdapter.GetMemberIdFromContext();
            var serviceResponse = SaltServiceAgent.DeleteLoan(userId, loanId);

            if (!serviceResponse)
            {
                Log.Debug("End Method");
                throw new WebFaultException <string>("{Failed to delete" + "}", System.Net.HttpStatusCode.BadRequest);
            }
            return(serviceResponse);
        }
예제 #4
0
        /// <summary>
        /// QC Issue # 2123
        /// will retrieve the Ref_ExceptionError.BusinessDescription column value given the Ref_Exception.ExceptionErrorCode
        /// from the logging database and add it to the List.
        /// </summary>
        /// <param name="repsonseMessageList">List that the exception error will be added to.</param>
        /// <param name="messageDetails">string which contains the message details to be added to the response message list</param>
        /// <returns>Boolean - true/message added, false/failed to add message to list, instead "No Description Found" error was added </returns>
        public bool AddMessageDetails(ResponseMessageList responseMessageList, string messageDetails)
        {
            Log.Debug("Entering AddMessage() ...");
            bool            success = true;
            ResponseMessage responseMessage;

            if (messageDetails == String.Empty)
            {
                Log.Error("message Details Argument is empty.");
                string Msg = String.Format("Message Details argument is empty. ");
                responseMessage = new ResponseMessage(Msg);
                success         = false;
            }
            else
            {
                responseMessage = new ResponseMessage(messageDetails);
            }


            responseMessageList.Add(responseMessage);

            return(success);
        }
예제 #5
0
        public void SetupUser()
        {
            const string logMethodName = ".SetupUser() - ";

            _log.Debug(logMethodName + "Begin Method");

            //check if user exists in moodle
            var existingUser = GetUser();

            bool userUpdated = false;
            int  newUserId   = -1;

            if (existingUser.id > 0)
            {
                userUpdated = UpdateUser();
            }
            else
            {
                //create moodle account
                newUserId = CreateUser();
            }

            //if user exists in Moodle, create enrollment in Elis
            if (userUpdated || newUserId > 0)
            {
                EnrollUserIntoUsersets();
            }

            _log.Debug(logMethodName + "End Method");
        }
예제 #6
0
        /// <summary>
        /// setup a task to call Qualtric's Target Audience API createUser, so we don't have to wait for it to finish.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <returns></returns>
        public void CreateUser(ASAMemberModel member)
        {
            const string logMethodName = ".CreateUser(ASAMemberModel member) - ";

            Log.Debug(logMethodName + "Begin Method");

            Task.Factory.StartNew(() => { CreateUserProcess(member); });

            Log.Debug(logMethodName + "End Method");
        }
예제 #7
0
 public SelfReportedAdapter()
 {
     _log.Debug("ASA.Web.Services.SelfReportedService.SelfReportedAdapter() object being created ...");
 }
예제 #8
0
        public ActionResult SSOService()
        {
            // Either an authn request has been received or login has just completed in response to a previous authn request.

            _log.Debug("SSO Service Begin");
            string partnerSP   = null;
            string myCurrentSP = SAMLIdentityProvider.GetPartnerPendingResponse();
            Dictionary <string, object> paramDictionary = new Dictionary <string, object> {
                { "optionalParam", Request.Params["optionalParam"] }
            };

            if (Request.Form.AllKeys.Contains("SAMLRequest") || (Request.QueryString.AllKeys.Contains("SAMLRequest") && (Request.QueryString.AllKeys.Contains("RelayState") || Request.QueryString.AllKeys.Contains("Signature"))))
            {
                // Receive the authn request from the service provider (SP-initiated SSO).
                _log.Debug("Calling ReceiveSSO");
                SAMLIdentityProvider.ReceiveSSO(Request, out partnerSP);
                myCurrentSP = SAMLIdentityProvider.GetPartnerPendingResponse();
                _log.Debug("Received SSO from " + partnerSP);
            }

            // If the user isn't logged in at the identity provider, force the user to login.
            if (!User.Identity.IsAuthenticated)
            {
                _log.Debug("Redirecting to login");
                FormsAuthentication.RedirectToLoginPage();
                return(new EmptyResult());
            }


            // The user is logged in at the identity provider.
            // Respond to the authn request by sending a SAML response containing a SAML assertion to the SP.
            // Use the configured or logged in user name as the user name to send to the service provider (SP).
            // Include some user attributes.
            string userName = WebConfigurationManager.AppSettings[AppSettings.SubjectName];
            IDictionary <string, string> attributes = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(userName))
            {
                try
                {
                    string memberPath = UtilityMethods.ReadConfigValue("pathGetMember");
                    _log.Debug("Calling " + memberPath);
                    string          memberResponse = WebServiceRequester.MakeServiceCall(memberPath);
                    SiteMemberModel memberModel    = UtilityMethods.DeserializeResponse <SiteMemberModel>(memberResponse);
                    userName = memberModel.MembershipId.ToString();
                    bool getsAdditionalValues = true;

                    //determine which SP, and populate the respective member attributes
                    myCurrentSP = SAMLIdentityProvider.GetPartnerPendingResponse();
                    //Connection with remote Learner
                    if (myCurrentSP.Contains("oldmoney.remote-learner.net") || myCurrentSP.Contains("saltcourses.saltmoney.org"))
                    {
                        attributes = AddRemoteLearnerAttributes(attributes, memberModel);

                        //Setup (create/update) user in Courses
                        MoodleUser mu = new MoodleUser(memberModel);
                        mu.SetupUser();
                    }

                    if (myCurrentSP.Contains("sso.online.tableau.com"))
                    {
                        attributes = AddTableauAttributes(attributes, memberModel);
                    }

                    if (myCurrentSP.Contains("community.saltmoney.org"))
                    {
                        String optionalParam = (String)paramDictionary["optionalParam"];
                        attributes = AddJiveAttributes(attributes, memberModel, optionalParam);
                    }

                    _log.Debug("Calling AddSSOCoreAttributes");
                    attributes = AddSSOCoreAttributes(attributes, memberModel, myCurrentSP, getsAdditionalValues);
                    _log.Debug("Returned from  AddSSOCoreAttributes with " + attributes.Count() + " Attributes");
                }
                catch (Exception ex)
                {
                    _log.Error(ex);
                    throw ex;
                }
            }
            try {
                _log.Debug("Calling SendSSO for " + userName);
                SAMLIdentityProvider.SendSSO(Response, userName, attributes);
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                throw ex;
            }
            return(new EmptyResult());
        }
예제 #9
0
 public AppToolAdapter()
 {
     _log.Debug("ASA.Web.Services.AppToolService.AppToolAdapter() object being created ...");
     _proxy = new InvokeAppToolService();
 }
예제 #10
0
        /// <summary>
        /// Retrieves user based upon the NatvieGuid in Active directory.
        /// This is the most preffered method for accessing a member from XWeb do not use the others unless you have no other option.
        /// </summary>
        /// <param name="systemId">NativeID from AD.</param>
        /// <returns>
        /// Populated member model.
        /// </returns>
        public ASAMemberModel GetMember(Guid systemId)
        {
            const string logMethodName = ".GetMember(Guid systemId) - ";

            Log.Debug(logMethodName + "Begin Method");

            var member = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetUserByActiveDirectoryKey(systemId.ToString()).ToDomainObject();

            Log.Debug(logMethodName + "End Method");
            return(member);
        }