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

Commit 312f511

Browse files
DanielBriertonWardormeur
authored andcommitted
Remove unnecessary usertype check when inviting ninja
1 parent a7dff27 commit 312f511

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

config/perm/profiles.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ module.exports = function(){
178178
},
179179
{
180180
role: 'basic-user',
181-
userType: 'champion',
182-
extendedUserTypes: true
181+
userType: 'champion'
183182
},
184183
{
185184
role: 'basic-user',

profiles.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,6 @@ module.exports = function (options) {
10201020
// Ninja should have attendee-o13 user type.
10211021
async.series([
10221022
validateRequestingUserIsNotParentOfNinja,
1023-
validateRequestingUserIsParent,
10241023
validateNinjaEmailExists,
10251024
validateNinjaHasAttendeeO13UserType
10261025
], done);
@@ -1035,28 +1034,6 @@ module.exports = function (options) {
10351034
});
10361035
}
10371036

1038-
function validateRequestingUserIsParent (done) {
1039-
var userId = args.user ? args.user.id : null;
1040-
seneca.act({role: 'cd-dojos', cmd: 'load_usersdojos', query: {userId: userId}}, function (err, usersDojos) {
1041-
if (err) return done(err);
1042-
if (_.isEmpty(usersDojos)) {
1043-
// Not yet a member of any Dojo, check the user type in their profile.
1044-
seneca.act({role: plugin, cmd: 'list'}, {query: {userId: userId}}, function (err, parentProfiles) {
1045-
if (err) return done(err);
1046-
var parentProfile = parentProfiles[0];
1047-
if (parentProfile.userType === 'parent-guardian') return done();
1048-
return done(new Error('You must be a parent to invite a Ninja'));
1049-
});
1050-
} else {
1051-
var parentTypeFound = _.find(usersDojos, function (parentUserDojo) {
1052-
return _.contains(parentUserDojo.userTypes, 'parent-guardian');
1053-
});
1054-
if (parentTypeFound) return done();
1055-
return done(new Error('You must be a parent to invite a Ninja'));
1056-
}
1057-
});
1058-
}
1059-
10601037
function validateNinjaEmailExists (done) {
10611038
seneca.act({role: plugin, cmd: 'list', query: {email: ninjaEmail}}, function (err, ninjaProfiles) {
10621039
if (err) return done(err);

0 commit comments

Comments
 (0)