api/hooks/sails-posthook-permissions.js
/**
   * Creates default groups with their own specific roles
   * @return {Array} groups
   */
Creates default groups with their own specific roles
@return {Array} groups
Creates default groups with their own specific roles @return { Array } groups
function initializeGroups () {
    return Role.find()
      .then(function (roles) {
        this.roles = roles;
        return User.findOne({ email: sails.config.permissions.adminEmail });
      })
      .then(function (admin) {
        sails.log('setting additional groups');
        return require('../../config/fixtures/groups').create(this.roles, admin);
      })
      .then(function (groups) {
        return null;
      })
      .catch(function (error) {
        sails.log.error(error);
      });
  }
function initializeGroups ( ) { return Role . find ( ) . then ( function ( roles ) { this . roles = roles ; return User . findOne ( { email : sails . config . permissions . adminEmail } ) ; } ) . then ( function ( admin ) { sails . log ( 'setting additional groups' ) ; return require ( '../../config/fixtures/groups' ) . create ( this . roles , admin ) ; } ) . then ( function ( groups ) { return null ; } ) . catch ( function ( error ) { sails . log . error ( error ) ; } ) ; }
Creates default groups with their own specific roles
 @return {Array} groups
Creates default groups with their own specific roles @return { Array } groups