/// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	03/01/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            if (IsAdmin)
            {
                lblTitle.Text = string.Format(Localization.GetString("ProfileTitle.Text", LocalResourceFile), User.Username, User.UserID);
            }
            else if (IsRegister)
            {
                lblTitle.Text = Localization.GetString("RequireProfile.Text", LocalResourceFile);
            }
            else
            {
                divTitle.Visible = false;
            }

            //Before we bind the Profile to the editor we need to "update" the visible data
            ProfilePropertyDefinitionCollection properties = new ProfilePropertyDefinitionCollection();

            foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties)
            {
                if (IsAdmin && !IsProfile)
                {
                    profProperty.Visible = true;
                }

                if (!profProperty.Deleted)
                {
                    properties.Add(profProperty);
                }
            }
            ProfileProperties.ShowVisibility = ShowVisibility;
            ProfileProperties.DataSource     = properties;
            ProfileProperties.DataBind();
        }
Beispiel #2
0
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	03/01/2006  Created
        /// </history>
        public override void DataBind()
        {
            if (IsAdmin)
            {
                lblTitle.Text = string.Format(Localization.GetString("ProfileTitle.Text", LocalResourceFile), User.Username, User.UserID);
            }
            else
            {
                trTitle.Visible = false;
            }

            //Before we bind the Profile to the editor we need to "update" the visible data
            ProfilePropertyDefinitionCollection properties = UserProfile.ProfileProperties;

            foreach (ProfilePropertyDefinition profProperty in properties)
            {
                if (IsAdmin)
                {
                    profProperty.Visible = true;
                }
            }

            ProfileProperties.ShowVisibility = ShowVisibility;
            ProfileProperties.DataSource     = UserProfile.ProfileProperties;
            ProfileProperties.DataBind();
        }
        public void UpdateProfile(string username, ProfileProperties profileProperties)
        {
            MembershipUser memberUser = Membership.GetUser(username);

            if (memberUser == null)
            {
                throw new AggregateException("There is not found username in member.");
            }

            IMemberProfile adminProfile = new AdminProfile(ProfileBase.Create(username));

            adminProfile.Setting(profileProperties);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Moves a property
        /// </summary>
        /// <param name="index">The index of the Property to move</param>
        /// <param name="destIndex">The new index of the Property</param>
        /// -----------------------------------------------------------------------------
        private void MoveProperty(int index, int destIndex)
        {
            ProfilePropertyDefinition profileProperty     = ProfileProperties[index];
            ProfilePropertyDefinition nextProfileProperty = ProfileProperties[destIndex];

            int currentOrder = profileProperty.ViewOrder;
            int nextOrder    = nextProfileProperty.ViewOrder;

            //Swap ViewOrders
            profileProperty.ViewOrder     = nextOrder;
            nextProfileProperty.ViewOrder = currentOrder;

            //Refresh Grid
            ProfileProperties.Sort();
            BindGrid();
        }
 ProfileProperties IPropertiesInterface.this[UGUI user] => m_PropertiesLock.AcquireReaderLock(() =>
 {
     ProfileProperties props;
     if (!m_Properties.TryGetValue(user.ID, out props))
     {
         props = new ProfileProperties
         {
             User          = user,
             Partner       = UGUI.Unknown,
             WebUrl        = string.Empty,
             WantToText    = string.Empty,
             SkillsText    = string.Empty,
             Language      = string.Empty,
             AboutText     = string.Empty,
             FirstLifeText = string.Empty
         };
     }
     return(props);
 });
        private void HandleAvatarPropertiesUpdate(ViewerAgent agent, SceneInterface scene, Message m)
        {
            var req = (AvatarPropertiesUpdate)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            if (agent.ProfileService == null)
            {
                return;
            }

            var props = new ProfileProperties
            {
                ImageID          = UUID.Zero,
                FirstLifeImageID = UUID.Zero,
                Partner          = UGUI.Unknown,
                User             = agent.Owner,
                SkillsText       = string.Empty,
                WantToText       = string.Empty,
                Language         = string.Empty,

                AboutText     = req.AboutText,
                FirstLifeText = req.FLAboutText
            };

            props.ImageID        = req.ImageID;
            props.PublishMature  = req.MaturePublish;
            props.PublishProfile = req.AllowPublish;
            props.WebUrl         = req.ProfileURL;

            try
            {
                agent.ProfileService.Properties[agent.Owner, ProfileServiceInterface.PropertiesUpdateFlags.Properties] = props;
            }
            catch
            {
                agent.SendAlertMessage("Error updating properties", scene.ID);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This method is responsible for taking in posted information from the grid and
        /// persisting it to the property definition collection
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void ProcessPostBack()
        {
            string[] newOrder = ClientAPI.GetClientSideReorder(grdProfileProperties.ClientID, Page);
            for (int i = 0; i <= grdProfileProperties.Items.Count - 1; i++)
            {
                DataGridItem dataGridItem = grdProfileProperties.Items[i];
                ProfilePropertyDefinition profileProperty = ProfileProperties[i];
                CheckBox checkBox = (CheckBox)dataGridItem.Cells[COLUMN_REQUIRED].Controls[0];
                profileProperty.Required = checkBox.Checked;
                checkBox = (CheckBox)dataGridItem.Cells[COLUMN_VISIBLE].Controls[0];
                profileProperty.Visible = checkBox.Checked;
            }

            //assign vieworder
            for (int i = 0; i <= newOrder.Length - 1; i++)
            {
                ProfileProperties[Convert.ToInt32(newOrder[i])].ViewOrder = i;
            }
            ProfileProperties.Sort();
        }
        private void HandleAvatarInterestsUpdate(ViewerAgent agent, SceneInterface scene, Message m)
        {
            var req = (AvatarInterestsUpdate)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            if (agent.ProfileService == null)
            {
                return;
            }

            var props = new ProfileProperties
            {
                ImageID          = UUID.Zero,
                FirstLifeImageID = UUID.Zero,
                FirstLifeText    = string.Empty,
                AboutText        = string.Empty,
                Partner          = UGUI.Unknown,
                User             = agent.Owner,
                SkillsMask       = req.SkillsMask,
                SkillsText       = req.SkillsText,
                WantToMask       = req.WantToMask,
                WantToText       = req.WantToText,
                Language         = req.LanguagesText
            };

            try
            {
                agent.ProfileService.Properties[agent.Owner, ProfileServiceInterface.PropertiesUpdateFlags.Interests] = props;
            }
            catch
            {
                agent.SendAlertMessage("Error updating interests", scene.ID);
            }
        }
Beispiel #9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	03/01/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            //Before we bind the Profile to the editor we need to "update" the visible data
            var properties = new ProfilePropertyDefinitionCollection();

            foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties)
            {
                if (IsAdmin && !IsProfile)
                {
                    profProperty.Visible = true;
                }

                if (!profProperty.Deleted)
                {
                    properties.Add(profProperty);
                }
            }

            ProfileProperties.User           = User;
            ProfileProperties.ShowVisibility = ShowVisibility;
            ProfileProperties.DataSource     = properties;
            ProfileProperties.DataBind();
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            //Before we bind the Profile to the editor we need to "update" the visible data
            var properties = new ProfilePropertyDefinitionCollection();
            var imageType  = new ListController().GetListEntryInfo("DataType", "Image");

            foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties)
            {
                if (IsAdmin && !IsProfile)
                {
                    profProperty.Visible = true;
                }

                if (!profProperty.Deleted && (Request.IsAuthenticated || profProperty.DataType != imageType.EntryID))
                {
                    properties.Add(profProperty);
                }
            }

            ProfileProperties.User           = User;
            ProfileProperties.ShowVisibility = ShowVisibility;
            ProfileProperties.DataSource     = properties;
            ProfileProperties.DataBind();
        }
        private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, ProfileProperties mamlProfileProperties)
        {
            var profile = new TrafficManagerProfile
            {
                Name = profileName,
                ResourceGroupName = resourceGroupName,
                ProfileStatus     = mamlProfileProperties.ProfileStatus,
                RelativeDnsName   = mamlProfileProperties.DnsConfig.RelativeName,
                Ttl = mamlProfileProperties.DnsConfig.Ttl,
                TrafficRoutingMethod = mamlProfileProperties.TrafficRoutingMethod,
                MonitorProtocol      = mamlProfileProperties.MonitorConfig.Protocol,
                MonitorPort          = mamlProfileProperties.MonitorConfig.Port,
                MonitorPath          = mamlProfileProperties.MonitorConfig.Path
            };

            if (mamlProfileProperties.Endpoints != null)
            {
                profile.Endpoints = new List <TrafficManagerEndpoint>();

                foreach (Endpoint endpoint in mamlProfileProperties.Endpoints)
                {
                    profile.Endpoints.Add(new TrafficManagerEndpoint
                    {
                        Name           = endpoint.Name,
                        Type           = endpoint.Type,
                        Target         = endpoint.Properties.Target,
                        EndpointStatus = endpoint.Properties.EndpointStatus,
                        Location       = endpoint.Properties.EndpointLocation,
                        Priority       = endpoint.Properties.Priority,
                        Weight         = endpoint.Properties.Weight
                    });
                }
            }

            return(profile);
        }
        public void ThenICanSeeEditedLanguage(Table table)
        {
            ProfileProperties values = table.CreateInstance <ProfileProperties>();

            ProfilePage.ValidateEditLanguge(values.OldLanguage, values.OldLanguageLevel, values.NewLanguage, values.NewLanguageLevel);
        }
        public void GivenICanEditThisLanguage(Table table)
        {
            ProfileProperties values = table.CreateInstance <ProfileProperties>();

            ProfilePage.EditLanguge(values.OldLanguage, values.OldLanguageLevel, values.NewLanguage, values.NewLanguageLevel);
        }
        public void ThenICannotSeeDeletedLanguage(Table table)
        {
            ProfileProperties values = table.CreateInstance <ProfileProperties>();

            ProfilePage.ValidateLanguage(values.Language, values.LanguageLevel);
        }
        public void GivenICanDeleteThisLanguage(Table table)
        {
            ProfileProperties values = table.CreateInstance <ProfileProperties>();

            ProfilePage.DeleteLanguge(values.Language, values.LanguageLevel);
        }
