couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject [34/50] couchdb commit: updated refs/heads/1.6.x to eeb31cb
Date Wed, 13 Aug 2014 23:26:22 GMT
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/1.6.x
Commit: 18f7d7de741638fdd28e903f938a91c23c37680e
Parents: 4fbeff9
Author: Garren Smith <garren.smith@gmail.com>
Authored: Wed Jun 18 15:55:03 2014 +0200
Committer: Garren Smith <garren.smith@gmail.com>
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'],


Mime
View raw message