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 91D6A11929 for ; Mon, 23 Jun 2014 07:52:37 +0000 (UTC) Received: (qmail 98632 invoked by uid 500); 23 Jun 2014 07:52:37 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 98572 invoked by uid 500); 23 Jun 2014 07:52:37 -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 98557 invoked by uid 99); 23 Jun 2014 07:52:37 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jun 2014 07:52:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id ECC8B886E54; Mon, 23 Jun 2014 07:52:36 +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 Message-Id: <5b1ec345597d47cbab6890cbb8e5e9b5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couchdb commit: updated refs/heads/master to 18f7d7d Date: Mon, 23 Jun 2014 07:52:36 +0000 (UTC) Repository: couchdb Updated Branches: refs/heads/master 4fbeff9ac -> 18f7d7de7 Fauxton: Create fx roles Fauxton auth works by checking what roles a user has and then decide if they have access to a specific route. The only problem is a regular user might get created but not have any roles. Unlike an admin user who get assigned all the roles on creation. The idea behind this is that certain routes should require a user to be logged in but not necessary have any roles eg. #changePassword route. This allows for a standard fauxton role that all logged in users get given so that we can check via the roles if they are logged Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/18f7d7de Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/18f7d7de Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/18f7d7de Branch: refs/heads/master Commit: 18f7d7de741638fdd28e903f938a91c23c37680e Parents: 4fbeff9 Author: Garren Smith Authored: Wed Jun 18 15:55:03 2014 +0200 Committer: Garren Smith Committed: Mon Jun 23 09:52:06 2014 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/auth/resources.js | 4 ++++ src/fauxton/app/addons/auth/routes.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/18f7d7de/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 6e191b1..ca9a33f 100644 --- a/src/fauxton/app/addons/auth/resources.js +++ b/src/fauxton/app/addons/auth/resources.js @@ -101,6 +101,10 @@ function (app, FauxtonAPI, CouchdbSession) { var user = this.user(); if (user && user.roles) { + if (user.roles.indexOf('fx_loggedIn') === -1) { + user.roles.push('fx_loggedIn'); + } + return user.roles; } http://git-wip-us.apache.org/repos/asf/couchdb/blob/18f7d7de/src/fauxton/app/addons/auth/routes.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/auth/routes.js b/src/fauxton/app/addons/auth/routes.js index 74395e8..ede498a 100644 --- a/src/fauxton/app/addons/auth/routes.js +++ b/src/fauxton/app/addons/auth/routes.js @@ -71,7 +71,7 @@ function(app, FauxtonAPI, Auth) { routes: { 'changePassword': { route: 'changePassword', - roles: ['_admin', '_reader', '_replicator'] + roles: ['fx_loggedIn'] }, 'addAdmin': { roles: ['_admin'],