api/hooks/sails-posthook-permissions.js
/**
   * Install the application. Sets up additional Roles and Permissions
   * @return {Array} roles
   */
Install the application. Sets up additional Roles and Permissions
@return {Array} roles
Install the application . Sets up additional Roles and Permissions @return { Array } roles
function initializeRoles () {
    sails.log('finding or creating roles');
    return Promise.all(
      _.map(['public', 'registered'], function (defaultRole) {
        return Role.findOne({ name: defaultRole }).then(function (role) {
          return Permission.destroy({ role: role.id });
        });
      })
    ).then(function () {
      return require('../../config/fixtures/role').create();
    });
  }
function initializeRoles ( ) { sails . log ( 'finding or creating roles' ) ; return Promise . all ( _ . map ( [ 'public' , 'registered' ] , function ( defaultRole ) { return Role . findOne ( { name : defaultRole } ) . then ( function ( role ) { return Permission . destroy ( { role : role . id } ) ; } ) ; } ) ) . then ( function ( ) { return require ( '../../config/fixtures/role' ) . create ( ) ; } ) ; }
Install the application.
Install the application .