action_policy 0.4.4 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +211 -175
  3. data/README.md +5 -4
  4. data/config/rubocop-rspec.yml +17 -0
  5. data/lib/.rbnext/2.7/action_policy/behaviours/policy_for.rb +62 -0
  6. data/lib/.rbnext/2.7/action_policy/i18n.rb +56 -0
  7. data/lib/.rbnext/2.7/action_policy/policy/cache.rb +101 -0
  8. data/lib/.rbnext/2.7/action_policy/policy/pre_check.rb +162 -0
  9. data/lib/.rbnext/2.7/action_policy/rspec/be_authorized_to.rb +89 -0
  10. data/lib/.rbnext/2.7/action_policy/rspec/have_authorized_scope.rb +124 -0
  11. data/lib/.rbnext/2.7/action_policy/utils/pretty_print.rb +159 -0
  12. data/lib/.rbnext/3.0/action_policy/behaviour.rb +115 -0
  13. data/lib/.rbnext/3.0/action_policy/behaviours/policy_for.rb +62 -0
  14. data/lib/.rbnext/3.0/action_policy/behaviours/scoping.rb +35 -0
  15. data/lib/.rbnext/3.0/action_policy/behaviours/thread_memoized.rb +59 -0
  16. data/lib/.rbnext/3.0/action_policy/ext/policy_cache_key.rb +72 -0
  17. data/lib/.rbnext/3.0/action_policy/policy/aliases.rb +69 -0
  18. data/lib/.rbnext/3.0/action_policy/policy/authorization.rb +87 -0
  19. data/lib/.rbnext/3.0/action_policy/policy/cache.rb +101 -0
  20. data/lib/.rbnext/3.0/action_policy/policy/core.rb +161 -0
  21. data/lib/.rbnext/3.0/action_policy/policy/defaults.rb +31 -0
  22. data/lib/.rbnext/3.0/action_policy/policy/execution_result.rb +37 -0
  23. data/lib/.rbnext/3.0/action_policy/policy/pre_check.rb +162 -0
  24. data/lib/.rbnext/3.0/action_policy/policy/reasons.rb +212 -0
  25. data/lib/.rbnext/3.0/action_policy/policy/scoping.rb +160 -0
  26. data/lib/.rbnext/3.0/action_policy/rspec/be_authorized_to.rb +89 -0
  27. data/lib/.rbnext/3.0/action_policy/rspec/have_authorized_scope.rb +124 -0
  28. data/lib/.rbnext/3.0/action_policy/utils/pretty_print.rb +159 -0
  29. data/lib/.rbnext/3.0/action_policy/utils/suggest_message.rb +19 -0
  30. data/lib/action_policy.rb +7 -1
  31. data/lib/action_policy/behaviour.rb +22 -16
  32. data/lib/action_policy/behaviours/policy_for.rb +10 -3
  33. data/lib/action_policy/behaviours/scoping.rb +2 -1
  34. data/lib/action_policy/behaviours/thread_memoized.rb +1 -3
  35. data/lib/action_policy/ext/module_namespace.rb +1 -6
  36. data/lib/action_policy/ext/policy_cache_key.rb +10 -30
  37. data/lib/action_policy/i18n.rb +1 -1
  38. data/lib/action_policy/lookup_chain.rb +26 -28
  39. data/lib/action_policy/policy/aliases.rb +7 -12
  40. data/lib/action_policy/policy/authorization.rb +8 -7
  41. data/lib/action_policy/policy/cache.rb +11 -17
  42. data/lib/action_policy/policy/core.rb +25 -12
  43. data/lib/action_policy/policy/defaults.rb +3 -9
  44. data/lib/action_policy/policy/execution_result.rb +3 -9
  45. data/lib/action_policy/policy/pre_check.rb +19 -58
  46. data/lib/action_policy/policy/reasons.rb +31 -19
  47. data/lib/action_policy/policy/scoping.rb +5 -6
  48. data/lib/action_policy/rails/controller.rb +6 -1
  49. data/lib/action_policy/rails/policy/instrumentation.rb +1 -1
  50. data/lib/action_policy/rspec/be_authorized_to.rb +5 -9
  51. data/lib/action_policy/rspec/dsl.rb +1 -1
  52. data/lib/action_policy/rspec/have_authorized_scope.rb +5 -7
  53. data/lib/action_policy/utils/pretty_print.rb +21 -24
  54. data/lib/action_policy/utils/suggest_message.rb +1 -3
  55. data/lib/action_policy/version.rb +1 -1
  56. data/lib/generators/action_policy/install/templates/{application_policy.rb → application_policy.rb.tt} +0 -0
  57. data/lib/generators/action_policy/policy/policy_generator.rb +4 -1
  58. data/lib/generators/action_policy/policy/templates/{policy.rb → policy.rb.tt} +0 -0
  59. data/lib/generators/rspec/templates/{policy_spec.rb → policy_spec.rb.tt} +0 -0
  60. data/lib/generators/test_unit/templates/{policy_test.rb → policy_test.rb.tt} +0 -0
  61. metadata +55 -119
  62. data/.gitattributes +0 -2
  63. data/.github/ISSUE_TEMPLATE.md +0 -21
  64. data/.github/PULL_REQUEST_TEMPLATE.md +0 -29
  65. data/.github/bug_report_template.rb +0 -175
  66. data/.gitignore +0 -15
  67. data/.rubocop.yml +0 -54
  68. data/.tidelift.yml +0 -6
  69. data/.travis.yml +0 -31
  70. data/Gemfile +0 -22
  71. data/Rakefile +0 -27
  72. data/action_policy.gemspec +0 -44
  73. data/benchmarks/namespaced_lookup_cache.rb +0 -74
  74. data/benchmarks/pre_checks.rb +0 -73
  75. data/bin/console +0 -14
  76. data/bin/setup +0 -8
  77. data/docs/.nojekyll +0 -0
  78. data/docs/CNAME +0 -1
  79. data/docs/README.md +0 -79
  80. data/docs/_sidebar.md +0 -27
  81. data/docs/aliases.md +0 -122
  82. data/docs/assets/docsify-search.js +0 -364
  83. data/docs/assets/docsify.min.js +0 -3
  84. data/docs/assets/fonts/FiraCode-Medium.woff +0 -0
  85. data/docs/assets/fonts/FiraCode-Regular.woff +0 -0
  86. data/docs/assets/images/banner.png +0 -0
  87. data/docs/assets/images/cache.png +0 -0
  88. data/docs/assets/images/cache.svg +0 -70
  89. data/docs/assets/images/layer.png +0 -0
  90. data/docs/assets/images/layer.svg +0 -35
  91. data/docs/assets/prism-ruby.min.js +0 -1
  92. data/docs/assets/styles.css +0 -347
  93. data/docs/assets/vue.min.css +0 -1
  94. data/docs/authorization_context.md +0 -92
  95. data/docs/behaviour.md +0 -113
  96. data/docs/caching.md +0 -291
  97. data/docs/controller_action_aliases.md +0 -109
  98. data/docs/custom_lookup_chain.md +0 -48
  99. data/docs/custom_policy.md +0 -53
  100. data/docs/debugging.md +0 -55
  101. data/docs/decorators.md +0 -27
  102. data/docs/favicon.ico +0 -0
  103. data/docs/graphql.md +0 -302
  104. data/docs/i18n.md +0 -44
  105. data/docs/index.html +0 -43
  106. data/docs/instrumentation.md +0 -84
  107. data/docs/lookup_chain.md +0 -22
  108. data/docs/namespaces.md +0 -77
  109. data/docs/non_rails.md +0 -28
  110. data/docs/pre_checks.md +0 -57
  111. data/docs/pundit_migration.md +0 -80
  112. data/docs/quick_start.md +0 -118
  113. data/docs/rails.md +0 -120
  114. data/docs/reasons.md +0 -120
  115. data/docs/scoping.md +0 -255
  116. data/docs/testing.md +0 -390
  117. data/docs/writing_policies.md +0 -107
  118. data/gemfiles/jruby.gemfile +0 -8
  119. data/gemfiles/rails42.gemfile +0 -9
  120. data/gemfiles/rails6.gemfile +0 -8
  121. data/gemfiles/railsmaster.gemfile +0 -6
  122. data/lib/action_policy/ext/string_match.rb +0 -14
  123. data/lib/action_policy/ext/yield_self_then.rb +0 -25
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord-jdbcsqlite3-adapter", "~> 52.0"
4
- gem "jdbc-sqlite3"
5
-
6
- gem "rails", "~> 5.0"
7
-
8
- gemspec path: ".."
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "sqlite3", "~> 1.3.0"
4
- gem "rails", "~> 4.2"
5
- gem "thor", "< 1.0"
6
- gem "method_source"
7
- gem "unparser"
8
-
9
- gemspec path: ".."
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "sqlite3"
4
- gem "rails", "6.0.0.beta3"
5
- gem "method_source"
6
- gem "unparser"
7
-
8
- gemspec path: ".."
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "sqlite3", "~> 1.4.0"
4
- gem "rails", github: "rails/rails"
5
-
6
- gemspec path: ".."
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionPolicy
4
- module Ext
5
- # Add match? to String for older Rubys
6
- module StringMatch
7
- refine String do
8
- def match?(regexp)
9
- !regexp.match(self).nil?
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionPolicy
4
- module Ext # :nodoc: all
5
- # Add yield_self and then if missing
6
- module YieldSelfThen
7
- module Ext
8
- unless nil.respond_to?(:yield_self)
9
- def yield_self
10
- yield self
11
- end
12
- end
13
-
14
- alias then yield_self
15
- end
16
-
17
- # See https://github.com/jruby/jruby/issues/5220
18
- ::Object.include(Ext) if RUBY_PLATFORM =~ /java/i
19
-
20
- refine Object do
21
- include Ext
22
- end
23
- end
24
- end
25
- end