Add Switch Account link to the current user popdown

Permit site administrators to configure a URL for users to switch the
current user identity.  CacheBasedWebSession automatically invalidates
the old session (and the cookie and XSRF token) during the switch.

For DEVELOPMENT_BECOME_ANY_ACCOUNT this is a faster way to jump to
another test user as it avoids needing to logout first, saving one
click and a reload of the web UI.

For OPENID the user can select another OpenID user quickly using the
login dialog.  This can be useful if someone has two personas, such as
a personal identity used with open source work and another identity
used for day-job or administrative activities.

On gerrit-review the configuration setting will be set to facilitate
switching between a user's Google Accounts.

Change-Id: I8abd58c06e74f96fef5430324e1c24a787823d35
This commit is contained in:
Shawn Pearce
2013-08-29 23:28:13 -07:00
parent fc43e32efe
commit e0cafe4ecd
7 changed files with 49 additions and 17 deletions

View File

@@ -19,8 +19,6 @@ limitations under the License.
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:gerrit='urn:import:com.google.gerrit.client'
xmlns:u='urn:import:com.google.gerrit.client.ui'>
<ui:with field='constants' type='com.google.gerrit.client.GerritConstants'/>
<ui:style>
.panel {
padding: 8px;
@@ -36,16 +34,20 @@ limitations under the License.
.userName {
font-weight: bold;
}
.userLinks {
min-width: 175px;
}
.email {
padding-bottom: 6px;
}
.logout {
padding-left: 16px;
.userLinks {
min-width: 250px;
}
.userLinksRight {
float: right;
}
.switchAccount {
border-right: 1px solid black;
padding-right: 0.5em;
margin-right: 0.5em;
}
</ui:style>
<g:HTMLPanel styleName='{style.panel}'>
@@ -59,9 +61,10 @@ limitations under the License.
<u:InlineHyperlink ui:field='settings' targetHistoryToken='/settings/'>
<ui:msg>Settings</ui:msg>
</u:InlineHyperlink>
<g:Anchor ui:field='logout' styleName="{style.logout}">
<ui:text from='{constants.menuSignOut}' />
</g:Anchor>
<span class='{style.userLinksRight}'>
<a ui:field='switchAccount' class='{style.switchAccount}'><ui:msg>Switch Account</ui:msg></a
><a ui:field='logout'><ui:msg>Sign Out</ui:msg></a>
</span>
</div>
</g:HTMLPanel>
</ui:UiBinder>