You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2014/07/14 10:35:42 UTC

[06/13] fauxton commit: updated refs/heads/master to 0ec46e9

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-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/f0824ec1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/f0824ec1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/f0824ec1

Branch: refs/heads/master
Commit: f0824ec1e688460f76c4b175e9ce68aabf3e1cfc
Parents: e95e4fb
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jun 18 15:55:03 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Jun 23 09:52:06 2014 +0200

----------------------------------------------------------------------
 app/addons/auth/resources.js | 4 ++++
 app/addons/auth/routes.js    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f0824ec1/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/resources.js b/app/addons/auth/resources.js
index 6e191b1..ca9a33f 100644
--- a/app/addons/auth/resources.js
+++ b/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-fauxton/blob/f0824ec1/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js
index 74395e8..ede498a 100644
--- a/app/addons/auth/routes.js
+++ b/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'],