couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [06/13] fauxton commit: updated refs/heads/master to 0ec46e9
Date Mon, 14 Jul 2014 08:35:42 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-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 <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

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


Mime
View raw message