vicinityManager/server/services/users/deleteUsers.js
/*
Disables all user items when the user is removed
*/
Disables all user items when the user is removed
Disables all user items when the user is removed
function disableUserItems(items, mail, userId){
  return new Promise(function(resolve, reject) {
    if(items.length > 0){ 
      sync.forEachAll(items,
        function(value, allresult, next, otherParams) {
          disabling(value, otherParams, function(value, result) {
              allresult.push({error: value, message: result});
              next();
          });
        },
        function(allresult) {
          if(allresult.length === items.length){
              resolve(allresult);
          }
        },
        false,
        {mail: mail, userId: userId}
      );
    } else {
      logger.warn({user:mail, action: 'deleteUser', message: "No items to be removed"});
      reject("Nothing to be removed...");
    }
  });
}
function disableUserItems ( items , mail , userId ) { return new Promise ( function ( resolve , reject ) { if ( items . length > 0 ) { sync . forEachAll ( items , function ( value , allresult , next , otherParams ) { disabling ( value , otherParams , function ( value , result ) { allresult . push ( { error : value , message : result } ) ; next ( ) ; } ) ; } , function ( allresult ) { if ( allresult . length === items . length ) { resolve ( allresult ) ; } } , false , { mail : mail , userId : userId } ) ; } else { logger . warn ( { user : mail , action : 'deleteUser' , message : "No items to be removed" } ) ; reject ( "Nothing to be removed..." ) ; } } ) ; }
Disables all user items when the user is removed
Disables all user items when the user is removed
// Check if there is any item to delete // logger.debug('Start async handler...'); // logger.debug('END execution with value =', value, 'and result =', result); // logger.debug('Completed async handler: ' + JSON.stringify(allresult));