corral_acl 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Gemfile +12 -1
  4. data/LICENSE +1 -1
  5. data/README.md +2 -2
  6. data/Rakefile +34 -0
  7. data/bin/test +9 -0
  8. data/corral.gemspec +12 -12
  9. data/lib/corral/version.rb +1 -1
  10. data/lib/tasks/corral_tasks.rake +4 -0
  11. data/test/corral_test.rb +7 -0
  12. data/test/dummy/Rakefile +6 -0
  13. data/test/dummy/app/assets/config/manifest.js +4 -0
  14. data/test/dummy/app/assets/images/.keep +0 -0
  15. data/test/dummy/app/assets/javascripts/application.js +13 -0
  16. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  17. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  20. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  21. data/test/dummy/app/controllers/application_controller.rb +3 -0
  22. data/test/dummy/app/controllers/concerns/.keep +0 -0
  23. data/test/dummy/app/helpers/application_helper.rb +2 -0
  24. data/test/dummy/app/jobs/application_job.rb +2 -0
  25. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  26. data/test/dummy/app/models/application_record.rb +3 -0
  27. data/test/dummy/app/models/concerns/.keep +0 -0
  28. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  30. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  31. data/test/dummy/bin/bundle +3 -0
  32. data/test/dummy/bin/rails +4 -0
  33. data/test/dummy/bin/rake +4 -0
  34. data/test/dummy/bin/setup +34 -0
  35. data/test/dummy/bin/update +29 -0
  36. data/test/dummy/config.ru +5 -0
  37. data/test/dummy/config/application.rb +15 -0
  38. data/test/dummy/config/boot.rb +5 -0
  39. data/test/dummy/config/cable.yml +9 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +54 -0
  43. data/test/dummy/config/environments/production.rb +86 -0
  44. data/test/dummy/config/environments/test.rb +42 -0
  45. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  46. data/test/dummy/config/initializers/assets.rb +11 -0
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +4 -0
  52. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/puma.rb +47 -0
  57. data/test/dummy/config/routes.rb +3 -0
  58. data/test/dummy/config/secrets.yml +22 -0
  59. data/test/dummy/config/spring.rb +6 -0
  60. data/test/dummy/lib/assets/.keep +0 -0
  61. data/test/dummy/log/.keep +0 -0
  62. data/test/dummy/public/404.html +67 -0
  63. data/test/dummy/public/422.html +67 -0
  64. data/test/dummy/public/500.html +66 -0
  65. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  66. data/test/dummy/public/apple-touch-icon.png +0 -0
  67. data/test/dummy/public/favicon.ico +0 -0
  68. data/test/test_helper.rb +20 -0
  69. metadata +90 -51
  70. data/.rspec +0 -2
  71. data/doc/Ability.html +0 -257
  72. data/doc/Corral.html +0 -131
  73. data/doc/Corral/Ability.html +0 -802
  74. data/doc/Corral/AccessDenied.html +0 -146
  75. data/doc/Corral/AuthorizationNotPerformed.html +0 -145
  76. data/doc/Corral/ControllerAdditions.html +0 -513
  77. data/doc/Corral/ControllerAdditions/ClassMethods.html +0 -277
  78. data/doc/Corral/Error.html +0 -141
  79. data/doc/Corral/Generators.html +0 -117
  80. data/doc/Corral/Generators/AbilityGenerator.html +0 -195
  81. data/doc/Corral/NullRule.html +0 -226
  82. data/doc/Corral/SubjectRule.html +0 -406
  83. data/doc/_index.html +0 -194
  84. data/doc/class_list.html +0 -51
  85. data/doc/css/common.css +0 -1
  86. data/doc/css/full_list.css +0 -58
  87. data/doc/css/style.css +0 -474
  88. data/doc/doc/_index.html +0 -87
  89. data/doc/doc/class_list.html +0 -51
  90. data/doc/doc/css/common.css +0 -1
  91. data/doc/doc/css/full_list.css +0 -58
  92. data/doc/doc/css/style.css +0 -474
  93. data/doc/doc/file_list.html +0 -51
  94. data/doc/doc/frames.html +0 -17
  95. data/doc/doc/index.html +0 -87
  96. data/doc/doc/js/app.js +0 -243
  97. data/doc/doc/js/full_list.js +0 -216
  98. data/doc/doc/js/jquery.js +0 -4
  99. data/doc/doc/method_list.html +0 -51
  100. data/doc/doc/top-level-namespace.html +0 -102
  101. data/doc/file.README.html +0 -82
  102. data/doc/file_list.html +0 -56
  103. data/doc/frames.html +0 -17
  104. data/doc/index.html +0 -82
  105. data/doc/js/app.js +0 -243
  106. data/doc/js/full_list.js +0 -216
  107. data/doc/js/jquery.js +0 -4
  108. data/doc/method_list.html +0 -211
  109. data/doc/top-level-namespace.html +0 -114
  110. data/spec/corral/ability_spec.rb +0 -26
  111. data/spec/spec_helper.rb +0 -97
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
5
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
6
+ require "rails/test_help"
7
+
8
+ # Filter out Minitest backtrace while allowing backtrace from other libraries
9
+ # to be shown.
10
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
11
+
12
+ Rails::TestUnitReporter.executable = 'bin/test'
13
+
14
+ # Load fixtures from the engine
15
+ if ActiveSupport::TestCase.respond_to?(:fixture_path=)
16
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
17
+ ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
18
+ ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files"
19
+ ActiveSupport::TestCase.fixtures :all
20
+ end
metadata CHANGED
@@ -1,67 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corral_acl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
- - Arcaire
8
- - Liam White
7
+ - Elliot Speck (Arcaire)
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-07-06 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Yet another authorization solution.
15
- email: "/dev/null"
11
+ date: 2016-08-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.2.0
33
+ description: Yet another opinionated ACL framework.
34
+ email:
35
+ - rubygems@elliot.pro
16
36
  executables: []
