permissions.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. 'use strict';
  2. var denied = exports;
  3. denied.distinct = function(self) {
  4. if (self._fields && Object.keys(self._fields).length > 0) {
  5. return 'field selection and slice';
  6. }
  7. var keys = Object.keys(denied.distinct);
  8. var err;
  9. keys.every(function(option) {
  10. if (self.options[option]) {
  11. err = option;
  12. return false;
  13. }
  14. return true;
  15. });
  16. return err;
  17. };
  18. denied.distinct.select =
  19. denied.distinct.slice =
  20. denied.distinct.sort =
  21. denied.distinct.limit =
  22. denied.distinct.skip =
  23. denied.distinct.batchSize =
  24. denied.distinct.comment =
  25. denied.distinct.maxScan =
  26. denied.distinct.snapshot =
  27. denied.distinct.hint =
  28. denied.distinct.tailable = true;
  29. // aggregation integration
  30. denied.findOneAndUpdate =
  31. denied.findOneAndRemove = function(self) {
  32. var keys = Object.keys(denied.findOneAndUpdate);
  33. var err;
  34. keys.every(function(option) {
  35. if (self.options[option]) {
  36. err = option;
  37. return false;
  38. }
  39. return true;
  40. });
  41. return err;
  42. };
  43. denied.findOneAndUpdate.limit =
  44. denied.findOneAndUpdate.skip =
  45. denied.findOneAndUpdate.batchSize =
  46. denied.findOneAndUpdate.maxScan =
  47. denied.findOneAndUpdate.snapshot =
  48. denied.findOneAndUpdate.hint =
  49. denied.findOneAndUpdate.tailable =
  50. denied.findOneAndUpdate.comment = true;
  51. denied.count = function(self) {
  52. if (self._fields && Object.keys(self._fields).length > 0) {
  53. return 'field selection and slice';
  54. }
  55. var keys = Object.keys(denied.count);
  56. var err;
  57. keys.every(function(option) {
  58. if (self.options[option]) {
  59. err = option;
  60. return false;
  61. }
  62. return true;
  63. });
  64. return err;
  65. };
  66. denied.count.slice =
  67. denied.count.batchSize =
  68. denied.count.comment =
  69. denied.count.maxScan =
  70. denied.count.snapshot =
  71. denied.count.tailable = true;