Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E246111497 for ; Thu, 9 May 2013 14:30:02 +0000 (UTC) Received: (qmail 54645 invoked by uid 500); 9 May 2013 14:02:31 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 54559 invoked by uid 500); 9 May 2013 14:02:28 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 52519 invoked by uid 99); 9 May 2013 14:01:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 14:01:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 326A788A854; Thu, 9 May 2013 14:00:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Date: Thu, 09 May 2013 14:01:03 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/50] git commit: updated refs/heads/route-events to c33e390 remove reliance on config module for auth module Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/08644bf2 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/08644bf2 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/08644bf2 Branch: refs/heads/route-events Commit: 08644bf2d5d8cdb3064498dd59a3c33aaa951eca Parents: 1f52687 Author: Garren Smith Authored: Thu May 9 09:58:08 2013 +0200 Committer: Garren Smith Committed: Thu May 9 09:58:08 2013 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/auth/resources.js | 39 ++++++++++++++++++++---- src/fauxton/app/modules/fauxton/base.js | 1 + 2 files changed, 33 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/08644bf2/src/fauxton/app/addons/auth/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js index 5b61d50..64dd254 100644 --- a/src/fauxton/app/addons/auth/resources.js +++ b/src/fauxton/app/addons/auth/resources.js @@ -12,11 +12,38 @@ define([ "app", - "api", - "addons/config/resources" + "api" ], -function (app, FauxtonAPI, Config) { +function (app, FauxtonAPI) { + + var Admin = Backbone.Model.extend({ + + url: function () { + return app.host + '/_config/admins/' + this.get("name"); + }, + + isNew: function () { return false; }, + + sync: function (method, model, options) { + + var params = { + url: model.url(), + contentType: 'application/json', + dataType: 'json', + data: JSON.stringify(model.get('value')) + }; + + if (method === 'delete') { + params.type = 'DELETE'; + } else { + params.type = 'PUT'; + } + + return $.ajax(params); + } + }); + var Auth = new FauxtonAPI.addon(); Auth.Session = Backbone.Model.extend({ @@ -78,8 +105,7 @@ function (app, FauxtonAPI, Config) { if (error_promise) { return error_promise; } - var admin = new Config.OptionModel({ - section: "admins", + var admin = new Admin({ name: username, value: password }); @@ -133,8 +159,7 @@ function (app, FauxtonAPI, Config) { info = this.get('info'), userCtx = this.get('userCtx'); - var admin = new Config.OptionModel({ - section: "admins", + var admin = new Admin({ name: userCtx.name, value: password }); http://git-wip-us.apache.org/repos/asf/couchdb/blob/08644bf2/src/fauxton/app/modules/fauxton/base.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js index 91ea581..fbdb402 100644 --- a/src/fauxton/app/modules/fauxton/base.js +++ b/src/fauxton/app/modules/fauxton/base.js @@ -72,6 +72,7 @@ function(app, Backbone) { _.each(this.navLinks, function (link) { if (!link.view) { return; } + //TODO check if establish is a function var establish = link.establish || []; $.when.apply(null, establish).done( function () { self.insertView('#nav-links', link.view).render();