public static GetCurrentGroups ( ) : UserGroup[] | ||
return | UserGroup[] |
protected void Page_Load(object sender, EventArgs e) { Page.Title = Properties.Messages.ProfileTitle + " - " + Settings.WikiTitle; if (SessionFacade.LoginKey == null) { UrlTools.Redirect(UrlTools.BuildUrl("Login.aspx?Redirect=Profile.aspx")); } currentUser = SessionFacade.GetCurrentUser(); currentGroups = SessionFacade.GetCurrentGroupNames(); if (currentUser.Username == "admin") { // Admin only has language preferences, stored in a cookie UrlTools.Redirect("Language.aspx"); return; } if (!Page.IsPostBack) { bool usersDataSupported = !currentUser.Provider.UsersDataReadOnly; bool accountDetailsSupported = !currentUser.Provider.UserAccountsReadOnly; pnlUserData.Visible = usersDataSupported; pnlAccount.Visible = accountDetailsSupported; pnlNoChanges.Visible = !usersDataSupported && !accountDetailsSupported; languageSelector.LoadLanguages(); string name = string.IsNullOrEmpty(currentUser.DisplayName) ? currentUser.Username : currentUser.DisplayName; lblUsername.Text = name; txtDisplayName.Text = currentUser.DisplayName; txtEmail1.Text = currentUser.Email; var groups = SessionFacade.GetCurrentGroups().ToList(); lblGroupsList.Text = string.Join(", ", groups.Select(g => g.Name)); //if (groups.Count == 1 && groups[0].Name == "Anonymous") { // bug groupes var user = SessionFacade.GetCurrentUser(); var userName = SessionFacade.GetCurrentUsername(); var firstGroup = user?.Groups?.FirstOrDefault(); var findUser = Users.FindUser(userName); lblGroupsList.Text += " - DEBUG - " + $"Session ID : {Session.SessionID} - userName = {userName} - user.Username = {user.Username} - " + $"user.Groups.Count = {user.Groups?.Count()} - user.Groups[0] = {firstGroup} - " + $"findUser.Groups.Count = {findUser?.Groups?.Count()} - findUser.Groups[0] = {findUser?.Groups?.FirstOrDefault()} - "; } LoadNotificationsStatus(); LoadLanguageAndTimezoneSettings(); rxvDisplayName.ValidationExpression = Settings.DisplayNameRegex; rxvEmail1.ValidationExpression = Settings.EmailRegex; rxvPassword1.ValidationExpression = Settings.PasswordRegex; } }
protected void Page_Load(object sender, EventArgs e) { currentWiki = DetectWiki(); Page.Title = Properties.Messages.ProfileTitle + " - " + Settings.GetWikiTitle(currentWiki); if (SessionFacade.LoginKey == null) { UrlTools.Redirect(UrlTools.BuildUrl(currentWiki, "Login.aspx?Redirect=Profile.aspx")); } currentUser = SessionFacade.GetCurrentUser(currentWiki); currentGroups = SessionFacade.GetCurrentGroupNames(currentWiki); if (currentUser.Username == "admin") { // Admin only has language preferences, stored in a cookie UrlTools.Redirect("Language.aspx"); return; } if (!Page.IsPostBack) { bool usersDataSupported = !currentUser.Provider.UsersDataReadOnly; bool accountDetailsSupported = !currentUser.Provider.UserAccountsReadOnly; pnlUserData.Visible = usersDataSupported; pnlAccount.Visible = accountDetailsSupported; pnlNoChanges.Visible = !usersDataSupported && !accountDetailsSupported; languageSelector.LoadLanguages(); languageSelector.LoadTimezones(); string name = string.IsNullOrEmpty(currentUser.DisplayName) ? currentUser.Username : currentUser.DisplayName; lblUsername.Text = name; txtDisplayName.Text = currentUser.DisplayName; txtEmail1.Text = currentUser.Email; lblGroupsList.Text = string.Join(", ", Array.ConvertAll(SessionFacade.GetCurrentGroups(currentWiki), delegate(UserGroup g) { return(g.Name); })); LoadNotificationsStatus(); LoadLanguageAndTimezoneSettings(); rxvDisplayName.ValidationExpression = GlobalSettings.DisplayNameRegex; rxvEmail1.ValidationExpression = GlobalSettings.EmailRegex; rxvPassword1.ValidationExpression = GlobalSettings.PasswordRegex; } }