moving oauth authorize and deauthrorize into the core module because they are reusable across extensions

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2505 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2012-06-29 19:39:42 +00:00
parent 9cfaf156e2
commit f84dcff900
5 changed files with 8 additions and 7 deletions

View File

@ -53,8 +53,6 @@ function init() {
RS.registerCommand(module, "save-protograph", new Packages.com.google.refine.freebase.commands.SaveProtographCommand()); RS.registerCommand(module, "save-protograph", new Packages.com.google.refine.freebase.commands.SaveProtographCommand());
RS.registerCommand(module, "check-authorization", new Packages.com.google.refine.freebase.commands.auth.CheckAuthorizationCommand()); RS.registerCommand(module, "check-authorization", new Packages.com.google.refine.freebase.commands.auth.CheckAuthorizationCommand());
RS.registerCommand(module, "authorize", new Packages.com.google.refine.freebase.commands.auth.AuthorizeCommand());
RS.registerCommand(module, "deauthorize", new Packages.com.google.refine.freebase.commands.auth.DeAuthorizeCommand());
RS.registerCommand(module, "user-badges", new Packages.com.google.refine.freebase.commands.auth.GetUserBadgesCommand()); RS.registerCommand(module, "user-badges", new Packages.com.google.refine.freebase.commands.auth.GetUserBadgesCommand());
RS.registerCommand(module, "upload-data", new Packages.com.google.refine.freebase.commands.UploadDataCommand()); RS.registerCommand(module, "upload-data", new Packages.com.google.refine.freebase.commands.UploadDataCommand());

View File

@ -102,7 +102,7 @@ if (typeof window.Sign == 'undefined') {
}, },
signin : function(success, provider, width, height) { signin : function(success, provider, width, height) {
var newwin = window.Sign.popup("/command/freebase/authorize/" + provider, width, height); var newwin = window.Sign.popup("/command/core/authorize/" + provider, width, height);
if (newwin !== null) { if (newwin !== null) {
newwin.opener = window; newwin.opener = window;
@ -138,7 +138,7 @@ if (typeof window.Sign == 'undefined') {
signout : function(success,provider) { signout : function(success,provider) {
$.ajax({ $.ajax({
url: "/command/freebase/deauthorize/" + provider, url: "/command/core/deauthorize/" + provider,
success: function() { success: function() {
if (typeof success == 'undefined') { if (typeof success == 'undefined') {
window.location.reload(); window.location.reload();

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.freebase.commands.auth; package com.google.refine.commands.auth;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -163,6 +163,6 @@ public class AuthorizeCommand extends Command {
throw new RuntimeException("neither the 'host' nor 'referer' headers were present in the HTTP response, I can't determine what URL Google Refine is listening to."); throw new RuntimeException("neither the 'host' nor 'referer' headers were present in the HTTP response, I can't determine what URL Google Refine is listening to.");
} }
} }
return "http://" + host + "/command/freebase/authorize/" + provider.getHost(); return "http://" + host + "/command/core/authorize/" + provider.getHost();
} }
} }

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.freebase.commands.auth; package com.google.refine.commands.auth;
import java.io.IOException; import java.io.IOException;

View File

@ -137,6 +137,9 @@ function registerCommands() {
RS.registerCommand(module, "get-all-preferences", new Packages.com.google.refine.commands.GetAllPreferencesCommand()); RS.registerCommand(module, "get-all-preferences", new Packages.com.google.refine.commands.GetAllPreferencesCommand());
RS.registerCommand(module, "set-preference", new Packages.com.google.refine.commands.SetPreferenceCommand()); RS.registerCommand(module, "set-preference", new Packages.com.google.refine.commands.SetPreferenceCommand());
RS.registerCommand(module, "open-workspace-dir", new Packages.com.google.refine.commands.OpenWorkspaceDirCommand()); RS.registerCommand(module, "open-workspace-dir", new Packages.com.google.refine.commands.OpenWorkspaceDirCommand());
RS.registerCommand(module, "authorize", new Packages.com.google.refine.commands.auth.AuthorizeCommand());
RS.registerCommand(module, "deauthorize", new Packages.com.google.refine.commands.auth.DeAuthorizeCommand());
} }
function registerOperations() { function registerOperations() {