17
37
  extensions: []
18
38
  extra_rdoc_files: []
19
39
  files:
20
40
  - ".gitignore"
21
- - ".rspec"
22
41
  - Gemfile
23
42
  - LICENSE
24
43
  - README.md
44
+ - Rakefile
45
+ - bin/test
25
46
  - corral.gemspec
26
- - doc/Ability.html
27
- - doc/Corral.html
28
- - doc/Corral/Ability.html
29
- - doc/Corral/AccessDenied.html
30
- - doc/Corral/AuthorizationNotPerformed.html
31
- - doc/Corral/ControllerAdditions.html
32
- - doc/Corral/ControllerAdditions/ClassMethods.html
33
- - doc/Corral/Error.html
34
- - doc/Corral/Generators.html
35
- - doc/Corral/Generators/AbilityGenerator.html
36
- - doc/Corral/NullRule.html
37
- - doc/Corral/SubjectRule.html
38
- - doc/_index.html
39
- - doc/class_list.html
40
- - doc/css/common.css
41
- - doc/css/full_list.css
42
- - doc/css/style.css
43
- - doc/doc/_index.html
44
- - doc/doc/class_list.html
45
- - doc/doc/css/common.css
46
- - doc/doc/css/full_list.css
47
- - doc/doc/css/style.css
48
- - doc/doc/file_list.html
49
- - doc/doc/frames.html
50
- - doc/doc/index.html
51
- - doc/doc/js/app.js
52
- - doc/doc/js/full_list.js
53
- - doc/doc/js/jquery.js
54
- - doc/doc/method_list.html
55
- - doc/doc/top-level-namespace.html
56
- - doc/file.README.html
57
- - doc/file_list.html
58
- - doc/frames.html
59
- - doc/index.html
60
- - doc/js/app.js
61
- - doc/js/full_list.js
62
- - doc/js/jquery.js
63
- - doc/method_list.html
64
- - doc/top-level-namespace.html
65
47
  - lib/corral.rb
66
48
  - lib/corral/ability.rb
67
49
  - lib/corral/controller_additions.rb
@@ -71,9 +53,66 @@ files:
71
53
  - lib/generators/corral/ability/USAGE
72
54
  - lib/generators/corral/ability/ability_generator.rb
73
55
  - lib/generators/corral/ability/templates/ability.rb
