api/hooks/sails-posthook-permissions.js
/**
   * Grants admin role and creates default admin person if not set
   * @return {Object} user
   */
Grants admin role and creates default admin person if not set
@return {Object} user
Grants admin role and creates default admin person if not set @return { Object } user
function checkAdminUser() {
    sails.log('checking admin user');
    return User.findOne(1)
      .then(function (user) {
        if (_.isUndefined(user.group) || _.isNull(user.group)) {
          return User.update({ id: user.id }, {
            person: {
              prefix: 'Mr.',
              firstName: 'Admin',
              lastName: 'Admin',
              gender: 'Male',
              dateOfBirth: new Date()  
            },            
            group: 'admin'
          });
        } else {
          return user;
        }
      });
  }
function checkAdminUser ( ) { sails . log ( 'checking admin user' ) ; return User . findOne ( 1 ) . then ( function ( user ) { if ( _ . isUndefined ( user . group ) || _ . isNull ( user . group ) ) { return User . update ( { id : user . id } , { person : { prefix : 'Mr.' , firstName : 'Admin' , lastName : 'Admin' , gender : 'Male' , dateOfBirth : new Date ( ) } , group : 'admin' } ) ; } else { return user ; } } ) ; }
Grants admin role and creates default admin person if not set
 @return {Object} user
Grants admin role and creates default admin person if not set @return { Object } user