示例#1
0
        private async Task <ProfileProperty> ValidateProfilePropertyForSearch(UserSearch search)
        {
            var profilePropertyLogic = new ProfilePropertyLogic(Cache, Context);

            var property = search.ProfilePropertyId.HasValue ?
                           await profilePropertyLogic.GetProfileProperty(search.ProfilePropertyId.Value, search.IsAdmin) :
                           await profilePropertyLogic.GetProfileProperty(search.ProfilePropertyName, search.IsAdmin);

            if (property == null)
            {
                throw new CallerException("Specified profile property does not exist, or you do not have sufficient security privileges to access it");
            }

            // Non admins can only search Public profile properties.
            if (property.Visibility != ProfilePropertyVisibility.Public && !search.IsAdmin)
            {
                throw new CallerException("Specified profile property is not public, and therefore not searchable");
            }

            return(property);
        }
示例#2
0
        public async Task <ProfileProperty> Get(int id)
        {
            var profilePropertyLogic = new ProfilePropertyLogic(Cache, Context);

            return(await profilePropertyLogic.GetProfileProperty(id, IsAdmin));
        }