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

[03/50] couchdb commit: updated refs/heads/Update-Sidebar-Ui to 01dcb16

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/Update-Sidebar-Ui
Commit: 18f7d7de741638fdd28e903f938a91c23c37680e
Parents: 4fbeff9
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

----------------------------------------------------------------------
 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'],