vicinityManager/server/services/users/deleteUsers.js
/*
Deletes a selection of users
Users to be removed pass their ids in an array as parameter
*/
Deletes a selection of users
Users to be removed pass their ids in an array as parameter
Deletes a selection of users Users to be removed pass their ids in an array as parameter
function deleteAllUsers(users, mail, userId){
  return new Promise(function(resolve, reject) {
    if(users.length > 0){ 
      logger.debug('Start async handler...');
      sync.forEachAll(users,
        function(value, allresult, next, otherParams) {
          deleting(value, otherParams, function(value, result) {
              allresult.push({value: value, result: result});
              next();
          });
        },
        function(allresult) {
          if(allresult.length === users.length){
              resolve(allresult);
          }
        },
        false,
        { userMail : mail, userId: userId }
      );
    } else {
      logger.warn({user:mail, action: 'deleteUser', message: "No users to be removed"});
      reject("Nothing to be removed...");
    }
  });
}
function deleteAllUsers ( users , mail , userId ) { return new Promise ( function ( resolve , reject ) { if ( users . length > 0 ) { logger . debug ( 'Start async handler...' ) ; sync . forEachAll ( users , function ( value , allresult , next , otherParams ) { deleting ( value , otherParams , function ( value , result ) { allresult . push ( { value : value , result : result } ) ; next ( ) ; } ) ; } , function ( allresult ) { if ( allresult . length === users . length ) { resolve ( allresult ) ; } } , false , { userMail : mail , userId : userId } ) ; } else { logger . warn ( { user : mail , action : 'deleteUser' , message : "No users to be removed" } ) ; reject ( "Nothing to be removed..." ) ; } } ) ; }
Deletes a selection of users
Users to be removed pass their ids in an array as parameter
Deletes a selection of users Users to be removed pass their ids in an array as parameter
// Check if there is any item to delete // logger.debug('END execution with value =', value, 'and result =', result); // logger.debug('Completed async handler: ' + JSON.stringify(allresult));