public static void RenderDesignerFor(this HtmlHelper htmlHelper, ProfileProperty property)
        {
            IPropertyType propertyType = new PropertyTypeResolver().ResolveAll()
               .Single(x => x.Name == property.PropertyType);

            htmlHelper.RenderPartial(propertyType.Settings.Name, property.Details);
        }
        public async Task <ProfileProperty> AddProfileProperty(ProfileProperty profileProperty)
        {
            ValidateProfileProperty(profileProperty);

            var existingProperty = await GetProfileProperty(profileProperty.Name, true);

            if (existingProperty != null)
            {
                throw new CallerException("A ProfileProperty already exists with that name");
            }

            ProfileProperty createdProfileProperty;

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new ProfilePropertyRepository(uow);

                createdProfileProperty = await repo.Create(profileProperty);
            }

            await new ProfilePropertyCache(Cache).InvalidateProfilePropertiesCache();
            await new UserProfilePropertyCache(Cache).InvalidateUserProfilePropertiesCache();

            return(createdProfileProperty);
        }
Exemple #3
0
        public void CreateObject_MapObjectToObject_Success()
        {
            var map = Map.Create("FooProfile", "BarProfile",
                                 MapItem.Create("Id", "Id", "Id"),
                                 MapItem.Create("Name", "FooName", "BarName"));

            var fooProfile = Profile.Create("FooProfile",
                                            ProfileProperty.Create("Id"),
                                            ProfileProperty.Create("FooName"));

            var barProfile = Profile.Create("BarProfile",
                                            ProfileProperty.Create("Id"),
                                            ProfileProperty.Create("BarName"));


            var client = MapperClient.Create(fooProfile, barProfile);

            var foo = new Foo()
            {
                Id      = 1,
                FooName = "Hello World!"
            };

            var bar = new Bar();


            bar = client.Map(foo, bar, map);

            Assert.AreEqual(foo.Id, bar.Id);
            Assert.AreEqual(foo.FooName, bar.BarName);
        }
Exemple #4
0
// Method for creating user profile at signup.

    public void SignUpUser(string email, string firstName, string lastName)
    {
        if (_userName != "veswap")
        {
            Roles.AddUserToRole(_userName, "PaidMembers");
        }
        else
        {
            Roles.AddUserToRole(_userName, "Managers");
        }

        using (SwapEntities myEnt = new SwapEntities())
        {
            var newEntry = new ProfileProperty();
            newEntry.Email     = email;
            newEntry.UserId    = _userId;
            newEntry.UserName  = _userName;
            newEntry.FirstName = firstName;
            newEntry.LastName  = lastName;

            myEnt.AddToProfileProperties(newEntry);
            myEnt.SaveChanges();

            EmailUsersClass sndEmail = new EmailUsersClass("veswap");
            string          body     = sndEmail.PopulateBody(firstName, "Thanks for signing up! Your account is active. Please " +
                                                             "feel free to contact us at [email protected] with any questions or concerns. Thanks again, and happy swapping!");

            sndEmail.SendHtmlFormattedEmail(email, "New message from veSwap.com customer care.", body);
        }
    }
Exemple #5
0
// Method for creating user profile at signup.

    public void SignUpUser(string email, string firstName, string lastName)
    {
        if (_userName == "maestro")
        {
            Roles.AddUserToRole(_userName, "Managers");
        }

        using (CreditMaestroEntities myEnt = new CreditMaestroEntities())
        {
            var newEntry = new ProfileProperty();
            newEntry.EMail     = email;
            newEntry.UserId    = _userId;
            newEntry.UserName  = _userName;
            newEntry.FirstName = firstName;
            newEntry.LastName  = lastName;

            newEntry.BookActivated = true;
            Roles.AddUserToRole(_userName, "BookValidatedUsers");


            myEnt.AddToProfileProperties(newEntry);
            myEnt.SaveChanges();

            EmailUsersClass sndEmail = new EmailUsersClass("veswap");
            string          body     = sndEmail.PopulateBody(firstName, "Thanks for signing up! Your account is active. Please " +
                                                             "feel free to contact us at [email protected] with any questions or concerns. Thanks again!");

            sndEmail.SendHtmlFormattedEmail(email, "New message from creditscoremaestro.com customer care.", body);
        }
    }
