Exemple #1
0
        // public  bool ChangePasswordSetIsNewAfterLogin(LoginInfo login)
        // {
        //     IManagerCredential crd = new ManagerCredential();
        //     ILayoutManager layoutManager = new LayoutManager();
        //     IManagerRole roleManager = new ManagerRole();

        //     if (string.IsNullOrEmpty(login.TenantCode) || string.IsNullOrEmpty(login.UserName))
        //     return false;
        //     //Get tenant id with code
        //     Guid tenantId = layoutManager.GetTenantId(InfoType.Tenant, login.TenantCode);
        //     if (tenantId == Guid.Empty)
        //     return false;
        //     //Validate UserName
        //     var userId = crd.GetUserName(tenantId, login.UserName);
        //     if (userId == Guid.Empty)
        //     return false;
        //     var userDetails = roleManager.GetUserDetails(tenantId, userId);
        //     if (userDetails.Id == Guid.Empty)
        //     return fase;
        //     var credentialData=crd.GetCredential(tenantId,userDetails.Id);
        //   return  crd.SetIsNew(tenantId, new CredentialInfo
        //     {
        //     CredentialId = credentialData.CredentialId,
        //     // ParentId=new Guid("E6C7AA71-3C94-46BF-A392-260A14667F95"),
        //     ParentId = userDetails.Id,
        //     UserName = "",
        //     PasswordHash = "",
        //     PasswordSalt = "",
        //     IsNew = true
        //     });
        // }

        //  private void SendMail(string parampass,Email emailTemplate,JObject data,Guid tenantId, Guid userId)
        //  {
        //      IMetadataManager _iMetadataManager = new VPC.Framework.Business.MetadataManager.Contracts.MetadataManager ();
        //     var emailSubType = _iMetadataManager.GetSubTypes ("email");
        //      IEntityResourceManager _iEntityResourceManager = new VPC.Framework.Business.EntityResourceManager.Contracts.EntityResourceManager ();
        //     dynamic jsonObject = new JObject ();
        //     jsonObject.Body = emailTemplate.Body.Value;
        //     jsonObject.Sender = "";
        //     jsonObject.Recipient = data["ContactInformation_Email"];
        //     jsonObject.Date = HelperUtility.GetCurrentUTCDate();
        //     jsonObject.Subject = emailTemplate.Subject;
        //      var superAdminId = _iEntityResourceManager.SaveResult (tenantId, userId, "email", jsonObject, emailSubType[0].Name.ToString ());

        public User UserInfo(ChangePasswordInfo changepassword)
        {
            IManagerCredential crd           = new ManagerCredential();
            ILayoutManager     layoutManager = new LayoutManager();
            IManagerRole       roleManager   = new ManagerRole();
            Guid tenantId    = layoutManager.GetTenantId(InfoType.Tenant, changepassword.TenantCode);
            var  userId      = crd.GetUserName(tenantId, changepassword.UserName);
            var  queryFilter = new List <QueryFilter>();

            queryFilter.Add(new QueryFilter {
                FieldName = "TenantId", Operator = "Equal", Value = tenantId.ToString()
            });
            queryFilter.Add(new QueryFilter {
                FieldName = "InternalId", Operator = "Equal", Value = userId.ToString()
            });
            var queryContext = new QueryContext {
                Fields = "FirstName,LastName", Filters = queryFilter, PageSize = 100, PageIndex = 1, MaxResult = 1
            };
            IEntityResourceManager _iEntityResourceManager = new VPC.Framework.Business.EntityResourceManager.Contracts.EntityResourceManager();
            User      userinfo = null;
            DataTable user     = _iEntityResourceManager.GetResult(tenantId, "User", queryContext);

            if (user.Rows.Count > 0)
            {
                userinfo = EntityMapper <User> .Mapper(user);
            }
            return(userinfo);
        }
Exemple #2
0
        public dynamic getPasswordPolicy(Guid tenantId, bool ConvertToEntity)
        {
            var queryFilter = new List <QueryFilter>();

            queryFilter.Add(new QueryFilter {
                FieldName = "TenantId", Operator = "Equal", Value = tenantId.ToString()
            });
            var queryContext = new QueryContext {
                Fields = "LockoutAttempt,LockoutDuration,PreviousPasswordDifference,ResetOnFirstLogin,IsUppercase,IsLowercase,IsNumber,IsNonAlphaNumeric,CanUserChangeOwnPassword,AllowFirstLastName,PasswordLength,PasswordAge,AllowRecoveryViaMail", Filters = queryFilter, PageSize = 100, PageIndex = 1, MaxResult = 1
            };
            IEntityResourceManager _iEntityResourceManager = new VPC.Framework.Business.EntityResourceManager.Contracts.EntityResourceManager();
            DataTable data1 = _iEntityResourceManager.GetResult(tenantId, "passwordpolicy", queryContext);

            if (data1.Rows.Count == 0)
            {
                return(null);
            }
            // if (data1.Rows[0]["AllowRecoveryViaMail"] == System.DBNull.Value)
            // {
            //     data1.Rows[0]["AllowRecoveryViaMail"] = true;
            // }
            // data1.Rows[0]["AllowRecoveryViaMail"] = ConvertToTrue(data1.Rows[0]["AllowRecoveryViaMail"]);
            // data1.Rows[0]["isLowercase"] = ConvertToTrue(data1.Rows[0]["isLowercase"]);
            // data1.Rows[0]["isUppercase"] = ConvertToTrue(data1.Rows[0]["isUppercase"]);
            // data1.Rows[0]["allowFirstLastName"] = ConvertToTrue(data1.Rows[0]["allowFirstLastName"]);
            // data1.Rows[0]["isNumber"] = ConvertToTrue(data1.Rows[0]["isNumber"]);
            // data1.Rows[0]["isNonAlphaNumeric"] = ConvertToTrue(data1.Rows[0]["isNonAlphaNumeric"]);
            // if (data1.Rows[0]["PreviousPasswordDifference"] == System.DBNull.Value)
            // {
            //     data1.Rows[0]["PreviousPasswordDifference"] = false;
            // }
            // else
            // {
            //     data1.Rows[0]["PreviousPasswordDifference"] = (bool)data1.Rows[0]["PreviousPasswordDifference"];
            // }
            dynamic passwordpolicy = null;

            if (ConvertToEntity)
            {
                passwordpolicy = EntityMapper <PasswordPolicy> .Mapper(data1);
            }
            else
            {
                passwordpolicy = data1;
            }
            return(passwordpolicy);
        }
Exemple #3
0
        public User UserInfo(Guid userId, Guid tenantId)
        {
            var queryFilter = new List <QueryFilter>();

            queryFilter.Add(new QueryFilter {
                FieldName = "TenantId", Operator = "Equal", Value = tenantId.ToString()
            });
            queryFilter.Add(new QueryFilter {
                FieldName = "InternalId", Operator = "Equal", Value = userId.ToString()
            });
            var queryContext = new QueryContext {
                Fields = "FirstName,LastName", Filters = queryFilter, PageSize = 100, PageIndex = 1, MaxResult = 1
            };
            IEntityResourceManager _iEntityResourceManager = new VPC.Framework.Business.EntityResourceManager.Contracts.EntityResourceManager();
            User      userinfo = null;
            DataTable user     = _iEntityResourceManager.GetResult(tenantId, "User", queryContext);

            if (user.Rows.Count > 0)
            {
                userinfo = EntityMapper <User> .Mapper(user);
            }
            return(userinfo);
        }