/* eslint key-spacing:0 */

/**
 * Policy Mappings
 * (sails.config.policies)
 *
 * Policies are simple functions which run **before** your controllers.
 * You can apply one or more policies to a given controller, or protect
 * its actions individually.
 *
 * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed
 * below by its filename, minus the extension, (e.g. "authenticated")
 *
 * For more information on how policies work, see:
 * http://sailsjs.org/#/documentation/concepts/Policies
 *
 * For more information on configuring policies, check out:
 * http://sailsjs.org/#/documentation/reference/sails.config/sails.config.policies.html
 */

module.exports.policies = {
  '*': false,
  AdminController: {
    '*': 'isAdmin'
  },
  // MobileAppController: true,
  // NexudusController: true,
  // SessionController: true,
  // SubscriptionController: true,
  UploadController: {
    '*': 'sessionAuth'
  },

  AdminSessionController: {
    create:  true,
    oauth:   true,
    destroy: true
  },

  CommentController: {
    createFromEmail: true,
    createBatchFromEmailForm: ['checkAndDecodeToken']
  },

  CommunityController: {
    subscribe:   ['isSocket', 'sessionAuth', 'checkAndSetMembership'],
    unsubscribe: ['isSocket', 'sessionAuth', 'checkAndSetMembership']
  },

  PostController: {
    updateLastRead:         ['sessionAuth', 'checkAndSetPost'],
    subscribe:              ['isSocket', 'sessionAuth', 'checkAndSetPost'],
    unsubscribe:            ['isSocket', 'sessionAuth', 'checkAndSetPost'],
    typing:                 ['isSocket', 'sessionAuth', 'checkAndSetPost'],
    createFromEmailForm:    ['checkAndDecodeToken'],

    // FIXME these two should go in UserController
    subscribeToUpdates:     ['isSocket', 'sessionAuth'],
    unsubscribeFromUpdates: ['isSocket', 'sessionAuth']
  },

  UserController: {
    status: true,
    create: true,
    sendPasswordReset: true
  },

  PaymentController: {
    registerStripe: ['sessionAuth']
  }
}

@@ -702,16 +702,17 @@
  false,%0A
+%0A
   AdminC
@@ -748,20 +748,18 @@
 n'%0A  %7D,%0A
+%0A
  
- //
  MobileA
@@ -776,48 +776,74 @@
 er: 
-true,%0A  // NexudusController: true,%0A  //
+%7B%0A    '*': true%0A  %7D,%0A%0A  NexudusController: %7B%0A    '*': true%0A  %7D,%0A%0A 
  Ses
@@ -861,19 +861,32 @@
 ler:
+ %7B%0A    '*':
  true
-,
 %0A  
-//
+%7D,%0A%0A 
  Sub
@@ -906,21 +906,37 @@
 roller: 
-true,
+%7B%0A    '*': true%0A  %7D,%0A
 %0A  Uploa

Fix logging out and other stuff