Beispiel #16
0
 public User RegisterUser(string username, string password, ProfileProperties profileProperties)
 {
     throw new NotImplementedException();
 }
        public User RegisterUser(string username, string password, ProfileProperties profileProperties)
        {
            MembershipCreateStatus status;
            User user = new User();

            user.IsAuthenticated = false;

            Membership.CreateUser(username, password, profileProperties.Email,
                                  Guid.NewGuid().ToString(), Guid.NewGuid().ToString(),
                                  true, out status);

            if (status == MembershipCreateStatus.Success)
            {
                MembershipUser newlyCreatedUser = Membership.GetUser(username);
                user.AuthenticationToken = newlyCreatedUser.ProviderUserKey.ToString();
                user.Email           = profileProperties.Email;
                user.UserName        = username;
                user.IsAuthenticated = true;

                // User to Role
                Roles.AddUserToRole(username, profileProperties.MemberGroupId.ToString());

                // Add Profile Data
                IMemberProfile adminProfile = new AdminProfile(ProfileBase.Create(user.UserName));
                adminProfile.Setting(profileProperties);
            }
            else
            {
                switch (status)
                {
                //case MembershipCreateStatus.DuplicateEmail:
                //    throw new InvalidOperationException(
                //           "There is already a user with this email address.");
                //case MembershipCreateStatus.DuplicateUserName:
                //    throw new InvalidOperationException(
                //           "There is already a user with this email address.");
                //case MembershipCreateStatus.InvalidEmail:
                //    throw new InvalidOperationException(
                //           "Your email address is invalid");
                //default:
                //    throw new InvalidOperationException(
                //    "There was a problem creating your account. Please try again.");

                case MembershipCreateStatus.DuplicateUserName:
                    throw new InvalidOperationException("User name already exists. Please enter a different user name.");

                case MembershipCreateStatus.DuplicateEmail:
                    throw new InvalidOperationException("A user name for that e-mail address already exists. Please enter a different e-mail address.");

                case MembershipCreateStatus.InvalidPassword:
                    throw new InvalidOperationException("The password provided is invalid. Please enter a valid password value.");

                case MembershipCreateStatus.InvalidEmail:
                    throw new InvalidOperationException("The e-mail address provided is invalid. Please check the value and try again.");

                case MembershipCreateStatus.InvalidAnswer:
                    throw new InvalidOperationException("The password retrieval answer provided is invalid. Please check the value and try again.");

                case MembershipCreateStatus.InvalidQuestion:
                    throw new InvalidOperationException("The password retrieval question provided is invalid. Please check the value and try again.");

                case MembershipCreateStatus.InvalidUserName:
                    throw new InvalidOperationException("The user name provided is invalid. Please check the value and try again.");

                case MembershipCreateStatus.ProviderError:
                    throw new InvalidOperationException("The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.");

                case MembershipCreateStatus.UserRejected:
                    throw new InvalidOperationException("The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator.");

                default:
                    throw new InvalidOperationException("An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.");
                }
            }

            return(user);
        }
        private void HandleAvatarPropertiesRequest(ViewerAgent agent, SceneInterface scene, Message m)
        {
            var req = (AvatarPropertiesRequest)m;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            ProfileServiceData serviceData;
            UGUI uui;

            try
            {
                serviceData = LookupProfileService(scene, req.AvatarID, out uui);
            }
            catch
            {
                return;
            }

            UserAgentServiceInterface.UserInfo userInfo;
            ProfileProperties props;

            try
            {
                userInfo = serviceData.UserAgentService.GetUserInfo(uui);
            }
            catch
#if DEBUG
            (Exception e)
#endif
            {
#if DEBUG
                m_Log.Debug("Exception at userinfo request", e);
#endif
                userInfo = new UserAgentServiceInterface.UserInfo
                {
                    FirstName   = string.Empty,
                    LastName    = string.Empty,
                    UserFlags   = 0,
                    UserCreated = new Date(),
                    UserTitle   = string.Empty
                };
            }

            try
            {
                props = serviceData.ProfileService.Properties[uui];
            }
            catch
#if DEBUG
            (Exception e)
#endif
            {
#if DEBUG
                m_Log.Debug("Exception at properties request", e);
#endif
                props = new ProfileProperties
                {
                    ImageID          = "5748decc-f629-461c-9a36-a35a221fe21f",
                    FirstLifeImageID = "5748decc-f629-461c-9a36-a35a221fe21f",
                    User             = uui,
                    Partner          = UGUI.Unknown,
                    AboutText        = string.Empty,
                    FirstLifeText    = string.Empty,
                    Language         = string.Empty,
                    WantToText       = string.Empty,
                    SkillsText       = string.Empty,
                    WebUrl           = string.Empty
                };
            }

            var res = new AvatarPropertiesReply
            {
                AgentID  = req.AgentID,
                AvatarID = req.AvatarID,

                ImageID       = props.ImageID,
                FLImageID     = props.FirstLifeImageID,
                PartnerID     = props.Partner.ID,
                AboutText     = props.AboutText,
                FLAboutText   = props.FirstLifeText,
                BornOn        = userInfo.UserCreated.ToString("M/d/yyyy", CultureInfo.InvariantCulture),
                ProfileURL    = props.WebUrl,
                CharterMember = new byte[] { 0 },
                Flags         = 0
            };
            agent.SendMessageAlways(res, scene.ID);

            var res2 = new AvatarInterestsReply
            {
                AgentID  = req.AgentID,
                AvatarID = req.AvatarID
            };
            agent.SendMessageAlways(res2, scene.ID);

            var res3 = new AvatarGroupsReply
            {
                AgentID  = req.AgentID,
                AvatarID = req.AvatarID
            };
            /* when the scene has a groups service, we check which groups the avatar has */
            if (scene.GroupsService != null)
            {
                try
                {
                    foreach (var gmem in scene.GroupsService.Memberships[uui, uui])
                    {
                        res3.GroupData.Add(new AvatarGroupsReply.GroupDataEntry
                        {
                            GroupPowers     = gmem.GroupPowers,
                            AcceptNotices   = gmem.IsAcceptNotices,
                            GroupTitle      = gmem.GroupTitle,
                            GroupName       = gmem.Group.GroupName,
                            GroupInsigniaID = gmem.GroupInsigniaID,
                            ListInProfile   = gmem.IsListInProfile
                        });
                    }
                }
                catch (GroupsServiceNotFoundException)
                {
                    /* intentionally ignored */
                }
                catch
#if DEBUG
                (Exception e)
#endif
                {
                    /* do not expose exceptions to caller */
#if DEBUG
                    m_Log.Debug("Exception at groups request", e);
#endif
                }
            }
            agent.SendMessageAlways(res3, scene.ID);
        }