74
- - spec/corral/ability_spec.rb
75
- - spec/spec_helper.rb
76
- homepage:
56
+ - lib/tasks/corral_tasks.rake
57
+ - test/corral_test.rb
58
+ - test/dummy/Rakefile
59
+ - test/dummy/app/assets/config/manifest.js
60
+ - test/dummy/app/assets/images/.keep
61
+ - test/dummy/app/assets/javascripts/application.js
62
+ - test/dummy/app/assets/javascripts/cable.js
63
+ - test/dummy/app/assets/javascripts/channels/.keep
64
+ - test/dummy/app/assets/stylesheets/application.css
65
+ - test/dummy/app/channels/application_cable/channel.rb
66
+ - test/dummy/app/channels/application_cable/connection.rb
67
+ - test/dummy/app/controllers/application_controller.rb
68
+ - test/dummy/app/controllers/concerns/.keep
69
+ - test/dummy/app/helpers/application_helper.rb
70
+ - test/dummy/app/jobs/application_job.rb
71
+ - test/dummy/app/mailers/application_mailer.rb
72
+ - test/dummy/app/models/application_record.rb
73
+ - test/dummy/app/models/concerns/.keep
74
+ - test/dummy/app/views/layouts/application.html.erb
75
+ - test/dummy/app/views/layouts/mailer.html.erb
76
+ - test/dummy/app/views/layouts/mailer.text.erb
77
+ - test/dummy/bin/bundle
78
+ - test/dummy/bin/rails
79
+ - test/dummy/bin/rake
80
+ - test/dummy/bin/setup
81
+ - test/dummy/bin/update
82
+ - test/dummy/config.ru
83
+ - test/dummy/config/application.rb
84
+ - test/dummy/config/boot.rb
85
+ - test/dummy/config/cable.yml
86
+ - test/dummy/config/database.yml
87
+ - test/dummy/config/environment.rb
88
+ - test/dummy/config/environments/development.rb
89
+ - test/dummy/config/environments/production.rb
90
+ - test/dummy/config/environments/test.rb
91
+ - test/dummy/config/initializers/application_controller_renderer.rb
92
+ - test/dummy/config/initializers/assets.rb
93
+ - test/dummy/config/initializers/backtrace_silencers.rb
94
+ - test/dummy/config/initializers/cookies_serializer.rb
95
+ - test/dummy/config/initializers/filter_parameter_logging.rb
96
+ - test/dummy/config/initializers/inflections.rb
97
+ - test/dummy/config/initializers/mime_types.rb
98
+ - test/dummy/config/initializers/new_framework_defaults.rb
99
+ - test/dummy/config/initializers/session_store.rb
100
+ - test/dummy/config/initializers/wrap_parameters.rb
101
+ - test/dummy/config/locales/en.yml
102
+ - test/dummy/config/puma.rb
103
+ - test/dummy/config/routes.rb
104
+ - test/dummy/config/secrets.yml
105
+ - test/dummy/config/spring.rb
106
+ - test/dummy/lib/assets/.keep
107
+ - test/dummy/log/.keep
108
+ - test/dummy/public/404.html
109
+ - test/dummy/public/422.html
110
+ - test/dummy/public/500.html
111
+ - test/dummy/public/apple-touch-icon-precomposed.png
112
+ - test/dummy/public/apple-touch-icon.png
113
+ - test/dummy/public/favicon.ico
114
+ - test/test_helper.rb
115
+ homepage: https://github.com/Arcaire/corral
77
116
  licenses:
78
117
  - MIT
79
118
  metadata: {}
@@ -96,6 +135,6 @@ rubyforge_project:
96
135
  rubygems_version: 2.5.1
97
136
  signing_key:
98
137
  specification_version: 4
99
- summary: Extremely simple authorization solution.
138
+ summary: Yet another opinionated ACL framework.
100
139
  test_files: []
