Allow plugins to check if user is signed in

Change-Id: Ieb724bef5c30fcfdc676dda4d9562b4901257ddd
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2015-01-20 23:16:26 +01:00
parent 0df53ffac7
commit a30c8355fb
5 changed files with 15 additions and 0 deletions

View File

@ -887,6 +887,10 @@ Redisplays the current web UI view, refreshing all information.
=== Gerrit.refreshMenuBar()
Refreshes Gerrit's menu bar.
[[Gerrit_isSignedIn]]
=== Gerrit.isSignedIn()
Checks if user is signed in.
[[Gerrit_url]]
=== Gerrit.url()
Returns the URL of the Gerrit Code Review server. If invoked with

View File

@ -40,6 +40,7 @@ public class ActionContext extends JavaScriptObject {
go: Gerrit.go,
refresh: Gerrit.refresh,
refreshMenuBar: Gerrit.refreshMenuBar,
isSignedIn: Gerrit.isSignedIn,
showError: Gerrit.showError,
br: function(){return doc.createElement('br')},

View File

@ -66,6 +66,7 @@ public class ApiGlue {
go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
isSignedIn: @com.google.gerrit.client.api.ApiGlue::isSignedIn(),
showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
getCurrentUser: @com.google.gerrit.client.api.ApiGlue::getCurrentUser(),
@ -204,6 +205,10 @@ public class ApiGlue {
Gerrit.refreshMenuBar();
}
private static final boolean isSignedIn() {
return Gerrit.isSignedIn();
}
private static final void showError(String message) {
new ErrorDialog(message).center();
}

View File

@ -54,6 +54,7 @@ final class Plugin extends JavaScriptObject {
go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
isSignedIn: @com.google.gerrit.client.api.ApiGlue::isSignedIn(),
showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
on: function(e,f){G.on(e,f)},
onAction: function(t,n,c){G._onAction(this.name,t,n,c)},

View File

@ -54,6 +54,10 @@ public final class Plugin extends JavaScriptObject {
public final native void refreshMenuBar()
/*-{ return this.refreshMenuBar() }-*/;
/** Check if user is signed in. */
public final native boolean isSignedIn()
/*-{ return this.isSignedIn() }-*/;
/** Show message in Gerrit's ErrorDialog. */
public final native void showError(String message)
/*-{ return this.showError(message) }-*/;