Commit be36035b65bdd9e25ed5336abd02e89f9d16b83e
1 parent
cb546824
aod changes in api, admin api and web to save request/response from aod
Showing
16 changed files
with
178 additions
and
274 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... | ... | @@ -120,9 +120,10 @@ namespace AIAHTML5.ADMIN.API.Controllers |
120 | 120 | int userId = jsonData["userId"].Value<Int32>(); |
121 | 121 | string tagName = jsonData["tagName"].Value<string>(); |
122 | 122 | long SessionId = jsonData["SessionId"].Value<long>(); |
123 | + bool isSiteUser = jsonData["isSiteUser"].Value<bool>(); | |
123 | 124 | try |
124 | 125 | { |
125 | - Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId); | |
126 | + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId, isSiteUser); | |
126 | 127 | |
127 | 128 | return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); |
128 | 129 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... | ... | @@ -1262,13 +1262,17 @@ namespace AIAHTML5.ADMIN.API.Entity |
1262 | 1262 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetLicenseByIPAndAccount_Result>("GetLicenseByIPAndAccount", sSiteIPParameter, sAccountNumberParameter, iEditionIdParameter); |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - public virtual ObjectResult<GetLicenseBySiteId_Result> GetLicenseBySiteId(Nullable<int> sSiteId) | |
1265 | + public virtual ObjectResult<GetLicenseBySiteId_Result> GetLicenseBySiteId(Nullable<int> sSiteId, Nullable<int> sEditionId) | |
1266 | 1266 | { |
1267 | 1267 | var sSiteIdParameter = sSiteId.HasValue ? |
1268 | 1268 | new ObjectParameter("sSiteId", sSiteId) : |
1269 | 1269 | new ObjectParameter("sSiteId", typeof(int)); |
1270 | 1270 | |
1271 | - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetLicenseBySiteId_Result>("GetLicenseBySiteId", sSiteIdParameter); | |
1271 | + var sEditionIdParameter = sEditionId.HasValue ? | |
1272 | + new ObjectParameter("sEditionId", sEditionId) : | |
1273 | + new ObjectParameter("sEditionId", typeof(int)); | |
1274 | + | |
1275 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetLicenseBySiteId_Result>("GetLicenseBySiteId", sSiteIdParameter, sEditionIdParameter); | |
1272 | 1276 | } |
1273 | 1277 | |
1274 | 1278 | public virtual ObjectResult<GetLicenseDetailByUserId_Result> GetLicenseDetailByUserId(Nullable<int> iUserId) |
... | ... | @@ -4999,7 +5003,7 @@ namespace AIAHTML5.ADMIN.API.Entity |
4999 | 5003 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); |
5000 | 5004 | } |
5001 | 5005 | |
5002 | - public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<long> sessionId) | |
5006 | + public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<long> sessionId, Nullable<bool> isSiteUser) | |
5003 | 5007 | { |
5004 | 5008 | var userIdParameter = userId.HasValue ? |
5005 | 5009 | new ObjectParameter("userId", userId) : |
... | ... | @@ -5013,7 +5017,11 @@ namespace AIAHTML5.ADMIN.API.Entity |
5013 | 5017 | new ObjectParameter("sessionId", sessionId) : |
5014 | 5018 | new ObjectParameter("sessionId", typeof(long)); |
5015 | 5019 | |
5016 | - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter); | |
5020 | + var isSiteUserParameter = isSiteUser.HasValue ? | |
5021 | + new ObjectParameter("isSiteUser", isSiteUser) : | |
5022 | + new ObjectParameter("isSiteUser", typeof(bool)); | |
5023 | + | |
5024 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter, isSiteUserParameter); | |
5017 | 5025 | } |
5018 | 5026 | } |
5019 | 5027 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... | ... | @@ -430,6 +430,7 @@ |
430 | 430 | </Function> |
431 | 431 | <Function Name="GetLicenseBySiteId" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> |
432 | 432 | <Parameter Name="sSiteId" Type="int" Mode="In" /> |
433 | + <Parameter Name="sEditionId" Type="int" Mode="In" /> | |
433 | 434 | </Function> |
434 | 435 | <Function Name="GetLicenseDetailByUserId" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> |
435 | 436 | <Parameter Name="iUserId" Type="int" Mode="In" /> |
... | ... | @@ -1411,6 +1412,7 @@ |
1411 | 1412 | <Parameter Name="userId" Type="int" Mode="In" /> |
1412 | 1413 | <Parameter Name="tag" Type="varchar" Mode="In" /> |
1413 | 1414 | <Parameter Name="sessionId" Type="bigint" Mode="In" /> |
1415 | + <Parameter Name="isSiteUser" Type="bit" Mode="In" /> | |
1414 | 1416 | </Function> |
1415 | 1417 | <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> |
1416 | 1418 | <Parameter Name="UserId" Type="int" Mode="In" /> |
... | ... | @@ -1911,6 +1913,7 @@ |
1911 | 1913 | </FunctionImport> |
1912 | 1914 | <FunctionImport Name="GetLicenseBySiteId" ReturnType="Collection(AIADatabaseV5Model.GetLicenseBySiteId_Result)"> |
1913 | 1915 | <Parameter Name="sSiteId" Mode="In" Type="Int32" /> |
1916 | + <Parameter Name="sEditionId" Mode="In" Type="Int32" /> | |
1914 | 1917 | </FunctionImport> |
1915 | 1918 | <FunctionImport Name="GetLicenseDetailByUserId" ReturnType="Collection(AIADatabaseV5Model.GetLicenseDetailByUserId_Result)"> |
1916 | 1919 | <Parameter Name="iUserId" Mode="In" Type="Int32" /> |
... | ... | @@ -3009,6 +3012,7 @@ |
3009 | 3012 | <Parameter Name="userId" Mode="In" Type="Int32" /> |
3010 | 3013 | <Parameter Name="tag" Mode="In" Type="String" /> |
3011 | 3014 | <Parameter Name="sessionId" Mode="In" Type="Int64" /> |
3015 | + <Parameter Name="isSiteUser" Mode="In" Type="Boolean" /> | |
3012 | 3016 | </FunctionImport> |
3013 | 3017 | </EntityContainer> |
3014 | 3018 | <ComplexType Name="DA_GetBaseLayer_Result"> | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... | ... | @@ -65,12 +65,12 @@ namespace AIAHTML5.ADMIN.API.Models |
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | } |
68 | - public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId) | |
68 | + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId, bool isSiteUser) | |
69 | 69 | { |
70 | 70 | bool loginStatus = false; |
71 | 71 | try |
72 | 72 | { |
73 | - loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId).FirstOrDefault()); | |
73 | + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId, isSiteUser).FirstOrDefault()); | |
74 | 74 | |
75 | 75 | return loginStatus; |
76 | 76 | } | ... | ... |
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected> |
9 | 9 | <ProjectView>ProjectFiles</ProjectView> |
10 | 10 | <NameOfLastUsedPublishProfile>API_Profile</NameOfLastUsedPublishProfile> |
11 | + <UseIISExpress>false</UseIISExpress> | |
11 | 12 | </PropertyGroup> |
12 | 13 | <ProjectExtensions> |
13 | 14 | <VisualStudio> | ... | ... |
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... | ... | @@ -42,6 +42,7 @@ namespace AIAHTML5.API.Constants |
42 | 42 | public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; |
43 | 43 | public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount"; |
44 | 44 | public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; |
45 | + public const string GET_AOD_AUTHENTICATION_STATUS = "usp_AodAuthenticationStatus"; | |
45 | 46 | public const string INSERT_SITE_LOGIN_LOG = "usp_InsertSiteLoginLog"; |
46 | 47 | } |
47 | 48 | } |
48 | 49 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -534,8 +534,9 @@ namespace AIAHTML5.API.Controllers |
534 | 534 | int userId = jsonData["userId"].Value<int>(); |
535 | 535 | string tagName = jsonData["tagName"].Value<string>(); |
536 | 536 | long SessionId = jsonData["SessionId"].Value<long>(); |
537 | + bool isSiteUser = jsonData["isSiteUser"].Value<bool>(); | |
537 | 538 | |
538 | - loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId); | |
539 | + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); | |
539 | 540 | |
540 | 541 | return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; |
541 | 542 | } |
... | ... | @@ -545,6 +546,51 @@ namespace AIAHTML5.API.Controllers |
545 | 546 | } |
546 | 547 | } |
547 | 548 | |
549 | + [HttpPost] | |
550 | + [Route("api/AodAuthentication")] | |
551 | + public HttpResponseMessage AodAuthentication([FromBody]JObject jsonData) | |
552 | + { | |
553 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
554 | + int requestStatus = 0; | |
555 | + try | |
556 | + { | |
557 | + string aodpasskey = jsonData["aiapasskey"].Value<string>(); | |
558 | + long SessionId = jsonData["SessionId"].Value<long>(); | |
559 | + string CourseId = jsonData["CourseId"].Value<string>(); | |
560 | + | |
561 | + logger.Debug("AOD request parameter: Session =" + SessionId +", aodkeypass="+ aodpasskey + ", CourseId=" + CourseId); | |
562 | + | |
563 | + string aiaConfigKey= ConfigurationManager.AppSettings["aiapasskey"]; | |
564 | + | |
565 | + requestStatus = AIAHTML5.API.Models.Users.ValidateAodAthenticationStatus(SessionId, aiaConfigKey, aodpasskey, CourseId); | |
566 | + | |
567 | + switch(requestStatus) | |
568 | + { | |
569 | + case 200: | |
570 | + { | |
571 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("authentication successful") }; | |
572 | + } | |
573 | + case 401: | |
574 | + { | |
575 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.Unauthorized, Content = new StringContent("passing key to api is not valid") }; | |
576 | + } | |
577 | + case 404: | |
578 | + { | |
579 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound, Content = new StringContent("session has expired or does not exist") }; | |
580 | + } | |
581 | + default: | |
582 | + { | |
583 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent("server encountered an unexpected error.") }; | |
584 | + } | |
585 | + } | |
586 | + | |
587 | + } | |
588 | + catch (Exception ex) | |
589 | + { | |
590 | + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); | |
591 | + } | |
592 | + } | |
593 | + | |
548 | 594 | // PUT api/authenticate/5 |
549 | 595 | public void Put(int id, [FromBody]string value) |
550 | 596 | { |
... | ... | @@ -556,5 +602,4 @@ namespace AIAHTML5.API.Controllers |
556 | 602 | } |
557 | 603 | } |
558 | 604 | |
559 | - | |
560 | 605 | } |
561 | 606 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs
... | ... | @@ -26,15 +26,9 @@ namespace AIAHTML5.API.Controllers |
26 | 26 | mconfig.pingInterval = Int32.Parse(ConfigurationManager.AppSettings["PING_INTERVAL"]); |
27 | 27 | mconfig.serverPath = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"]; |
28 | 28 | mconfig.fileSize = Int32.Parse(ConfigurationManager.AppSettings["UploadMaxFileSize"]); |
29 | - mconfig.aodSiteUrl = ConfigurationManager.AppSettings["Aod_site_Url"]; | |
30 | - | |
31 | - var plainkey = ConfigurationManager.AppSettings["aiapasskey"]; | |
32 | - | |
33 | - AdamOnDemand aod = new AdamOnDemand(); | |
34 | - | |
35 | - mconfig.aodkeypass = aod.Encrypt(plainkey); | |
36 | 29 | |
37 | - // var simplekey= aod.Decrypt(mconfig.aodkeypass); | |
30 | + mconfig.aodSiteUrl = ConfigurationManager.AppSettings["Aod_site_Url"]; | |
31 | + mconfig.aodkeypass = ConfigurationManager.AppSettings["aiapasskey"]; | |
38 | 32 | |
39 | 33 | responseData = JsonConvert.SerializeObject(mconfig); |
40 | 34 | |
... | ... | @@ -54,166 +48,3 @@ public class MyConfig |
54 | 48 | public string aodSiteUrl { get; set; } |
55 | 49 | public string aodkeypass { get; set; } |
56 | 50 | } |
57 | - | |
58 | - | |
59 | -public class AdamOnDemand | |
60 | -{ | |
61 | - //Triple Des encription/decription | |
62 | - public string Encrypt(string plainText) | |
63 | - { | |
64 | - string passPhrase = ConfigurationManager.AppSettings["EncryptionKey"].ToString(); | |
65 | - string saltValue = ConfigurationManager.AppSettings["SaltValue"].ToString(); | |
66 | - string hashAlgorithm = ConfigurationManager.AppSettings["HashAlgorithm"].ToString(); | |
67 | - int passwordIterations = Convert.ToInt32(ConfigurationManager.AppSettings["IterationCount"]); | |
68 | - string initVector = ConfigurationManager.AppSettings["InitVector"].ToString(); | |
69 | - int keySize = Convert.ToInt32(ConfigurationManager.AppSettings["KeySize"]); ; | |
70 | - | |
71 | - | |
72 | - return EncryptData(plainText, passPhrase, saltValue, hashAlgorithm,passwordIterations, initVector, keySize); | |
73 | - } | |
74 | - | |
75 | - //Triple Des encription/decription | |
76 | - public string Decrypt(string encryptedText) | |
77 | - { | |
78 | - string passPhrase = ConfigurationManager.AppSettings["EncryptionKey"].ToString(); | |
79 | - string saltValue = ConfigurationManager.AppSettings["SaltValue"].ToString(); | |
80 | - string hashAlgorithm = ConfigurationManager.AppSettings["HashAlgorithm"].ToString(); | |
81 | - int passwordIterations = Convert.ToInt32(ConfigurationManager.AppSettings["IterationCount"]); | |
82 | - string initVector = ConfigurationManager.AppSettings["InitVector"].ToString(); | |
83 | - int keySize = Convert.ToInt32(ConfigurationManager.AppSettings["KeySize"]); ; | |
84 | - | |
85 | - | |
86 | - return DecryptData(encryptedText, passPhrase, saltValue, hashAlgorithm,passwordIterations, initVector, keySize); | |
87 | - } | |
88 | - | |
89 | - private string EncryptData(string plainText, string passPhrase, string saltValue, string hashAlgorithm,int passwordIterations, string initVector, int keySize) | |
90 | - { | |
91 | - // Convert strings into byte arrays. | |
92 | - // Let us assume that strings only contain ASCII codes. | |
93 | - // If strings include Unicode characters, use Unicode, UTF7, or UTF8 | |
94 | - // encoding. | |
95 | - byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); | |
96 | - byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); | |
97 | - | |
98 | - // Convert our plaintext into a byte array. | |
99 | - // Let us assume that plaintext contains UTF8-encoded characters. | |
100 | - byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); | |
101 | - | |
102 | - // First, we must create a password, from which the key will be derived. | |
103 | - // This password will be generated from the specified passphrase and | |
104 | - // salt value. The password will be created using the specified hash | |
105 | - // algorithm. Password creation can be done in several iterations. | |
106 | - PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations); | |
107 | - | |
108 | - // Use the password to generate pseudo-random bytes for the encryption | |
109 | - // key. Specify the size of the key in bytes (instead of bits). | |
110 | - byte[] keyBytes = password.GetBytes(keySize / 8); | |
111 | - | |
112 | - // Create uninitialized Rijndael encryption object. | |
113 | - RijndaelManaged symmetricKey = new RijndaelManaged(); | |
114 | - | |
115 | - // It is reasonable to set encryption mode to Cipher Block Chaining | |
116 | - // (CBC). Use default options for other symmetric key parameters. | |
117 | - symmetricKey.Mode = CipherMode.CBC; | |
118 | - | |
119 | - // Generate encryptor from the existing key bytes and initialization | |
120 | - // vector. Key size will be defined based on the number of the key | |
121 | - // bytes. | |
122 | - ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes); | |
123 | - | |
124 | - // Define memory stream which will be used to hold encrypted data. | |
125 | - MemoryStream memoryStream = new MemoryStream(); | |
126 | - | |
127 | - // Define cryptographic stream (always use Write mode for encryption). | |
128 | - CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write); | |
129 | - // Start encrypting. | |
130 | - cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length); | |
131 | - | |
132 | - // Finish encrypting. | |
133 | - cryptoStream.FlushFinalBlock(); | |
134 | - | |
135 | - // Convert our encrypted data from a memory stream into a byte array. | |
136 | - byte[] cipherTextBytes = memoryStream.ToArray(); | |
137 | - | |
138 | - // Close both streams. | |
139 | - memoryStream.Close(); | |
140 | - cryptoStream.Close(); | |
141 | - | |
142 | - // Convert encrypted data into a base64-encoded string. | |
143 | - string cipherText = Convert.ToBase64String(cipherTextBytes); | |
144 | - | |
145 | - // Return encrypted string. | |
146 | - return cipherText; | |
147 | - } | |
148 | - | |
149 | - private string DecryptData(string encryptedText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize) | |
150 | - { | |
151 | - try | |
152 | - { | |
153 | - // arrays. Let us assume that strings only contain ASCII codes. | |
154 | - // If strings include Unicode characters, use Unicode, UTF7, or UTF8 | |
155 | - // encoding. | |
156 | - byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); | |
157 | - byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); | |
158 | - | |
159 | - // Convert our encryptedvalue into a byte array. | |
160 | - byte[] cipherTextBytes = Convert.FromBase64String(encryptedText); | |
161 | - | |
162 | - // First, we must create a password, from which the key will be | |
163 | - // derived. This password will be generated from the specified | |
164 | - // passphrase and salt value. The password will be created using | |
165 | - // the specified hash algorithm. Password creation can be done in | |
166 | - // several iterations. | |
167 | - PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations); | |
168 | - | |
169 | - // Use the password to generate pseudo-random bytes for the encryption | |
170 | - // key. Specify the size of the key in bytes (instead of bits). | |
171 | - byte[] keyBytes = password.GetBytes(keySize / 8); | |
172 | - | |
173 | - // Create uninitialized Rijndael encryption object. | |
174 | - RijndaelManaged symmetricKey = new RijndaelManaged(); | |
175 | - | |
176 | - // It is reasonable to set encryption mode to Cipher Block Chaining | |
177 | - // (CBC). Use default options for other symmetric key parameters. | |
178 | - symmetricKey.Mode = CipherMode.CBC; | |
179 | - | |
180 | - // Generate decryptor from the existing key bytes and initialization | |
181 | - // vector. Key size will be defined based on the number of the key | |
182 | - // bytes. | |
183 | - ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes); | |
184 | - | |
185 | - // Define memory stream which will be used to hold encrypted data. | |
186 | - MemoryStream memoryStream = new MemoryStream(cipherTextBytes); | |
187 | - | |
188 | - // Define cryptographic stream (always use Read mode for encryption). | |
189 | - CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read); | |
190 | - | |
191 | - // Since at this point we don't know what the size of decrypted data | |
192 | - // will be, allocate the buffer long enough to hold ciphertext; | |
193 | - // plaintext is never longer than ciphertext. | |
194 | - byte[] plainTextBytes = new byte[cipherTextBytes.Length]; | |
195 | - | |
196 | - // Start decrypting. | |
197 | - int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length); | |
198 | - | |
199 | - // Close both streams. | |
200 | - memoryStream.Close(); | |
201 | - cryptoStream.Close(); | |
202 | - | |
203 | - // Convert decrypted data into a string. | |
204 | - // Let us assume that the original plaintext string was UTF8-encoded. | |
205 | - string plainText = Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount); | |
206 | - | |
207 | - // Return decrypted string. | |
208 | - return plainText; | |
209 | - | |
210 | - } | |
211 | - catch( Exception ex) | |
212 | - { | |
213 | - return null; | |
214 | - } | |
215 | - // Convert strings defining encryption key characteristics into byte | |
216 | - | |
217 | - } | |
218 | - | |
219 | -} | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -350,7 +350,7 @@ namespace AIAHTML5.API.Models |
350 | 350 | return objUser; |
351 | 351 | } |
352 | 352 | |
353 | - internal static string GetUserLoginStatus(int userId,string tagName, long SessionId) | |
353 | + internal static string GetUserLoginStatus(int userId,string tagName, long SessionId, bool isSiteUser) | |
354 | 354 | { |
355 | 355 | string status=string.Empty; |
356 | 356 | DBModel objModel = new DBModel(); |
... | ... | @@ -366,6 +366,7 @@ namespace AIAHTML5.API.Models |
366 | 366 | cmd.Parameters.AddWithValue("@userId", userId); |
367 | 367 | cmd.Parameters.AddWithValue("@tag", tagName); |
368 | 368 | cmd.Parameters.AddWithValue("@sessionId", SessionId); |
369 | + cmd.Parameters.AddWithValue("@isSiteUser", isSiteUser); | |
369 | 370 | adapter = new SqlDataAdapter(cmd); |
370 | 371 | adapter.Fill(ds); |
371 | 372 | |
... | ... | @@ -386,6 +387,44 @@ namespace AIAHTML5.API.Models |
386 | 387 | return status; |
387 | 388 | } |
388 | 389 | |
390 | + internal static int ValidateAodAthenticationStatus(long SessionId, string aiaConfigKey, string aodpasskey, string CourseId) | |
391 | + { | |
392 | + int status = 0; | |
393 | + DBModel objModel = new DBModel(); | |
394 | + | |
395 | + SqlConnection conn = new SqlConnection(dbConnectionString); | |
396 | + SqlCommand cmd = new SqlCommand(); | |
397 | + SqlDataAdapter adapter; | |
398 | + DataSet ds = new DataSet(); | |
399 | + | |
400 | + cmd.Connection = conn; | |
401 | + cmd.CommandText = DBConstants.GET_AOD_AUTHENTICATION_STATUS; | |
402 | + cmd.CommandType = CommandType.StoredProcedure; | |
403 | + cmd.Parameters.AddWithValue("@sessionId", SessionId); | |
404 | + cmd.Parameters.AddWithValue("@aiaConfigKey", aiaConfigKey); | |
405 | + cmd.Parameters.AddWithValue("@aodpasskey", aodpasskey); | |
406 | + cmd.Parameters.AddWithValue("@CourseId", CourseId); | |
407 | + | |
408 | + adapter = new SqlDataAdapter(cmd); | |
409 | + adapter.Fill(ds); | |
410 | + | |
411 | + if (ds != null && ds.Tables.Count > 0) | |
412 | + { | |
413 | + DataTable dt = ds.Tables[0]; | |
414 | + | |
415 | + if (dt.Rows.Count > 0) | |
416 | + { | |
417 | + foreach (DataRow dr in dt.Rows) | |
418 | + { | |
419 | + status =Convert.ToInt32( dr["requestStatus"]); | |
420 | + | |
421 | + } | |
422 | + } | |
423 | + } | |
424 | + | |
425 | + return status; | |
426 | + } | |
427 | + | |
389 | 428 | internal User GetSelectedSettings(int userId,bool isSiteUser) |
390 | 429 | { |
391 | 430 | logger.Debug(" Inside GetSelectedSettings for userId = " + userId); | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -340,10 +340,17 @@ namespace AIAHTML5.API.Models |
340 | 340 | return objUser; |
341 | 341 | } |
342 | 342 | |
343 | - internal static string GetUserLoginStatus(int userId, string tagName, long SessionId) | |
343 | + internal static string GetUserLoginStatus(int userId, string tagName, long SessionId, bool isSiteUser) | |
344 | 344 | { |
345 | 345 | string status = null; |
346 | - status = DBModel.GetUserLoginStatus(userId, tagName, SessionId); | |
346 | + status = DBModel.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); | |
347 | + | |
348 | + return status; | |
349 | + } | |
350 | + internal static int ValidateAodAthenticationStatus(long SessionId, string aiaConfigKey, string aodpasskey, string CourseId) | |
351 | + { | |
352 | + int status = 0; | |
353 | + status = DBModel.ValidateAodAthenticationStatus(SessionId, aiaConfigKey, aodpasskey, CourseId); | |
347 | 354 | |
348 | 355 | return status; |
349 | 356 | } | ... | ... |
400-SOURCECODE/AIAHTML5.API/Web.config
... | ... | @@ -59,16 +59,10 @@ |
59 | 59 | <add key ="ForgotPasswordEmailTemplate" value="~/Templates/forgot-Password.html"/> |
60 | 60 | <add key ="ForgotUserIdEmailTemplate" value="~/Templates/forgot-UserId.html"/> |
61 | 61 | |
62 | - <!-- This is for encryption: Added by Birendra--> | |
62 | + <!-- Aod used: Added by Birendra--> | |
63 | + <!-- Access-Control-Allow-Origin: change origin also to resolve CORS policy on UAT and PROD for AOD domain--> | |
63 | 64 | <add key="Aod_site_Url" value="https://uat.adamondemand.com/"/> |
64 | 65 | <add key="aiapasskey" value="as@2$eDu8Jk"/> |
65 | - <add key="EncryptionKey" value="I0rw3rthFych@n"/> | |
66 | - <add key="SaltValue" value="Fl@1Thb3rtaIcH"/> | |
67 | - <add key="HashAlgorithm" value="SHA1"/> | |
68 | - <add key="IterationCount" value="2"/> | |
69 | - <add key="InitVector" value="@1B2c3D4e5F6g7H8"/> | |
70 | - <add key="KeySize" value="256"/> | |
71 | - | |
72 | 66 | |
73 | 67 | <!--<add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>--> |
74 | 68 | <add key ="AIADatabaseV5Context" value="Data Source=LAPTOP-BIRU-PC\SQLEXPRESS;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> |
... | ... | @@ -116,6 +110,12 @@ |
116 | 110 | </assemblyBinding> |
117 | 111 | </runtime> |
118 | 112 | <system.webServer> |
113 | + <httpProtocol> | |
114 | + <customHeaders> | |
115 | + <add name="Access-Control-Allow-Origin" value="https://uat.adamondemand.com" /> | |
116 | + <!--<add name="Access-Control-Allow-Origin" value="https://adamondemand.com" />--> | |
117 | + </customHeaders> | |
118 | + </httpProtocol> | |
119 | 119 | <handlers> |
120 | 120 | <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> |
121 | 121 | <remove name="OPTIONSVerbHandler" /> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js
... | ... | @@ -354,27 +354,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
354 | 354 | $scope.DisableUI(); |
355 | 355 | $scope.jsPanelID = 'aodImagePanel' + '_' + windowviewid; |
356 | 356 | var tittle = $scope.GetAODwindowStoreData(windowviewid, 'currentViewTitle'); |
357 | - | |
358 | - // var aodurl = $rootScope.aodSiteUrl+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); | |
359 | - // var aodurl = "https://uat.adamondemand.com/"+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); | |
360 | - var aodurl = "http://localhost:90/Home/CoursePlayerAIATest"; | |
357 | + | |
358 | + var aodlink = $rootScope.aodDomainName+ $scope.GetAODwindowStoreData(windowviewid, 'aodUrl'); | |
361 | 359 | var courseid = $scope.GetAODwindowStoreData(windowviewid, 'courseId'); |
362 | 360 | var uid = $scope.GetAODwindowStoreData(windowviewid, 'uid'); |
363 | - var key="as@2$eDu8Jk"; | |
364 | - | |
361 | + var aodSiteUrl = aodlink+"?aodkeypass="+$rootScope.aodkeypass+ "&SessionId=" + $rootScope.userData.SessionId + "&Courseid=" + courseid + "&uID=" + uid+ ",_self" | |
362 | + | |
365 | 363 | $scope.jsPanelWidth = $(window).outerWidth() - 20; |
366 | 364 | $scope.jsPanelHeight = $(window).outerHeight() - 140; |
367 | 365 | $scope.jsPanelLeft = 1; |
368 | 366 | $scope.jsPanelTop = 70; |
369 | 367 | |
370 | - if (aodurl.length > 0 ) { | |
368 | + if (aodlink.length > 0 ) { | |
371 | 369 | $scope.jsPanelVideo = $.jsPanel({ |
372 | 370 | id: $scope.jsPanelID, |
373 | 371 | selector: '.aodView', |
374 | 372 | theme: 'success', |
375 | 373 | currentController: 'AODController', |
376 | 374 | parentSlug: $scope.GetAODwindowStoreData(windowviewid, 'parentSlugName'), |
377 | - content: '<div class="col-sm-12" style="height: 100%;overflow: scroll;" >' + | |
375 | + content: '<div style="height: 100%;overflow: scroll;" >' + | |
378 | 376 | '<iframe name="aodFrame" src="" style="width: 100%;height:100%" id="aodvideo_' + windowviewid + '" onload="MyAODvideoOnLoad(event)"></iframe>'+ |
379 | 377 | // '<object data="' + aodurl + '" width="100%" height="100%" id="aodvideo_' + windowviewid + '" onload="MyAODvideoOnLoad(event)"></object>' + |
380 | 378 | '</div><script>$(document).ready(function(){var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {var threeDivWidth = $("#AODView").css("width");$("#AODView").css({"left":"0px","width":"100%","min-idth": threeDivWidth}); var jspanelContainerWidth = $(".jsPanel-content").css("width"); $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth}); $("#aodImagePanel_' + windowviewid + '").css("width", "100%"); }});</script>', |
... | ... | @@ -406,33 +404,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
406 | 404 | $scope.SetAODwindowStoreData(windowviewid, 'currentSlug', 'AOD-view-detail'); |
407 | 405 | $('html, body').animate({ scrollTop: 0 }); |
408 | 406 | |
409 | - postToIframe(aodurl,key,courseid,uid); | |
410 | - | |
411 | - // $.post(aodurl, { aiakeypass: "as@2$eDu8Jk",courseid: "as@2$09011209",uid: "as@2$2" }, function (result) { | |
412 | - | |
413 | - // }); | |
414 | - | |
415 | - | |
416 | - // $.post("https://uat.adamondemand.com/AodHome/CoursePlayerAIAP/", { aiakeypass: "as@2$eDu8Jk" }, function (result) { | |
417 | - | |
418 | - // if (result.Success === true) { | |
419 | - // alert('ok') | |
420 | - // $('#aodvideo_' + windowviewid).attr('src', videoUrl); | |
421 | - | |
422 | - // // window.open("https://adamondemand.com/AodHome/CoursePlayerAIATest?courseid=" + ProID + "&type=" + productype + "&uID=" + userid, "_self"); | |
423 | - // } | |
424 | - // else | |
425 | - // { | |
426 | - // alert('failed') | |
427 | - // } | |
428 | - | |
429 | - // }); | |
430 | - | |
431 | - | |
432 | - // $('#aodkey').attr('name',"aiakeypass") | |
433 | - // $('#aodkey').val($rootScope.aodkeypass); | |
434 | - // $('#aodform').attr('action',videoUrl).submit(); | |
435 | - | |
407 | + $('#aodvideo_' + windowviewid).attr('src', aodSiteUrl); | |
436 | 408 | } |
437 | 409 | $('#AODView').css("height", $(window).outerHeight() - 20); |
438 | 410 | |
... | ... | @@ -443,17 +415,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
443 | 415 | |
444 | 416 | } |
445 | 417 | |
446 | - function postToIframe(url,key,courseid,uid){ | |
447 | - $('body').append('<form action="'+url+'" method="post" target="aodFrame" id="aodform"></form>'); | |
448 | - $('#aodform').append('<input type="hidden" name="aiakeypass" value="'+key+'" />'+ | |
449 | - '<input type="hidden" name="courseid" value="'+courseid+'" />'+ | |
450 | - '<input type="hidden" name="uid" value="'+uid+'" />)' | |
451 | - ) | |
452 | - | |
453 | - //remove form after submit data | |
454 | - $('#aodform').submit().remove(); | |
455 | - } | |
456 | - | |
457 | 418 | $scope.MyAODvideoOnLoad = function (windowviewid) |
458 | 419 | { |
459 | 420 | $scope.EnableUI(); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -715,7 +715,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
715 | 715 | $rootScope.aiaAnimationPath = configresult.serverPath; |
716 | 716 | $rootScope.MaxOneFileSize = configresult.fileSize; |
717 | 717 | $rootScope.aodkeypass = configresult.aodkeypass; |
718 | - $rootScope.aodSiteUrl = configresult.aodSiteUrl; | |
718 | + $rootScope.aodDomainName = configresult.aodSiteUrl; | |
719 | 719 | |
720 | 720 | var loggedInUser = JSON.parse($scope.currentUserDetails); |
721 | 721 | //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 |
724 | 724 | $scope.checkuserstatus = { |
725 | 725 | userId: userId, |
726 | 726 | tagName: loggedInUser.Id==0?'logout':'update', |
727 | - SessionId:loggedInUser.SessionId | |
727 | + SessionId:loggedInUser.SessionId, | |
728 | + isSiteUser:loggedInUser.isSiteUser | |
728 | 729 | } |
729 | 730 | |
730 | 731 | // 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 |
949 | 950 | $rootScope.aiaAnimationPath = configresult.serverPath; |
950 | 951 | $rootScope.MaxOneFileSize = configresult.fileSize; |
951 | 952 | $rootScope.aodkeypass = configresult.aodkeypass; |
952 | - $rootScope.aodSiteUrl = configresult.aodSiteUrl; | |
953 | + $rootScope.aodDomainName = configresult.aodSiteUrl; | |
953 | 954 | |
954 | 955 | }); |
955 | 956 | } |
... | ... | @@ -1489,7 +1490,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1489 | 1490 | $rootScope.aiaAnimationPath = configresult.serverPath; |
1490 | 1491 | $rootScope.MaxOneFileSize = configresult.fileSize; |
1491 | 1492 | $rootScope.aodkeypass = configresult.aodkeypass; |
1492 | - $rootScope.aodSiteUrl = configresult.aodSiteUrl; | |
1493 | + $rootScope.aodDomainName = configresult.aodSiteUrl; | |
1493 | 1494 | |
1494 | 1495 | userInfo.username = result.LoginId; |
1495 | 1496 | userInfo.password = result.Password; |
... | ... | @@ -1545,7 +1546,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1545 | 1546 | $rootScope.aiaAnimationPath = configresult.serverPath; |
1546 | 1547 | $rootScope.MaxOneFileSize = configresult.fileSize; |
1547 | 1548 | $rootScope.aodkeypass = configresult.aodkeypass; |
1548 | - $rootScope.aodSiteUrl = configresult.aodSiteUrl; | |
1549 | + $rootScope.aodDomainName = configresult.aodSiteUrl; | |
1549 | 1550 | |
1550 | 1551 | var loggedInUser = JSON.parse($scope.currentUserDetails); |
1551 | 1552 | //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 |
1990 | 1991 | $rootScope.userStatus = { |
1991 | 1992 | userId: null, |
1992 | 1993 | tagName: null, |
1993 | - SessionId:null | |
1994 | + SessionId:null, | |
1995 | + isSiteUser:false | |
1994 | 1996 | } |
1995 | 1997 | console.log('user session start'); |
1996 | 1998 | $rootScope.CheckUserSession('insert'); |
... | ... | @@ -2066,6 +2068,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
2066 | 2068 | $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id; |
2067 | 2069 | $rootScope.userStatus.tagName=tagName; |
2068 | 2070 | $rootScope.userStatus.SessionId=$rootScope.userData.SessionId; |
2071 | + $rootScope.userStatus.isSiteUser=$rootScope.userData.isSiteUser; | |
2069 | 2072 | |
2070 | 2073 | AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) |
2071 | 2074 | .then( |
... | ... | @@ -9132,7 +9135,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
9132 | 9135 | $("#profileUpdateModal").modal('hide'); |
9133 | 9136 | $timeout(function () { |
9134 | 9137 | $rootScope.isRedirectToAdmin=true; |
9135 | - window.location.href = "Admin"; | |
9138 | + window.location.href = "/Admin"; | |
9136 | 9139 | }, 300) |
9137 | 9140 | |
9138 | 9141 | }; | ... | ... |
400-SOURCECODE/Admin/src/app/app.component.ts
... | ... | @@ -37,7 +37,7 @@ export class AppComponent implements OnInit { |
37 | 37 | 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,) { |
38 | 38 | const projectTitle= this.titleService.getTitle(); |
39 | 39 | |
40 | - console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval); | |
40 | + //console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval); | |
41 | 41 | // sets an idle timeout of 20 minutes. |
42 | 42 | this.idle.setIdle(this.global.aiaIdleTime); |
43 | 43 | |
... | ... | @@ -141,9 +141,10 @@ export class AppComponent implements OnInit { |
141 | 141 | this.userservice.ManageUserLoginStatus({ |
142 | 142 | userId: this.global.UserId, |
143 | 143 | tagName: tagname, |
144 | - SessionId:this.global.SessionId | |
144 | + SessionId:this.global.SessionId, | |
145 | + isSiteUser:this.global.isSiteUser | |
145 | 146 | }).subscribe(status => { |
146 | - console.log(status); | |
147 | + //console.log(status); | |
147 | 148 | if(status=='False') |
148 | 149 | { |
149 | 150 | if(tagname=='logout') | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
... | ... | @@ -56,7 +56,7 @@ export class UserService { |
56 | 56 | |
57 | 57 | //////////Manage UserLogin Status/////////// |
58 | 58 | ManageUserLoginStatus(obj: any) { |
59 | - var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId }; | |
59 | + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId,'isSiteUser': obj.isSiteUser }; | |
60 | 60 | console.log(obj); |
61 | 61 | var headers = new Headers({ |
62 | 62 | 'Content-Type': 'application/json' | ... | ... |
400-SOURCECODE/Admin/src/app/shared/global.ts
... | ... | @@ -28,23 +28,37 @@ export class GlobalService { |
28 | 28 | aiaIdleTimeOut:number=0; |
29 | 29 | aiaPingInterval:number=0; |
30 | 30 | SessionId:number=0; |
31 | + isSiteUser:boolean=false; | |
31 | 32 | RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] |
32 | 33 | error; |
33 | 34 | public href: string = ""; |
34 | 35 | constructor(private csvService: CsvService, private http: Http) { |
35 | - this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); | |
36 | - if (this.loggedInUser != null) { | |
37 | - this.UserId = this.loggedInUser.Id; | |
38 | - this.UserType = this.loggedInUser.UserTypeId; | |
39 | - this.UserTypeName = this.loggedInUser.UserType; | |
40 | - this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; | |
41 | - this.LoginId=this.loggedInUser.LoginId; | |
42 | - this.aiaIdleTime=this.loggedInUser.aiaIdleTime; | |
43 | - this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; | |
44 | - this.aiaPingInterval=this.loggedInUser.aiaPingInterval; | |
45 | - this.SessionId=this.loggedInUser.SessionId; | |
36 | + if(window.location.host=="localhost:4200") | |
37 | + { | |
38 | + // for 'ng serve --open' command | |
39 | + //**** for localhost:4200 *****// | |
40 | + var date = new Date(); | |
41 | + var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 | |
42 | + localStorage.setItem('loggedInUserDetails', JSON.stringify( | |
43 | + { | |
44 | + "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 | |
45 | + })); | |
46 | + } | |
47 | + | |
48 | + this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); | |
49 | + if (this.loggedInUser != null) { | |
50 | + this.UserId = this.loggedInUser.Id; | |
51 | + this.UserType = this.loggedInUser.UserTypeId; | |
52 | + this.UserTypeName = this.loggedInUser.UserType; | |
53 | + this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; | |
54 | + this.LoginId=this.loggedInUser.LoginId; | |
55 | + this.aiaIdleTime=this.loggedInUser.aiaIdleTime; | |
56 | + this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; | |
57 | + this.aiaPingInterval=this.loggedInUser.aiaPingInterval; | |
58 | + this.SessionId=this.loggedInUser.SessionId; | |
59 | + this.isSiteUser=this.loggedInUser.isSiteUser; | |
46 | 60 | |
47 | - } | |
61 | + } | |
48 | 62 | |
49 | 63 | this.NoRecords = 'No Record Found.'; |
50 | 64 | |
... | ... | @@ -69,20 +83,8 @@ export class GlobalService { |
69 | 83 | |
70 | 84 | } |
71 | 85 | |
72 | - if (this.resourceBaseUrl == this.ProtocolType+"localhost/API/Adminapi/") { | |
73 | - if(window.location.host=="localhost:4200") | |
74 | - { | |
75 | - // for 'ng serve --open' command | |
76 | - //**** for localhost:4200 *****// | |
77 | - var date = new Date(); | |
78 | - var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 | |
79 | - localStorage.setItem('loggedInUserDetails', JSON.stringify( | |
80 | - { | |
81 | - "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 | |
82 | - })); | |
83 | - } | |
84 | - | |
85 | - this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); | |
86 | + if (this.resourceBaseUrl == this.ProtocolType+"localhost/API/Adminapi/") { | |
87 | + | |
86 | 88 | if (this.UserTypeName == "Client Admin" || this.UserTypeName == "District Admin") { |
87 | 89 | this.AccountNumber = this.loggedInUser.LicenseInfo.AccountNumber |
88 | 90 | } | ... | ... |