sails-permissions
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -107,4 +107,4 @@ var permissionPolicies = [ | ||
_.intersection(permissionPolicies, policies['*']).length === permissionPolicies.length, | ||
policies.AuthController['*'] = true | ||
policies.AuthController['*'] | ||
]); | ||
} |
@@ -26,8 +26,8 @@ var fnv = require('fnv-plus'); | ||
protocol: req.protocol, | ||
host: req.get('host'), | ||
pathname: req.originalUrl, | ||
host: sails.getHost(), | ||
pathname: req.originalUrl || req.url, | ||
query: req.query | ||
}); | ||
return requestUrl.replace(/password=\w+&/i, 'password=<hidden>'); | ||
return requestUrl.replace(/(password=).*?(&|$)/ig, '$1<hidden>$2'); | ||
} |
@@ -59,3 +59,2 @@ var grants = { | ||
role: adminRole.id, | ||
createdBy: admin.id | ||
}; | ||
@@ -75,4 +74,3 @@ return Permission.findOrCreate(newPermission, newPermission); | ||
action: 'read', | ||
role: registeredRole.id, | ||
createdBy: admin.id | ||
role: registeredRole.id | ||
}, | ||
@@ -82,4 +80,3 @@ { | ||
action: 'read', | ||
role: registeredRole.id, | ||
createdBy: admin.id | ||
role: registeredRole.id | ||
}, | ||
@@ -90,4 +87,9 @@ { | ||
role: registeredRole.id, | ||
createdBy: admin.id, | ||
relation: 'owner' | ||
}, | ||
{ | ||
model: _.find(models, { name: 'User' }).id, | ||
action: 'read', | ||
role: registeredRole.id, | ||
relation: 'owner' | ||
} | ||
@@ -94,0 +96,0 @@ ]; |
@@ -33,3 +33,3 @@ /** | ||
AuthController: { | ||
'*': true | ||
'*': [ 'passport' ] | ||
}, | ||
@@ -36,0 +36,0 @@ |
{ | ||
"name": "sails-permissions", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,58 +8,62 @@ var assert = require('assert'); | ||
var agent | ||
before(function(done) { | ||
describe('PermissionController', function () { | ||
agent = request.agent(sails.hooks.http.app); | ||
var agent | ||
before(function(done) { | ||
agent | ||
.post('/user') | ||
.set('Authorization', adminAuth.Authorization) | ||
.send({ | ||
username: 'newuser1', | ||
email: 'newuser1@example.com', | ||
password: 'lalalal1234' | ||
}) | ||
.expect(200, function (err) { | ||
agent = request.agent(sails.hooks.http.app); | ||
if (err) | ||
return done(err); | ||
agent | ||
.post('/user') | ||
.set('Authorization', adminAuth.Authorization) | ||
.send({ | ||
username: 'newuser1', | ||
email: 'newuser1@example.com', | ||
password: 'lalalal1234' | ||
}) | ||
.expect(200, function (err) { | ||
agent | ||
.post('/auth/local') | ||
.send({ | ||
identifier: 'newuser1', | ||
password: 'lalalal1234' | ||
}) | ||
.expect(200) | ||
.end(function (err, res) { | ||
if (err) | ||
return done(err); | ||
agent.saveCookies(res); | ||
agent | ||
.post('/auth/local') | ||
.send({ | ||
identifier: 'newuser1', | ||
password: 'lalalal1234' | ||
}) | ||
.expect(200) | ||
.end(function (err, res) { | ||
return done(err); | ||
}); | ||
agent.saveCookies(res); | ||
}); | ||
return done(err); | ||
}); | ||
}); | ||
}); | ||
describe('Permission Controller', function () { | ||
}); | ||
describe('User with Registered Role', function () { | ||
describe('Permission Controller', function () { | ||
describe('#find()', function () { | ||
describe('User with Registered Role', function () { | ||
it('should be able to read permissions', function (done) { | ||
describe('#find()', function () { | ||
agent | ||
.get('/permission') | ||
.expect(200) | ||
.end(function (err, res) { | ||
it('should be able to read permissions', function (done) { | ||
var permissions = res.body; | ||
agent | ||
.get('/permission') | ||
.expect(200) | ||
.end(function (err, res) { | ||
assert.ifError(permissions.error); | ||
done(err || permissions.error); | ||
var permissions = res.body; | ||
}); | ||
assert.ifError(permissions.error); | ||
done(err || permissions.error); | ||
}); | ||
}); | ||
}); | ||
@@ -71,4 +75,3 @@ | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60667
1628