diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 41bf612..6eb4669 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -120,9 +120,10 @@ namespace AIAHTML5.ADMIN.API.Controllers int userId = jsonData["userId"].Value(); string tagName = jsonData["tagName"].Value(); long SessionId = jsonData["SessionId"].Value(); + bool isSiteUser = jsonData["isSiteUser"].Value(); try { - Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId); + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId, isSiteUser); return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index f0d76f1..39f165b 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -1262,13 +1262,17 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetLicenseByIPAndAccount", sSiteIPParameter, sAccountNumberParameter, iEditionIdParameter); } - public virtual ObjectResult GetLicenseBySiteId(Nullable sSiteId) + public virtual ObjectResult GetLicenseBySiteId(Nullable sSiteId, Nullable sEditionId) { var sSiteIdParameter = sSiteId.HasValue ? new ObjectParameter("sSiteId", sSiteId) : new ObjectParameter("sSiteId", typeof(int)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetLicenseBySiteId", sSiteIdParameter); + var sEditionIdParameter = sEditionId.HasValue ? + new ObjectParameter("sEditionId", sEditionId) : + new ObjectParameter("sEditionId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetLicenseBySiteId", sSiteIdParameter, sEditionIdParameter); } public virtual ObjectResult GetLicenseDetailByUserId(Nullable iUserId) @@ -4999,7 +5003,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); } - public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag, Nullable sessionId) + public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag, Nullable sessionId, Nullable isSiteUser) { var userIdParameter = userId.HasValue ? new ObjectParameter("userId", userId) : @@ -5013,7 +5017,11 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("sessionId", sessionId) : new ObjectParameter("sessionId", typeof(long)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter); + var isSiteUserParameter = isSiteUser.HasValue ? + new ObjectParameter("isSiteUser", isSiteUser) : + new ObjectParameter("isSiteUser", typeof(bool)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter, isSiteUserParameter); } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index bae6689..3e05020 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -430,6 +430,7 @@ + @@ -1411,6 +1412,7 @@ + @@ -1911,6 +1913,7 @@ + @@ -3009,6 +3012,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 2ec74fc..8c65375 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -65,12 +65,12 @@ namespace AIAHTML5.ADMIN.API.Models return false; } } - public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId) + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId, bool isSiteUser) { bool loginStatus = false; try { - loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId).FirstOrDefault()); + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId, isSiteUser).FirstOrDefault()); return loginStatus; } diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user index aaba182..749005e 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user @@ -8,6 +8,7 @@ False ProjectFiles API_Profile + false diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index f6b800a..4a8b00e 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -42,6 +42,7 @@ namespace AIAHTML5.API.Constants public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount"; public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; + public const string GET_AOD_AUTHENTICATION_STATUS = "usp_AodAuthenticationStatus"; public const string INSERT_SITE_LOGIN_LOG = "usp_InsertSiteLoginLog"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 8100d42..084d929 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -534,8 +534,9 @@ namespace AIAHTML5.API.Controllers int userId = jsonData["userId"].Value(); string tagName = jsonData["tagName"].Value(); long SessionId = jsonData["SessionId"].Value(); + bool isSiteUser = jsonData["isSiteUser"].Value(); - loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId); + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; } @@ -545,6 +546,51 @@ namespace AIAHTML5.API.Controllers } } + [HttpPost] + [Route("api/AodAuthentication")] + public HttpResponseMessage AodAuthentication([FromBody]JObject jsonData) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + int requestStatus = 0; + try + { + string aodpasskey = jsonData["aiapasskey"].Value(); + long SessionId = jsonData["SessionId"].Value(); + string CourseId = jsonData["CourseId"].Value(); + + logger.Debug("AOD request parameter: Session =" + SessionId +", aodkeypass="+ aodpasskey + ", CourseId=" + CourseId); + + string aiaConfigKey= ConfigurationManager.AppSettings["aiapasskey"]; + + requestStatus = AIAHTML5.API.Models.Users.ValidateAodAthenticationStatus(SessionId, aiaConfigKey, aodpasskey, CourseId); + + switch(requestStatus) + { + case 200: + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("authentication successful") }; + } + case 401: + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.Unauthorized, Content = new StringContent("passing key to api is not valid") }; + } + case 404: + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound, Content = new StringContent("session has expired or does not exist") }; + } + default: + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent("server encountered an unexpected error.") }; + } + } + + } + catch (Exception ex) + { + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); + } + } + // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { @@ -556,5 +602,4 @@ namespace AIAHTML5.API.Controllers } } - } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs index f352dd3..83e84ad 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs @@ -26,15 +26,9 @@ namespace AIAHTML5.API.Controllers mconfig.pingInterval = Int32.Parse(ConfigurationManager.AppSettings["PING_INTERVAL"]); mconfig.serverPath = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"]; mconfig.fileSize = Int32.Parse(ConfigurationManager.AppSettings["UploadMaxFileSize"]); - mconfig.aodSiteUrl = ConfigurationManager.AppSettings["Aod_site_Url"]; - - var plainkey = ConfigurationManager.AppSettings["aiapasskey"]; - - AdamOnDemand aod = new AdamOnDemand(); - - mconfig.aodkeypass = aod.Encrypt(plainkey); - // var simplekey= aod.Decrypt(mconfig.aodkeypass); + mconfig.aodSiteUrl = ConfigurationManager.AppSettings["Aod_site_Url"]; + mconfig.aodkeypass = ConfigurationManager.AppSettings["aiapasskey"]; responseData = JsonConvert.SerializeObject(mconfig); @@ -54,166 +48,3 @@ public class MyConfig public string aodSiteUrl { get; set; } public string aodkeypass { get; set; } } - - -public class AdamOnDemand -{ - //Triple Des encription/decription - public string Encrypt(string plainText) - { - string passPhrase = ConfigurationManager.AppSettings["EncryptionKey"].ToString(); - string saltValue = ConfigurationManager.AppSettings["SaltValue"].ToString(); - string hashAlgorithm = ConfigurationManager.AppSettings["HashAlgorithm"].ToString(); - int passwordIterations = Convert.ToInt32(ConfigurationManager.AppSettings["IterationCount"]); - string initVector = ConfigurationManager.AppSettings["InitVector"].ToString(); - int keySize = Convert.ToInt32(ConfigurationManager.AppSettings["KeySize"]); ; - - - return EncryptData(plainText, passPhrase, saltValue, hashAlgorithm,passwordIterations, initVector, keySize); - } - - //Triple Des encription/decription - public string Decrypt(string encryptedText) - { - string passPhrase = ConfigurationManager.AppSettings["EncryptionKey"].ToString(); - string saltValue = ConfigurationManager.AppSettings["SaltValue"].ToString(); - string hashAlgorithm = ConfigurationManager.AppSettings["HashAlgorithm"].ToString(); - int passwordIterations = Convert.ToInt32(ConfigurationManager.AppSettings["IterationCount"]); - string initVector = ConfigurationManager.AppSettings["InitVector"].ToString(); - int keySize = Convert.ToInt32(ConfigurationManager.AppSettings["KeySize"]); ; - - - return DecryptData(encryptedText, passPhrase, saltValue, hashAlgorithm,passwordIterations, initVector, keySize); - } - - private string EncryptData(string plainText, string passPhrase, string saltValue, string hashAlgorithm,int passwordIterations, string initVector, int keySize) - { - // Convert strings into byte arrays. - // Let us assume that strings only contain ASCII codes. - // If strings include Unicode characters, use Unicode, UTF7, or UTF8 - // encoding. - byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); - byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); - - // Convert our plaintext into a byte array. - // Let us assume that plaintext contains UTF8-encoded characters. - byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); - - // First, we must create a password, from which the key will be derived. - // This password will be generated from the specified passphrase and - // salt value. The password will be created using the specified hash - // algorithm. Password creation can be done in several iterations. - PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations); - - // Use the password to generate pseudo-random bytes for the encryption - // key. Specify the size of the key in bytes (instead of bits). - byte[] keyBytes = password.GetBytes(keySize / 8); - - // Create uninitialized Rijndael encryption object. - RijndaelManaged symmetricKey = new RijndaelManaged(); - - // It is reasonable to set encryption mode to Cipher Block Chaining - // (CBC). Use default options for other symmetric key parameters. - symmetricKey.Mode = CipherMode.CBC; - - // Generate encryptor from the existing key bytes and initialization - // vector. Key size will be defined based on the number of the key - // bytes. - ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes); - - // Define memory stream which will be used to hold encrypted data. - MemoryStream memoryStream = new MemoryStream(); - - // Define cryptographic stream (always use Write mode for encryption). - CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write); - // Start encrypting. - cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length); - - // Finish encrypting. - cryptoStream.FlushFinalBlock(); - - // Convert our encrypted data from a memory stream into a byte array. - byte[] cipherTextBytes = memoryStream.ToArray(); - - // Close both streams. - memoryStream.Close(); - cryptoStream.Close(); - - // Convert encrypted data into a base64-encoded string. - string cipherText = Convert.ToBase64String(cipherTextBytes); - - // Return encrypted string. - return cipherText; - } - - private string DecryptData(string encryptedText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize) - { - try - { - // arrays. Let us assume that strings only contain ASCII codes. - // If strings include Unicode characters, use Unicode, UTF7, or UTF8 - // encoding. - byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); - byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); - - // Convert our encryptedvalue into a byte array. - byte[] cipherTextBytes = Convert.FromBase64String(encryptedText); - - // First, we must create a password, from which the key will be - // derived. This password will be generated from the specified - // passphrase and salt value. The password will be created using - // the specified hash algorithm. Password creation can be done in - // several iterations. - PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations); - - // Use the password to generate pseudo-random bytes for the encryption - // key. Specify the size of the key in bytes (instead of bits). - byte[] keyBytes = password.GetBytes(keySize / 8); - - // Create uninitialized Rijndael encryption object. - RijndaelManaged symmetricKey = new RijndaelManaged(); - - // It is reasonable to set encryption mode to Cipher Block Chaining - // (CBC). Use default options for other symmetric key parameters. - symmetricKey.Mode = CipherMode.CBC; - - // Generate decryptor from the existing key bytes and initialization - // vector. Key size will be defined based on the number of the key - // bytes. - ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes); - - // Define memory stream which will be used to hold encrypted data. - MemoryStream memoryStream = new MemoryStream(cipherTextBytes); - - // Define cryptographic stream (always use Read mode for encryption). - CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read); - - // Since at this point we don't know what the size of decrypted data - // will be, allocate the buffer long enough to hold ciphertext; - // plaintext is never longer than ciphertext. - byte[] plainTextBytes = new byte[cipherTextBytes.Length]; - - // Start decrypting. - int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length); - - // Close both streams. - memoryStream.Close(); - cryptoStream.Close(); - - // Convert decrypted data into a string. - // Let us assume that the original plaintext string was UTF8-encoded. - string plainText = Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount); - - // Return decrypted string. - return plainText; - - } - catch( Exception ex) - { - return null; - } - // Convert strings defining encryption key characteristics into byte - - } - -} diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 292fc3c..9e64f2c 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -350,7 +350,7 @@ namespace AIAHTML5.API.Models return objUser; } - internal static string GetUserLoginStatus(int userId,string tagName, long SessionId) + internal static string GetUserLoginStatus(int userId,string tagName, long SessionId, bool isSiteUser) { string status=string.Empty; DBModel objModel = new DBModel(); @@ -366,6 +366,7 @@ namespace AIAHTML5.API.Models cmd.Parameters.AddWithValue("@userId", userId); cmd.Parameters.AddWithValue("@tag", tagName); cmd.Parameters.AddWithValue("@sessionId", SessionId); + cmd.Parameters.AddWithValue("@isSiteUser", isSiteUser); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); @@ -386,6 +387,44 @@ namespace AIAHTML5.API.Models return status; } + internal static int ValidateAodAthenticationStatus(long SessionId, string aiaConfigKey, string aodpasskey, string CourseId) + { + int status = 0; + DBModel objModel = new DBModel(); + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + SqlDataAdapter adapter; + DataSet ds = new DataSet(); + + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_AOD_AUTHENTICATION_STATUS; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@sessionId", SessionId); + cmd.Parameters.AddWithValue("@aiaConfigKey", aiaConfigKey); + cmd.Parameters.AddWithValue("@aodpasskey", aodpasskey); + cmd.Parameters.AddWithValue("@CourseId", CourseId); + + adapter = new SqlDataAdapter(cmd); + adapter.Fill(ds); + + if (ds != null && ds.Tables.Count > 0) + { + DataTable dt = ds.Tables[0]; + + if (dt.Rows.Count > 0) + { + foreach (DataRow dr in dt.Rows) + { + status =Convert.ToInt32( dr["requestStatus"]); + + } + } + } + + return status; + } + internal User GetSelectedSettings(int userId,bool isSiteUser) { logger.Debug(" Inside GetSelectedSettings for userId = " + userId); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 5c24061..3ddd15c 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -340,10 +340,17 @@ namespace AIAHTML5.API.Models return objUser; } - internal static string GetUserLoginStatus(int userId, string tagName, long SessionId) + internal static string GetUserLoginStatus(int userId, string tagName, long SessionId, bool isSiteUser) { string status = null; - status = DBModel.GetUserLoginStatus(userId, tagName, SessionId); + status = DBModel.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); + + return status; + } + internal static int ValidateAodAthenticationStatus(long SessionId, string aiaConfigKey, string aodpasskey, string CourseId) + { + int status = 0; + status = DBModel.ValidateAodAthenticationStatus(SessionId, aiaConfigKey, aodpasskey, CourseId); return status; } diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index d541683..30dbbe2 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -59,16 +59,10 @@ - + + - - - - - - - @@ -116,6 +110,12 @@ + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js index e831bb1..f30e96f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js @@ -354,27 +354,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.DisableUI(); $scope.jsPanelID = 'aodImagePanel' + '_' + windowviewid; var tittle = $scope.GetAODwindowStoreData(windowviewid, 'currentViewTitle'); - - // var aodurl = $rootScope.aodSiteUrl+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); - // var aodurl = "https://uat.adamondemand.com/"+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); - var aodurl = "http://localhost:90/Home/CoursePlayerAIATest"; + + var aodlink = $rootScope.aodDomainName+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); var courseid = $scope.GetAODwindowStoreData(windowviewid, 'courseId'); var uid = $scope.GetAODwindowStoreData(windowviewid, 'uid'); - var key="as@2$eDu8Jk"; - + var aodSiteUrl = aodlink+"?aodkeypass="+$rootScope.aodkeypass+ "&SessionId=" + $rootScope.userData.SessionId + "&Courseid=" + courseid + "&uID=" + uid+ ",_self" + $scope.jsPanelWidth = $(window).outerWidth() - 20; $scope.jsPanelHeight = $(window).outerHeight() - 140; $scope.jsPanelLeft = 1; $scope.jsPanelTop = 70; - if (aodurl.length > 0 ) { + if (aodlink.length > 0 ) { $scope.jsPanelVideo = $.jsPanel({ id: $scope.jsPanelID, selector: '.aodView', theme: 'success', currentController: 'AODController', parentSlug: $scope.GetAODwindowStoreData(windowviewid, 'parentSlugName'), - content: '
' + + content: '
' + ''+ // '' + '
', @@ -406,33 +404,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.SetAODwindowStoreData(windowviewid, 'currentSlug', 'AOD-view-detail'); $('html, body').animate({ scrollTop: 0 }); - postToIframe(aodurl,key,courseid,uid); - - // $.post(aodurl, { aiakeypass: "as@2$eDu8Jk",courseid: "as@2$09011209",uid: "as@2$2" }, function (result) { - - // }); - - - // $.post("https://uat.adamondemand.com/AodHome/CoursePlayerAIAP/", { aiakeypass: "as@2$eDu8Jk" }, function (result) { - - // if (result.Success === true) { - // alert('ok') - // $('#aodvideo_' + windowviewid).attr('src', videoUrl); - - // // window.open("https://adamondemand.com/AodHome/CoursePlayerAIATest?courseid=" + ProID + "&type=" + productype + "&uID=" + userid, "_self"); - // } - // else - // { - // alert('failed') - // } - - // }); - - - // $('#aodkey').attr('name',"aiakeypass") - // $('#aodkey').val($rootScope.aodkeypass); - // $('#aodform').attr('action',videoUrl).submit(); - + $('#aodvideo_' + windowviewid).attr('src', aodSiteUrl); } $('#AODView').css("height", $(window).outerHeight() - 20); @@ -443,17 +415,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } - function postToIframe(url,key,courseid,uid){ - $('body').append('
'); - $('#aodform').append(''+ - ''+ - ')' - ) - - //remove form after submit data - $('#aodform').submit().remove(); - } - $scope.MyAODvideoOnLoad = function (windowviewid) { $scope.EnableUI(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index ccbcf22..4c5d2b3 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -715,7 +715,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.aiaAnimationPath = configresult.serverPath; $rootScope.MaxOneFileSize = configresult.fileSize; $rootScope.aodkeypass = configresult.aodkeypass; - $rootScope.aodSiteUrl = configresult.aodSiteUrl; + $rootScope.aodDomainName = configresult.aodSiteUrl; var loggedInUser = JSON.parse($scope.currentUserDetails); //incase site user login userid is 0 so then using license id @@ -724,7 +724,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $scope.checkuserstatus = { userId: userId, tagName: loggedInUser.Id==0?'logout':'update', - SessionId:loggedInUser.SessionId + SessionId:loggedInUser.SessionId, + isSiteUser:loggedInUser.isSiteUser } // this case found when browser closed by user after login. after long time (after 20 min) open site again @@ -949,7 +950,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.aiaAnimationPath = configresult.serverPath; $rootScope.MaxOneFileSize = configresult.fileSize; $rootScope.aodkeypass = configresult.aodkeypass; - $rootScope.aodSiteUrl = configresult.aodSiteUrl; + $rootScope.aodDomainName = configresult.aodSiteUrl; }); } @@ -1489,7 +1490,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.aiaAnimationPath = configresult.serverPath; $rootScope.MaxOneFileSize = configresult.fileSize; $rootScope.aodkeypass = configresult.aodkeypass; - $rootScope.aodSiteUrl = configresult.aodSiteUrl; + $rootScope.aodDomainName = configresult.aodSiteUrl; userInfo.username = result.LoginId; userInfo.password = result.Password; @@ -1545,7 +1546,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.aiaAnimationPath = configresult.serverPath; $rootScope.MaxOneFileSize = configresult.fileSize; $rootScope.aodkeypass = configresult.aodkeypass; - $rootScope.aodSiteUrl = configresult.aodSiteUrl; + $rootScope.aodDomainName = configresult.aodSiteUrl; var loggedInUser = JSON.parse($scope.currentUserDetails); //check already login by account number bcz no login id for site login @@ -1990,7 +1991,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.userStatus = { userId: null, tagName: null, - SessionId:null + SessionId:null, + isSiteUser:false } console.log('user session start'); $rootScope.CheckUserSession('insert'); @@ -2066,6 +2068,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id; $rootScope.userStatus.tagName=tagName; $rootScope.userStatus.SessionId=$rootScope.userData.SessionId; + $rootScope.userStatus.isSiteUser=$rootScope.userData.isSiteUser; AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) .then( @@ -9132,7 +9135,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#profileUpdateModal").modal('hide'); $timeout(function () { $rootScope.isRedirectToAdmin=true; - window.location.href = "Admin"; + window.location.href = "/Admin"; }, 300) }; diff --git a/400-SOURCECODE/Admin/src/app/app.component.ts b/400-SOURCECODE/Admin/src/app/app.component.ts index 6dcad5e..9e61f38 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.ts +++ b/400-SOURCECODE/Admin/src/app/app.component.ts @@ -37,7 +37,7 @@ export class AppComponent implements OnInit { constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private _confirmService: ConfirmService,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) { const projectTitle= this.titleService.getTitle(); - console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval); + //console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval); // sets an idle timeout of 20 minutes. this.idle.setIdle(this.global.aiaIdleTime); @@ -141,9 +141,10 @@ export class AppComponent implements OnInit { this.userservice.ManageUserLoginStatus({ userId: this.global.UserId, tagName: tagname, - SessionId:this.global.SessionId + SessionId:this.global.SessionId, + isSiteUser:this.global.isSiteUser }).subscribe(status => { - console.log(status); + //console.log(status); if(status=='False') { if(tagname=='logout') diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts index a9b6138..8147c30 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts @@ -56,7 +56,7 @@ export class UserService { //////////Manage UserLogin Status/////////// ManageUserLoginStatus(obj: any) { - var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId }; + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId,'isSiteUser': obj.isSiteUser }; console.log(obj); var headers = new Headers({ 'Content-Type': 'application/json' diff --git a/400-SOURCECODE/Admin/src/app/shared/global.ts b/400-SOURCECODE/Admin/src/app/shared/global.ts index 7f61192..3ab3e04 100644 --- a/400-SOURCECODE/Admin/src/app/shared/global.ts +++ b/400-SOURCECODE/Admin/src/app/shared/global.ts @@ -28,23 +28,37 @@ export class GlobalService { aiaIdleTimeOut:number=0; aiaPingInterval:number=0; SessionId:number=0; + isSiteUser:boolean=false; RemoveColumns: Array = ["Serial_No", "LicenseId","RowNum"] error; public href: string = ""; constructor(private csvService: CsvService, private http: Http) { - this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); - if (this.loggedInUser != null) { - this.UserId = this.loggedInUser.Id; - this.UserType = this.loggedInUser.UserTypeId; - this.UserTypeName = this.loggedInUser.UserType; - this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; - this.LoginId=this.loggedInUser.LoginId; - this.aiaIdleTime=this.loggedInUser.aiaIdleTime; - this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; - this.aiaPingInterval=this.loggedInUser.aiaPingInterval; - this.SessionId=this.loggedInUser.SessionId; + if(window.location.host=="localhost:4200") + { + // for 'ng serve --open' command + //**** for localhost:4200 *****// + var date = new Date(); + var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 + localStorage.setItem('loggedInUserDetails', JSON.stringify( + { + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10,"SessionId":newsessionid,"isSiteUser":false, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null + })); + } + + this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); + if (this.loggedInUser != null) { + this.UserId = this.loggedInUser.Id; + this.UserType = this.loggedInUser.UserTypeId; + this.UserTypeName = this.loggedInUser.UserType; + this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; + this.LoginId=this.loggedInUser.LoginId; + this.aiaIdleTime=this.loggedInUser.aiaIdleTime; + this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; + this.aiaPingInterval=this.loggedInUser.aiaPingInterval; + this.SessionId=this.loggedInUser.SessionId; + this.isSiteUser=this.loggedInUser.isSiteUser; - } + } this.NoRecords = 'No Record Found.'; @@ -69,20 +83,8 @@ export class GlobalService { } - if (this.resourceBaseUrl == this.ProtocolType+"localhost/API/Adminapi/") { - if(window.location.host=="localhost:4200") - { - // for 'ng serve --open' command - //**** for localhost:4200 *****// - var date = new Date(); - var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 - localStorage.setItem('loggedInUserDetails', JSON.stringify( - { - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10,"SessionId":newsessionid, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null - })); - } - - this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); + if (this.resourceBaseUrl == this.ProtocolType+"localhost/API/Adminapi/") { + if (this.UserTypeName == "Client Admin" || this.UserTypeName == "District Admin") { this.AccountNumber = this.loggedInUser.LicenseInfo.AccountNumber }