101
140
  has_rdoc:
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/doc/Ability.html DELETED
@@ -1,257 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Class: Ability
8
-
9
- &mdash; Documentation by YARD 0.9.0
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "Ability";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="class_list.html"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index (A)</a> &raquo;
40
-
41
-
42
- <span class="title">Ability</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <iframe id="search_frame" src="class_list.html"></iframe>
63
-
64
- <div id="content"><h1>Class: Ability
65
-
66
-
67
-
68
- </h1>
69
- <div class="box_info">
70
-
71
- <dl>
72
- <dt>Inherits:</dt>
73
- <dd>
74
- <span class="inheritName">Object</span>
75
-
76
- <ul class="fullTree">
77
- <li>Object</li>
78
-
79
- <li class="next">Ability</li>
80
-
81
- </ul>
82
- <a href="#" class="inheritanceTree">show all</a>
83
-
84
- </dd>
85
- </dl>
86
-
87
-
88
-
89
-
90
-
91
-
92
- <dl>
93
- <dt>Includes:</dt>
94
- <dd><span class='object_link'><a href="Corral/Ability.html" title="Corral::Ability (module)">Corral::Ability</a></span></dd>
95
- </dl>
96
-
97
-
98
-
99
-
100
-
101
-
102
- <dl>
103
- <dt>Defined in:</dt>
104
- <dd>lib/generators/corral/ability/templates/ability.rb</dd>
105
- </dl>
106
-
107
- </div>
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- <h2>
118
- Instance Method Summary
119
- <small><a href="#" class="summary_toggle">collapse</a></small>
120
- </h2>
121
-
122
- <ul class="summary">
123
-
124
- <li class="public ">
125
- <span class="summary_signature">
126
-
127
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(user) &#x21d2; Ability </a>
128
-
129
-
130
-
131
- </span>
132
-
133
-
134
- <span class="note title constructor">constructor</span>
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
- <span class="summary_desc"><div class='inline'>
144
- <p>A new instance of Ability.</p>
145
- </div></span>
146
-
147
- </li>
148
-
149
-
150
- </ul>
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
- <h3 class="inherited">Methods included from <span class='object_link'><a href="Corral/Ability.html" title="Corral::Ability (module)">Corral::Ability</a></span></h3>
163
- <p class="inherited"><span class='object_link'><a href="Corral/Ability.html#allow_anything%21-instance_method" title="Corral::Ability#allow_anything! (method)">#allow_anything!</a></span>, <span class='object_link'><a href="Corral/Ability.html#authorize%21-instance_method" title="Corral::Ability#authorize! (method)">#authorize!</a></span>, <span class='object_link'><a href="Corral/Ability.html#can-instance_method" title="Corral::Ability#can (method)">#can</a></span>, <span class='object_link'><a href="Corral/Ability.html#can%3F-instance_method" title="Corral::Ability#can? (method)">#can?</a></span>, <span class='object_link'><a href="Corral/Ability.html#cannot-instance_method" title="Corral::Ability#cannot (method)">#cannot</a></span>, <span class='object_link'><a href="Corral/Ability.html#cannot%3F-instance_method" title="Corral::Ability#cannot? (method)">#cannot?</a></span></p>
164
- <div id="constructor_details" class="method_details_list">
165
- <h2>Constructor Details</h2>
166
-
167
- <div class="method_details first">
168
- <h3 class="signature first" id="initialize-instance_method">
169
-
170
- #<strong>initialize</strong>(user) &#x21d2; <tt><span class='object_link'><a href="" title="Ability (class)">Ability</a></span></tt>
171
-
172
-
173
-
174
-
175
-
176
- </h3><div class="docstring">
177
- <div class="discussion">
178
-
179
- <p>Returns a new instance of Ability</p>
180
-
181
-
182
- </div>
183
- </div>
184
- <div class="tags">
185
-
186
-
187
- </div><table class="source_code">
188
- <tr>
189
- <td>
190
- <pre class="lines">
191
-
192
-
193
- 4
194
- 5
195
- 6
196
- 7
197
- 8
198
- 9
199
- 10
200
- 11
201
- 12
202
- 13
203
- 14
204
- 15
205
- 16
206
- 17
207
- 18
208
- 19
209
- 20
210
- 21
211
- 22
212
- 23
213
- 24</pre>
214
- </td>
215
- <td>
216
- <pre class="code"><span class="info file"># File 'lib/generators/corral/ability/templates/ability.rb', line 4</span>
217
-
218
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
219
- <span class='comment'># Define abilities for the passed in user here. For example:
220
- </span> <span class='comment'>#
221
- </span> <span class='comment'># user ||= User.new # guest user (not logged in)
222
- </span> <span class='comment'># if user.admin?
223
- </span> <span class='comment'># allow_anything!
224
- </span> <span class='comment'># else
225
- </span> <span class='comment'># can :read, Post
226
- </span> <span class='comment'># end
227
- </span> <span class='comment'>#
228
- </span> <span class='comment'># The first argument to `can` is the action you are giving the user
229
- </span> <span class='comment'># permission to do.
230
- </span> <span class='comment'># If you pass :manage it will apply to every action. Other common actions
231
- </span> <span class='comment'># here are :read, :create, :update and :destroy.
232
- </span> <span class='comment'>#
233
- </span> <span class='comment'># The second argument is the resource the user can perform the action on.
234
- </span> <span class='comment'># Pass a Ruby class of the resource.
235
- </span> <span class='comment'>#
236
- </span> <span class='comment'># can :update, Article
237
- </span> <span class='comment'>#
238
- </span><span class='kw'>end</span></pre>
239
- </td>
240
- </tr>
241
- </table>
242
- </div>
243
-
244
- </div>
245
-
246
-
247
- </div>
248
-
249
- <div id="footer">
250
- Generated on Wed Jul 6 11:31:38 2016 by
251
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
- 0.9.0 (ruby-2.3.1).
253
- </div>
254
-
255
- </div>
256
- </body>
257
- </html>