walruz-rails 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +31 -0
  3. data/Rakefile +49 -0
  4. data/VERSION.yml +4 -0
  5. data/examples/rails/README +243 -0
  6. data/examples/rails/Rakefile +10 -0
  7. data/examples/rails/app/controllers/application_controller.rb +10 -0
  8. data/examples/rails/app/helpers/application_helper.rb +3 -0
  9. data/examples/rails/app/models/beatle.rb +26 -0
  10. data/examples/rails/app/models/colaboration.rb +6 -0
  11. data/examples/rails/app/models/song.rb +10 -0
  12. data/examples/rails/config/boot.rb +110 -0
  13. data/examples/rails/config/database.yml +22 -0
  14. data/examples/rails/config/environment.rb +43 -0
  15. data/examples/rails/config/environments/development.rb +17 -0
  16. data/examples/rails/config/environments/production.rb +28 -0
  17. data/examples/rails/config/environments/test.rb +28 -0
  18. data/examples/rails/config/initializers/backtrace_silencers.rb +7 -0
  19. data/examples/rails/config/initializers/inflections.rb +10 -0
  20. data/examples/rails/config/initializers/mime_types.rb +5 -0
  21. data/examples/rails/config/initializers/new_rails_defaults.rb +19 -0
  22. data/examples/rails/config/initializers/session_store.rb +15 -0
  23. data/examples/rails/config/initializers/walruz_initializer.rb +23 -0
  24. data/examples/rails/config/locales/en.yml +5 -0
  25. data/examples/rails/config/routes.rb +43 -0
  26. data/examples/rails/db/development.sqlite3 +0 -0
  27. data/examples/rails/db/migrate/20090604201506_create_beatles.rb +12 -0
  28. data/examples/rails/db/migrate/20090604201512_create_songs.rb +15 -0
  29. data/examples/rails/db/migrate/20090604201527_create_colaborations.rb +17 -0
  30. data/examples/rails/db/schema.rb +44 -0
  31. data/examples/rails/db/test.sqlite3 +0 -0
  32. data/examples/rails/doc/README_FOR_APP +2 -0
  33. data/examples/rails/lib/tasks/rspec.rake +165 -0
  34. data/examples/rails/lib/walruz/policies/author_policy.rb +9 -0
  35. data/examples/rails/lib/walruz/policies/colaboration_policy.rb +22 -0
  36. data/examples/rails/lib/walruz/policies.rb +33 -0
  37. data/examples/rails/log/development.log +1347 -0
  38. data/examples/rails/log/production.log +0 -0
  39. data/examples/rails/log/server.log +0 -0
  40. data/examples/rails/log/test.log +354 -0
  41. data/examples/rails/public/404.html +30 -0
  42. data/examples/rails/public/422.html +30 -0
  43. data/examples/rails/public/500.html +30 -0
  44. data/examples/rails/public/favicon.ico +0 -0
  45. data/examples/rails/public/images/rails.png +0 -0
  46. data/examples/rails/public/index.html +275 -0
  47. data/examples/rails/public/javascripts/application.js +2 -0
  48. data/examples/rails/public/javascripts/controls.js +963 -0
  49. data/examples/rails/public/javascripts/dragdrop.js +973 -0
  50. data/examples/rails/public/javascripts/effects.js +1128 -0
  51. data/examples/rails/public/javascripts/prototype.js +4320 -0
  52. data/examples/rails/public/robots.txt +5 -0
  53. data/examples/rails/public/unathorized.html +9 -0
  54. data/examples/rails/script/about +4 -0
  55. data/examples/rails/script/autospec +6 -0
  56. data/examples/rails/script/console +3 -0
  57. data/examples/rails/script/dbconsole +3 -0
  58. data/examples/rails/script/destroy +3 -0
  59. data/examples/rails/script/generate +3 -0
  60. data/examples/rails/script/performance/benchmarker +3 -0
  61. data/examples/rails/script/performance/profiler +3 -0
  62. data/examples/rails/script/plugin +3 -0
  63. data/examples/rails/script/runner +3 -0
  64. data/examples/rails/script/server +3 -0
  65. data/examples/rails/script/spec +10 -0
  66. data/examples/rails/script/spec_server +9 -0
  67. data/examples/rails/spec/fixtures/beatles.yml +7 -0
  68. data/examples/rails/spec/fixtures/colaborations.yml +7 -0
  69. data/examples/rails/spec/fixtures/songs.yml +7 -0
  70. data/examples/rails/spec/models/beatle_spec.rb +47 -0
  71. data/examples/rails/spec/models/colaboration_spec.rb +4 -0
  72. data/examples/rails/spec/models/song_spec.rb +4 -0
  73. data/examples/rails/spec/rcov.opts +2 -0
  74. data/examples/rails/spec/spec.opts +4 -0
  75. data/examples/rails/spec/spec_helper.rb +48 -0
  76. data/examples/rails/test/performance/browsing_test.rb +9 -0
  77. data/examples/rails/test/test_helper.rb +38 -0
  78. data/lib/walruz/controller_mixin.rb +107 -0
  79. data/lib/walruz_rails.rb +10 -0
  80. data/spec/controller_mixin_spec.rb +92 -0
  81. data/spec/scenario.rb +247 -0
  82. data/spec/spec_helper.rb +29 -0
  83. metadata +169 -0
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,19 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ # Use ISO 8601 format for JSON serialized times and dates.
15
+ ActiveSupport.use_standard_json_time_format = true
16
+
17
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18
+ # if you're including raw json in an HTML page.
19
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_beatles_session',
9
+ :secret => '6628f79a70375c8d543b6d32994f4898095fec6ec196f9cf165f15581e53d4164f63c26161f7599f44905436cbe0c54fca6a2ebd80bfcb4527579bb3ed441c5f'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,23 @@
1
+ Walruz.setup do |config|
2
+
3
+ #
4
+ # Specify which models behave like Actors in your authorization system
5
+ config.actors = [Beatle, Colaboration]
6
+
7
+ # Specify which models behave like Subjects (default: All of them)
8
+ config.subjects = [ActiveRecord::Base]
9
+
10
+ ActionController::Base.class_eval do
11
+
12
+ rescue_from Walruz::NotAuthorized, :with => 'unathorized'
13
+
14
+ #
15
+ # This method will be called when a user is not authorized. By
16
+ # default it renders a unauthorized template on the public directory
17
+ # with a HTTP status 401 (not authorized)
18
+ def unauthorized(e)
19
+ render :template => 'public/unauthorized.html', :status => 401
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,43 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+
4
+ # Sample of regular route:
5
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # Keep in mind you can assign values other than :controller and :action
7
+
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
12
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route with more complex sub-resources
22
+ # map.resources :products do |products|
23
+ # products.resources :comments
24
+ # products.resources :sales, :collection => { :recent => :get }
25
+ # end
26
+
27
+ # Sample resource route within a namespace:
28
+ # map.namespace :admin do |admin|
29
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
+ # admin.resources :products
31
+ # end
32
+
33
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
+ # map.root :controller => "welcome"
35
+
36
+ # See how all your routes lay out with "rake routes"
37
+
38
+ # Install the default routes as the lowest priority.
39
+ # Note: These default routes make all actions in every controller accessible via GET requests. You should
40
+ # consider removing the them or commenting them out if you're using named routes and resources.
41
+ map.connect ':controller/:action/:id'
42
+ map.connect ':controller/:action/:id.:format'
43
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBeatles < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :beatles do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :beatles
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ class CreateSongs < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :songs do |t|
4
+ t.string :name
5
+ t.integer :author_id
6
+ t.integer :author_type
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :songs
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ class CreateColaborations < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :colaborations do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+
8
+ create_table :beatles_colaborations do |t|
9
+ t.integer :beatle_id
10
+ t.integer :colaboration_id
11
+ end
12
+ end
13
+
14
+ def self.down
15
+ drop_table :colaborations
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20090604201527) do
13
+
14
+ create_table "beatle_colaborations", :force => true do |t|
15
+ t.integer "beatle_id"
16
+ t.integer "colaboration_id"
17
+ end
18
+
19
+ create_table "beatles", :force => true do |t|
20
+ t.string "name"
21
+ t.datetime "created_at"
22
+ t.datetime "updated_at"
23
+ end
24
+
25
+ create_table "beatles_colaborations", :force => true do |t|
26
+ t.integer "beatle_id"
27
+ t.integer "colaboration_id"
28
+ end
29
+
30
+ create_table "colaborations", :force => true do |t|
31
+ t.string "name"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ create_table "songs", :force => true do |t|
37
+ t.string "name"
38
+ t.integer "author_id"
39
+ t.integer "author_type"
40
+ t.datetime "created_at"
41
+ t.datetime "updated_at"
42
+ end
43
+
44
+ end
Binary file
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -0,0 +1,165 @@
1
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
+
3
+ # Don't load rspec if running "rake gems:*"
4
+ unless ARGV.any? {|a| a =~ /^gems/}
5
+
6
+ begin
7
+ require 'spec/rake/spectask'
8
+ rescue MissingSourceFile
9
+ module Spec
10
+ module Rake
11
+ class SpecTask
12
+ def initialize(name)
13
+ task name do
14
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
15
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
16
+
17
+ # ... otherwise, do this:
18
+ raise <<-MSG
19
+
20
+ #{"*" * 80}
21
+ * You are trying to run an rspec rake task defined in
22
+ * #{__FILE__},
23
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
24
+ #{"*" * 80}
25
+ MSG
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ Rake.application.instance_variable_get('@tasks').delete('default')
34
+
35
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
36
+ task :noop do
37
+ end
38
+
39
+ task :default => :spec
40
+ task :stats => "spec:statsetup"
41
+
42
+ desc "Run all specs in spec directory (excluding plugin specs)"
43
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
44
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
45
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
46
+ end
47
+
48
+ namespace :spec do
49
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
50
+ Spec::Rake::SpecTask.new(:rcov) do |t|
51
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
52
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
53
+ t.rcov = true
54
+ t.rcov_opts = lambda do
55
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
56
+ end
57
+ end
58
+
59
+ desc "Print Specdoc for all specs (excluding plugin specs)"
60
+ Spec::Rake::SpecTask.new(:doc) do |t|
61
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
62
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
63
+ end
64
+
65
+ desc "Print Specdoc for all plugin examples"
66
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
67
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
68
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
69
+ end
70
+
71
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
72
+ desc "Run the code examples in spec/#{sub}"
73
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
74
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
75
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
76
+ end
77
+ end
78
+
79
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
80
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
81
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
82
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
83
+ end
84
+
85
+ namespace :plugins do
86
+ desc "Runs the examples for rspec_on_rails"
87
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
88
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
89
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
90
+ end
91
+ end
92
+
93
+ # Setup specs for stats
94
+ task :statsetup do
95
+ require 'code_statistics'
96
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
97
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
98
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
99
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
100
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
101
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
102
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
103
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
104
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
105
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
106
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
107
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
108
+ end
109
+
110
+ namespace :db do
111
+ namespace :fixtures do
112
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
113
+ task :load => :environment do
114
+ ActiveRecord::Base.establish_connection(Rails.env)
115
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
116
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
117
+
118
+ require 'active_record/fixtures'
119
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
120
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
121
+ end
122
+ end
123
+ end
124
+ end
125
+
126
+ namespace :server do
127
+ daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
128
+
129
+ desc "start spec_server."
130
+ task :start do
131
+ if File.exist?(daemonized_server_pid)
132
+ $stderr.puts "spec_server is already running."
133
+ else
134
+ $stderr.puts %Q{Starting up spec_server ...}
135
+ FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
136
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
137
+ end
138
+ end
139
+
140
+ desc "stop spec_server."
141
+ task :stop do
142
+ unless File.exist?(daemonized_server_pid)
143
+ $stderr.puts "No server running."
144
+ else
145
+ $stderr.puts "Shutting down spec_server ..."
146
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
147
+ File.delete(daemonized_server_pid)
148
+ end
149
+ end
150
+
151
+ desc "restart spec_server."
152
+ task :restart => [:stop, :start]
153
+
154
+ desc "check if spec server is running"
155
+ task :status do
156
+ if File.exist?(daemonized_server_pid)
157
+ $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
158
+ else
159
+ $stderr.puts "No server running."
160
+ end
161
+ end
162
+ end
163
+ end
164
+
165
+ end
@@ -0,0 +1,9 @@
1
+ module Policies
2
+ class AuthorPolicy < Walruz::Policy
3
+
4
+ def authorized?(author, song)
5
+ song.author == author
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ module Policies
2
+ class ColaborationPolicy < Walruz::Policy
3
+
4
+ def authorized?(author, song)
5
+ case author
6
+ when Colaboration
7
+ song.author == author
8
+ when Beatle
9
+ if song.author.is_a?(Beatle)
10
+ song.author == author
11
+ else
12
+ return false unless song.author.beatles.include?(author)
13
+ [true, {
14
+ :is_colaboration? => true,
15
+ :colaboration => song.author
16
+ }]
17
+ end
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ module Policies
2
+ extend Walruz::Utils
3
+
4
+ #
5
+ # Add an autoload invocation to the policies you implement on the policies
6
+ # directory.
7
+ # Examples:
8
+ # autoload :AdminPolicy, 'policies/admin'
9
+ # autoload :FooPolicy, 'policies/other'
10
+ #
11
+
12
+ autoload :AuthorPolicy, 'walruz/policies/author_policy'
13
+ autoload :ColaborationPolicy, 'walruz/policies/colaboration_policy'
14
+ autoload :BlahPolicy, 'walruz/policies/blah_policy'
15
+
16
+ # Then use it on your models:
17
+ #
18
+ # class ASubject
19
+ # check_authorization :create => Policies::AdminPolicy
20
+ # end
21
+ #
22
+
23
+ #
24
+ #
25
+ # If you want to use combined policies and give them a name you can do so
26
+ # pretty easily using the `orP`, `andP` or `notP` helpers
27
+ #
28
+ # AdminOrFooPolicy = orP(AdminPolicy, FooPolicy)
29
+ # AdminAndNotFooPolicy = andP(AdminPolicy, notP(FooPolicy))
30
+ #
31
+ AuthorOrColabororPolicy = orP(AuthorPolicy, ColaborationPolicy)
32
+ AuthorAndNotColaboratorPolicy = orP(AuthorPolicy, notP(ColaborationPolicy))
33
+ end