gluon.js
function (roles) {
              roles.map(function (role) {
                return Role.findOrCreate({
                  where: {
                    code: role,
                    ownerId: req[options.auth.model].id
                  },

                  defaults: {
                    code: role,
                    ownerId: req[options.auth.model].id
                  }
                }).spread(function (role, created) {
                  return role
                }).catch(function (err) {
                  res.database(err)
                });
              });

              return Promise.all(roles);
            }
function (roles) {
              roles.map(function (role) {
                return Role.findOrCreate({
                  where: {
                    code: role,
                    ownerId: req[options.auth.model].id
                  },

                  defaults: {
                    code: role,
                    ownerId: req[options.auth.model].id
                  }
                }).spread(function (role, created) {
                  return role
                }).catch(function (err) {
                  res.database(err)
                });
              });

              return Promise.all(roles);
            }
function ( roles ) { roles . map ( function ( role ) { return Role . findOrCreate ( { where : { code : role , ownerId : req [ options . auth . model ] . id } , defaults : { code : role , ownerId : req [ options . auth . model ] . id } } ) . spread ( function ( role , created ) { return role } ) . catch ( function ( err ) { res . database ( err ) } ) ; } ) ; return Promise . all ( roles ) ; }
Adds a roles to owner

@param {Array<String>} roles Which roles
@returns {Promise.<Instance>}
Adds a roles to owner