Exemple #6
0
    public void ProfilePropertyTest2()
    {
        var prop = new ProfileProperty(GROUP);

        var vcard = new VCard
        {
            Profile = prop
        };

        string s = vcard.ToVcfString();

        IList <VCard> list = VCard.ParseVcf(s);

        Assert.IsNotNull(list);
        Assert.AreEqual(1, list.Count);

        vcard = list[0];

        Assert.IsNotNull(vcard.Profile);

        prop = vcard.Profile;

        Assert.AreEqual(GROUP, prop !.Group);
        Assert.IsFalse(prop.IsEmpty);
    }
Exemple #7
0
    public void GetValueTest()
    {
        VcfRow row  = VcfRow.Parse("Profile:", new VcfDeserializationInfo()) !;
        var    prop = new ProfileProperty(row, VCdVersion.V3_0);

        Assert.AreEqual("VCARD", prop.Value);
    }
        public ActionResult Edit(ProfileProperty profileProperty)
        {
            var collection = Database.GetCollection<ProfileProperty>("ProfileProperty");

            collection.Save(profileProperty);

            return RedirectToAction("Index");
        }
 public static void RenderEditorFor(this HtmlHelper htmlHelper, ProfileProperty property, string value)
 {
     htmlHelper.RenderPartial(property.PropertyType, new PropertyValue
     {
         Property = property,
         Value = value
     });
 }
Exemple #10
0
        public void Should_return_correct_template(SettingsProperty settingsProperty, DataTemplate expectedTemplate)
        {
            var settingsPropertyValue = new SettingsPropertyValue(settingsProperty);
            var model = new ProfileProperty(settingsPropertyValue);

            var template = profilePropertyTemplateSelector.SelectTemplate(model, null);

            template.Should().BeSameAs(expectedTemplate);
        }
Exemple #11
0
        public async Task <ProfileProperty> Post([FromBody] ProfileProperty profileProperty)
        {
            CheckNullBody(profileProperty);

            profileProperty.UpdatedBy = UserId;

            var ProfilePropertyLogic = new ProfilePropertyLogic(Cache, Context);

            return(await ProfilePropertyLogic.AddProfileProperty(profileProperty));
        }
Exemple #12
0
        public async Task <ProfileProperty> Put(int id, [FromBody] ProfileProperty profileProperty)
        {
            CheckNullBody(profileProperty);

            profileProperty.ProfilePropertyId = id;
            profileProperty.UpdatedBy         = UserId;

            var ProfilePropertyLogic = new ProfilePropertyLogic(Cache, Context);

            return(await ProfilePropertyLogic.UpdateProfileProperty(profileProperty));
        }
		private static Task<Uri> GetAuthenticationUri(LoginProvider provider, string loginProcessUri, ILoginStateManager stateManager, ProfileProperty[] requiredProperties)
		{
			var generalLoginStataManager = new DotNetAuth.Profiles.LoginStateManager(stateManager);
			switch (provider.Definition.ProtocolType)
			{
				case ProtocolTypes.OAuth2:
					var scope = provider.Definition.GetRequiredScope(requiredProperties);
					return Task.Factory.StartNew(() => OAuth2Process.GetAuthenticationUri(provider.Definition.GetOAuth2Definition(), provider.GetOAuth2Credentials(), Uri.EscapeDataString(loginProcessUri), scope, generalLoginStataManager));
				default:
					throw new System.Exception("Invalid provider. Provider's protocol type is not set or supported.");
			}
		}
        private void ValidateProfileProperty(ProfileProperty profileProperty)
        {
            if (string.IsNullOrEmpty(profileProperty.PropertyCategory))
            {
                throw new CallerException("You must provide a category to create a profile property");
            }

            if (string.IsNullOrEmpty(profileProperty.Name))
            {
                throw new CallerException("You must provide a property name to create a profile property");
            }
        }
