Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 88609f3

Browse files
authored
Fix permissions algorythm (8) to update youth when you're o13 (#201)
1 parent 523505a commit 88609f3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/users/is-self.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ function isSelf (args, cb) {
88
var plugin = args.role;
99
var userId = args.user.id;
1010
var refUserId = args.params.userId || args.params.id ;
11-
if(args.params.query && _.isUndefined(refUserId))
11+
if (args.params.query && _.isUndefined(refUserId)) {
1212
refUserId = args.params.query.userId || args.params.query.id ;
13+
}
14+
if (args.params.profile && _.isUndefined(refUserId)) {
15+
refUserId = args.params.profile.userId;
16+
}
1317
var isSelf = false;
1418
// Could check upon profile, but seems like an overkill to me
1519
if( userId === refUserId ){

profiles.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,6 @@ module.exports = function (options) {
305305
}
306306

307307
function cmd_update_youth (args, done) {
308-
var userId = args.user ? args.user.id : null;
309-
if (!_.contains(args.profile.parents, userId)) {
310-
return done(new Error('Not authorized to update profile'));
311-
}
312308
var profile = args.profile;
313309
var derivedFields = ['password', 'userTypes', 'myChild', 'ownProfileFlag', 'dojos'];
314310

0 commit comments

Comments
 (0)