Exemple #15
0
    public void ProfilePropertyTest1()
    {
        var prop = new ProfileProperty(GROUP);

        Assert.IsNotNull(prop);
        Assert.IsNotNull(prop.Value);
        Assert.AreEqual(GROUP, prop.Group);
        Assert.AreEqual("VCARD", prop.Value);

        string s = prop.Value;

        VCardProperty vcProp = prop;

        Assert.AreEqual(vcProp.Value, s);

        TextProperty textProp = prop;

        Assert.AreEqual(textProp.Value, s);
    }
Exemple #16
0
    /// <summary>
    /// Copy ctor
    /// </summary>
    /// <param name="vCard">The vCard to clone.</param>
    private VCard(VCard vCard)
    {
        Version = vCard.Version;

        Func <ICloneable?, object?> cloner = Cloned;

        foreach (KeyValuePair <VCdProp, object> kvp in vCard._propDic)
        {
            Set(kvp.Key, kvp.Value switch
            {
                XmlProperty xmlProp => xmlProp.Clone(),
                IEnumerable <XmlProperty?> xmlPropEnumerable => xmlPropEnumerable.Select(cloner).Cast <XmlProperty?>().ToArray(),
                ProfileProperty profProp => profProp.Clone(),
                TextProperty txtProp => txtProp.Clone(),
                IEnumerable <TextProperty?> txtPropEnumerable => txtPropEnumerable.Select(cloner).Cast <TextProperty?>().ToArray(),
                DateTimeProperty dtTimeProp => dtTimeProp.Clone(),
                IEnumerable <DateTimeProperty?> dtTimePropEnumerable => dtTimePropEnumerable.Select(cloner).Cast <DateTimeProperty?>().ToArray(),
                AddressProperty adrProp => adrProp.Clone(),
                IEnumerable <AddressProperty?> adrPropEnumerable => adrPropEnumerable.Select(cloner).Cast <AddressProperty?>().ToArray(),
                NameProperty nameProp => nameProp.Clone(),
                IEnumerable <NameProperty?> namePropEnumerable => namePropEnumerable.Select(cloner).Cast <NameProperty?>().ToArray(),
                RelationProperty relProp => relProp.Clone(),
                IEnumerable <RelationProperty?> relPropEnumerable => relPropEnumerable.Select(cloner).Cast <RelationProperty?>().ToArray(),
                OrganizationProperty orgProp => orgProp.Clone(),
                IEnumerable <OrganizationProperty?> orgPropEnumerable => orgPropEnumerable.Select(cloner).Cast <OrganizationProperty?>().ToArray(),
                StringCollectionProperty strCollProp => strCollProp.Clone(),
                IEnumerable <StringCollectionProperty?> strCollPropEnumerable => strCollPropEnumerable.Select(cloner).Cast <StringCollectionProperty?>().ToArray(),
                GenderProperty sexProp => sexProp.Clone(),
                IEnumerable <GenderProperty?> sexPropEnumerable => sexPropEnumerable.Select(cloner).Cast <GenderProperty?>().ToArray(),
                GeoProperty geoProp => geoProp.Clone(),
                IEnumerable <GeoProperty?> geoPropEnumerable => geoPropEnumerable.Select(cloner).Cast <GeoProperty?>().ToArray(),
                DataProperty dataProp => dataProp.Clone(),
                IEnumerable <DataProperty?> dataPropEnumerable => dataPropEnumerable.Select(cloner).Cast <DataProperty?>().ToArray(),
                NonStandardProperty nStdProp => nStdProp.Clone(),
                IEnumerable <NonStandardProperty?> nStdPropEnumerable => nStdPropEnumerable.Select(cloner).Cast <NonStandardProperty?>().ToArray(),
                PropertyIDMappingProperty pidMapProp => pidMapProp.Clone(),
                IEnumerable <PropertyIDMappingProperty?> pidMapPropEnumerable => pidMapPropEnumerable.Select(cloner).Cast <PropertyIDMappingProperty?>().ToArray(),
                TimeZoneProperty tzProp => tzProp.Clone(),
                IEnumerable <TimeZoneProperty?> tzPropEnumerable => tzPropEnumerable.Select(cloner).Cast <TimeZoneProperty?>().ToArray(),

                ICloneable cloneable => cloneable.Clone(), // AccessProperty, KindProperty, TimeStampProperty, UuidProperty
                _ => kvp.Value
            });
Exemple #17
0
        public void CreateObject_MapChildToChild_Success()
        {
            var foo = new Foo();

            foo.Child.FooChildName = "Hello World!";

            var bar = new Bar();

            var map = Map.Create("FooProfile", "BarProfile",
                                 MapItem.Create("Name", "Child.FooChildName", "Child.BarChildName"));

            var fooProfile = Profile.Create("FooProfile",
                                            ProfileProperty.Create("Child.FooChildName"));

            var barProfile = Profile.Create("BarProfile",
                                            ProfileProperty.Create("Child.BarChildName"));

            var client = MapperClient.Create(fooProfile, barProfile);

            bar = client.Map(foo, bar, map);

            Assert.AreEqual(foo.Child.FooChildName, bar.Child.BarChildName);
        }
Exemple #18
0
        /// <summary>
        /// Create from a list of mapped strings.
        /// Syntax: '[]:Id FooName Child.FooChildName'
        /// </summary>
        /// <param name="mappingStrings"></param>
        /// <returns></returns>
        public static MapperClient Create(params string[] mappingStrings)
        {
            var client = new MapperClient();

            foreach (var item in mappingStrings)
            {
                var splitItem = item.Split(':');

                var props = new List <ProfileProperty>();

                foreach (var propStr in splitItem[1].Split(' '))
                {
                    props.Add(ProfileProperty.Create(propStr));
                }

                var profile = Profile.Create(splitItem[0],
                                             props.ToArray());

                client.AddProfile(profile);
            }

            return(client);
        }
        private async Task ValidateUniqueness(UserProfileProperty userProfileProperty, ProfileProperty profileProperty)
        {
            UserProfilePropertyLogic userProfilePropertyLogic = new UserProfilePropertyLogic(Cache, Context);

            List <int> users = await userProfilePropertyLogic.FindUsersFromValue(profileProperty.ProfilePropertyId, userProfileProperty.Value);

            if (users != null && users.Count > 0)
            {
                throw new FriendlyException("UserProfileProperty.ValueAlreadyTaken", profileProperty.Name + " is already taken by another user");
            }
        }
Exemple #20
0
 set => SetValue(ProfileProperty, value);
Exemple #21
0
 /// <summary>
 /// Copy ctor.
 /// </summary>
 /// <param name="prop"></param>
 private ProfileProperty(ProfileProperty prop) : base(prop)
 {
 }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (Session["AdministratorRegistery"] != null)
            {
                ProfileProperty propfileinfo = new ProfileProperty()
                {
                    avatarImageSrc = ((Administrator)Session["AdministratorRegistery"]).ad_avatarprofile,
                    name           = ((Administrator)Session["AdministratorRegistery"]).ad_NickName,
                    fullname       = ((Administrator)Session["AdministratorRegistery"]).ad_firstname + " " + ((Administrator)Session["AdministratorRegistery"]).ad_lastname,
                    ipAdmin        = Request.UserHostAddress,
                    Firstname      = ((Administrator)Session["AdministratorRegistery"]).ad_firstname,
                    Lastname       = ((Administrator)Session["AdministratorRegistery"]).ad_lastname,
                    email          = ((Administrator)Session["AdministratorRegistery"]).ad_email,
                    phone          = ((Administrator)Session["AdministratorRegistery"]).ad_phone,
                    mobile         = ((Administrator)Session["AdministratorRegistery"]).ad_mobile,
                    Username       = ((Administrator)Session["AdministratorRegistery"]).Username
                };
                ViewBag.ProfileInfo = propfileinfo;
                //End of Admin Profile
                //start PAGE - TITLE
                string actionName     = filterContext.RouteData.Values["action"].ToString();
                string controllerName = filterContext.RouteData.Values["controller"].ToString();
                ViewBag.pageTitle = TitleFounder.GetAdminPanelTitle(controllerName, actionName);
                //END of PAGE - TITLE


                base.OnActionExecuting(filterContext);
            }
            else if (HttpContext.Request.Cookies.Get(ProjectProperies.AuthCoockieCode()) != null)
            {
                var           coockie          = HttpContext.Request.Cookies.Get(ProjectProperies.AuthCoockieCode());
                Administrator administratorobj = CoockieController.SayMyName(coockie.Value);

                if ((DateTime.Now - administratorobj.SayMyTime).TotalHours > 6)
                {
                    string actionName1     = filterContext.RouteData.Values["action"].ToString();
                    string controllerName1 = filterContext.RouteData.Values["controller"].ToString();
                    string urlRedirection  = controllerName1 + "-A_" + actionName1;
                    if (!urlRedirection.Contains("AdminLoginAuth-A_index"))
                    {
                        TempData["urlRedirection"] = urlRedirection;
                        filterContext.Result       = RedirectToAction("index", "AdminLoginAuth", new { @urlRedirection = urlRedirection });
                    }
                    else
                    {
                        filterContext.Result = RedirectToAction("index", "AdminLoginAuth");
                    }
                }

                ProfileProperty propfileinfo = new ProfileProperty()
                {
                    avatarImageSrc = administratorobj.ad_avatarprofile,
                    name           = administratorobj.ad_NickName,
                    fullname       = administratorobj.ad_firstname + " " + administratorobj.ad_lastname,
                    ipAdmin        = Request.UserHostAddress,
                    Firstname      = administratorobj.ad_firstname,
                    Lastname       = administratorobj.ad_lastname,
                    email          = administratorobj.ad_email,
                    phone          = administratorobj.ad_phone,
                    mobile         = administratorobj.ad_mobile,
                    Username       = administratorobj.Username
                };
                administratorobj.SayMyTime = DateTime.Now;

                var userCookieIDV = new HttpCookie(ProjectProperies.AuthCoockieCode());
                userCookieIDV.Value   = CoockieController.SetCoockie(administratorobj);;
                userCookieIDV.Expires = DateTime.Now.AddYears(5);
                Response.SetCookie(userCookieIDV);

                ViewBag.ProfileInfo = propfileinfo;
                //End of Admin Profile
                //start PAGE - TITLE
                string actionName     = filterContext.RouteData.Values["action"].ToString();
                string controllerName = filterContext.RouteData.Values["controller"].ToString();
                ViewBag.pageTitle = TitleFounder.GetAdminPanelTitle(controllerName, actionName);
                //END of PAGE - TITLE
                base.OnActionExecuting(filterContext);
            }
            else
            {
                string actionName     = filterContext.RouteData.Values["action"].ToString();
                string controllerName = filterContext.RouteData.Values["controller"].ToString();
                string urlRedirection = controllerName + "-A_" + actionName;
                if (!urlRedirection.Contains("AdminLoginAuth-A_index"))
                {
                    TempData["urlRedirection"] = urlRedirection;
                    filterContext.Result       = RedirectToAction("index", "AdminLoginAuth", new { @urlRedirection = urlRedirection });
                }
                else
                {
                    filterContext.Result = RedirectToAction("index", "AdminLoginAuth");
                }
            }
        }
        private async Task <UserProfileProperty> UpdateExistingProfileProperty(UserProfileProperty userProfileProperty, UserProfileProperty existingUserProfileProperty, ProfileProperty profileProperty, bool evaluateUnique, string lockName)
        {
            existingUserProfileProperty.Value = userProfileProperty.Value;

            UserProfileProperty updated;

            if (evaluateUnique)
            {
                using (await BudgeterLock.Lock(lockName))
                {
                    await ValidateUniqueness(userProfileProperty, profileProperty);

                    updated = await UpdateExistingProfilePropertyInDb(existingUserProfileProperty);
                }
            }
            else
            {
                updated = await UpdateExistingProfilePropertyInDb(existingUserProfileProperty);
            }

            existingUserProfileProperty.DateUpdated = updated.DateUpdated;

            return(existingUserProfileProperty);
        }
        private async Task <UserProfileProperty> UpdateUserProfileProperty(UserProfileProperty userProfileProperty, ProfileProperty profileProperty, bool isAdmin, bool uniqueChecked)
        {
            await ValidateUser(userProfileProperty);

            var userProfilePropertyLogic = new UserProfilePropertyLogic(Cache, Context);

            var existingUserProfileProperty = await userProfilePropertyLogic.GetUserProfileProperty(userProfileProperty.UserId, userProfileProperty.ProfilePropertyId, isAdmin);

            UserProfileProperty updatedUserProfileProperty = null;

            var evaluateUnique = ShouldValidateUniqueness(userProfileProperty, profileProperty, uniqueChecked);

            string lockName = "UpdateUserProfileProperty-ProfilePropertyId-" + profileProperty.ProfilePropertyId;

            if (existingUserProfileProperty != null && existingUserProfileProperty.UserProfilePropertyId > 0)
            {
                updatedUserProfileProperty = await ProcessExistingProfileProperty(existingUserProfileProperty, userProfileProperty, profileProperty, evaluateUnique, lockName);
            }
            else
            {
                updatedUserProfileProperty = await ProcessNewProfileProperty(existingUserProfileProperty, userProfileProperty, profileProperty, evaluateUnique, lockName, userProfilePropertyLogic, isAdmin);
            }

            //await SendUserProfilePropertyUpdatedEvent(updatedUserProfileProperty);

            await new UserProfilePropertyCache(Cache).InvalidateUserProfilePropertiesCache(updatedUserProfileProperty.UserId);

            return(updatedUserProfileProperty);
        }
        private async Task <UserProfileProperty> ProcessNewProfileProperty(UserProfileProperty existingUserProfileProperty, UserProfileProperty userProfileProperty, ProfileProperty profileProperty, bool evaluateUnique, string lockName, UserProfilePropertyLogic userProfilePropertyLogic, bool isAdmin)
        {
            if (string.IsNullOrEmpty(userProfileProperty.Value))
            {
                // If the update is empty and the user profile property doesn't exist return a blank profile entry.
                return(existingUserProfileProperty);
            }
            if (existingUserProfileProperty.ProfilePropertyName.ToLower() == "email")
            {
                BudgetUser cascadeCall = null;
                cascadeCall = await CascadeEmail(userProfileProperty);

                // cascade call failed, return
                if (cascadeCall == null)
                {
                    return(existingUserProfileProperty);
                }
                await CreateProfileProperty(userProfileProperty, profileProperty, evaluateUnique, lockName);
            }
            else
            {
                await CreateProfileProperty(userProfileProperty, profileProperty, evaluateUnique, lockName);
            }

            // Now that the property exists, grab it with definition info.
            UserProfileProperty updatedUserProfileProperty = await userProfilePropertyLogic.GetUserProfileProperty(userProfileProperty.UserId, userProfileProperty.ProfilePropertyId, isAdmin);

            return(updatedUserProfileProperty);
        }
        //private async Task SendUserProfilePropertyUpdatedEvent(UserProfileProperty userProfileProperty)
        //{
        //    var message = new UserProfilePropertyUpdated
        //    {
        //        UserProfilePropertyId = userProfileProperty.UserProfilePropertyId,
        //        UserId = userProfileProperty.UserId,
        //        ProfilePropertyId = userProfileProperty.ProfilePropertyId,
        //        ProfilePropertyName = userProfileProperty.ProfilePropertyName,
        //        Level = Level
        //    };

        //    await QueueSender.SendMessage<UserProfilePropertyUpdated>(message);
        //}

        private async Task <UserProfileProperty> ProcessExistingProfileProperty(UserProfileProperty existingUserProfileProperty, UserProfileProperty userProfileProperty, ProfileProperty profileProperty, bool evaluateUnique, string lockName)
        {
            if (userProfileProperty.DateUpdated != default && existingUserProfileProperty.DateUpdated > userProfileProperty.DateUpdated)
            {
                // Don't update if LastUpdated is before the existing.
                return(existingUserProfileProperty);
            }

            if (existingUserProfileProperty.Value == userProfileProperty.Value)
            {
                // Values match, don't update.
                return(existingUserProfileProperty);
            }

            // Cascade email profile update to user email
            if (existingUserProfileProperty.ProfilePropertyName.ToLower() == "email")
            {
                BudgetUser cascadeCall = null;
                cascadeCall = await CascadeEmail(userProfileProperty);

                if (cascadeCall != null)
                {
                    var updatedUserProfileProperty = await UpdateExistingProfileProperty(userProfileProperty,
                                                                                         existingUserProfileProperty, profileProperty, evaluateUnique, lockName);

                    return(updatedUserProfileProperty);
                }
                else
                {
                    // cascade failed, stop and return existing property
                    return(existingUserProfileProperty);
                }
            }
            else
            {
                var updatedUserProfileProperty = await UpdateExistingProfileProperty(userProfileProperty,
                                                                                     existingUserProfileProperty, profileProperty, evaluateUnique, lockName);

                return(updatedUserProfileProperty);
            }
        }
		public override string GetRequiredScope(ProfileProperty[] requiredProperties)
		{
			return "";
		}
        private async Task CreateProfileProperty(UserProfileProperty userProfileProperty, ProfileProperty profileProperty, bool evaluateUnique, string lockName)
        {
            if (evaluateUnique)
            {
                using (await BudgeterLock.Lock(lockName))
                {
                    await ValidateUniqueness(userProfileProperty, profileProperty);

                    await CreateProfilePropertyInDb(userProfileProperty, profileProperty.Visibility);
                }
            }
            else
            {
                await CreateProfilePropertyInDb(userProfileProperty, profileProperty.Visibility);
            }

            await new UserProfilePropertyCache(Cache).InvalidateUserProfilePropertiesCache(userProfileProperty.UserId);
        }
        private void ConfirmRegexRequirements(UserProfileProperty userProfileProperty, ProfileProperty profileProperty)
        {
            if (string.IsNullOrEmpty(profileProperty.PcreRegex))
            {
                return;
            }

            var match = Regex.Match(userProfileProperty.Value, profileProperty.PcreRegex, RegexOptions.IgnoreCase);

            if (!match.Success)
            {
                throw new FriendlyException("UserProfileProperty.RegexRequirementsNotMet", userProfileProperty.Value + " does not meet regex requirements");
            }
        }
 public static void RenderEditorFor(this HtmlHelper htmlHelper, ProfileProperty property)
 {
     RenderEditorFor(htmlHelper, property, null);
 }
        private bool ShouldValidateUniqueness(UserProfileProperty userProfileProperty, ProfileProperty profileProperty, bool uniqueChecked)
        {
            if (uniqueChecked)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(userProfileProperty.Value))
            {
                return(false);
            }

            if (!profileProperty.Unique)
            {
                return(false);
            }

            return(true);
        }
Exemple #32
0
 protected override void AppendProfile(ProfileProperty value) => BuildProperty(VCard.PropKeys.PROFILE, value);
		public override string GetProfileEndpoint(ProfileProperty[] requiredProperties)
		{
			return _genericProvider.UserInfoEndpoint;
		}