authentasaurus 0.7.3 → 0.8.3

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 (128) hide show
  1. data/TODO +3 -0
  2. data/app/controllers/areas_controller.rb +1 -1
  3. data/app/controllers/groups_controller.rb +1 -1
  4. data/app/controllers/permissions_controller.rb +1 -1
  5. data/app/controllers/recoveries_controller.rb +1 -1
  6. data/app/controllers/registrations_controller.rb +1 -1
  7. data/app/controllers/sessions_controller.rb +1 -1
  8. data/app/controllers/user_invitations_controller.rb +1 -1
  9. data/app/controllers/users_controller.rb +1 -1
  10. data/app/controllers/validations_controller.rb +1 -1
  11. data/app/models/area.rb +1 -1
  12. data/app/models/group.rb +1 -1
  13. data/app/models/permission.rb +1 -1
  14. data/app/models/recovery.rb +1 -1
  15. data/app/models/session.rb +1 -1
  16. data/app/models/user_invitation.rb +1 -1
  17. data/app/models/validation.rb +1 -1
  18. data/lib/authentasaurus.rb +22 -36
  19. data/lib/authentasaurus/ac/acts_as_overrider.rb +47 -0
  20. data/lib/authentasaurus/ac/controllers/areas_controller.rb +80 -0
  21. data/lib/authentasaurus/ac/controllers/groups_controller.rb +81 -0
  22. data/lib/authentasaurus/ac/controllers/permissions_controller.rb +81 -0
  23. data/lib/authentasaurus/ac/controllers/recoveries_controller.rb +72 -0
  24. data/lib/authentasaurus/ac/controllers/registrations_controller.rb +45 -0
  25. data/lib/authentasaurus/ac/controllers/sessions_controller.rb +58 -0
  26. data/lib/authentasaurus/ac/controllers/user_invitations_controller.rb +50 -0
  27. data/lib/authentasaurus/ac/controllers/users_controller.rb +80 -0
  28. data/lib/authentasaurus/ac/controllers/validations_controller.rb +53 -0
  29. data/lib/authentasaurus/ac/routing.rb +90 -0
  30. data/lib/authentasaurus/ar/acts_as_authenticatable.rb +113 -0
  31. data/lib/authentasaurus/ar/acts_as_authenticatable_validatable.rb +38 -0
  32. data/lib/authentasaurus/ar/acts_as_overrider.rb +51 -0
  33. data/lib/authentasaurus/ar/authenticatable.rb +66 -0
  34. data/lib/authentasaurus/ar/migrations.rb +173 -0
  35. data/lib/authentasaurus/{models → ar/models}/recovery.rb +3 -3
  36. data/lib/authentasaurus/{models → ar/models}/session.rb +1 -1
  37. data/lib/authentasaurus/{models → ar/models}/user_invitation.rb +1 -1
  38. data/lib/authentasaurus/{models → ar/models}/validation.rb +1 -1
  39. data/lib/authentasaurus/arel/acts_as_authenticatable.rb +72 -0
  40. data/lib/authentasaurus/arel/authenticatable.rb +25 -0
  41. data/lib/authentasaurus/authorization.rb +341 -0
  42. data/lib/authentasaurus/railtie.rb +4 -4
  43. data/lib/generators/authentasaurus/install/templates/initializer.rb +1 -1
  44. data/rdoc/apple-touch-icon.png +0 -0
  45. data/rdoc/classes/Authentasaurus.html +65 -0
  46. data/rdoc/classes/Authentasaurus/Ac.html +72 -0
  47. data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider.html +104 -0
  48. data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider/ClassMethods.html +397 -0
  49. data/rdoc/classes/Authentasaurus/Ac/Routing.html +61 -0
  50. data/rdoc/classes/Authentasaurus/Ac/Routing/InstanceMethods.html +390 -0
  51. data/rdoc/classes/Authentasaurus/Ar.html +77 -0
  52. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable.html +107 -0
  53. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/ClassMethods.html +168 -0
  54. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/InstanceMethods.html +357 -0
  55. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable.html +109 -0
  56. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/ClassMethods.html +113 -0
  57. data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/InstanceMethods.html +54 -0
  58. data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider.html +104 -0
  59. data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider/ClassMethods.html +320 -0
  60. data/rdoc/classes/Authentasaurus/Ar/Authenticatable.html +104 -0
  61. data/rdoc/classes/Authentasaurus/Ar/Authenticatable/ClassMethods.html +182 -0
  62. data/rdoc/classes/Authentasaurus/Ar/Migrations.html +63 -0
  63. data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns.html +68 -0
  64. data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns/InstanceMethods.html +106 -0
  65. data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables.html +68 -0
  66. data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables/InstanceMethods.html +703 -0
  67. data/rdoc/classes/Authentasaurus/Arel.html +65 -0
  68. data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable.html +107 -0
  69. data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/ClassMethods.html +139 -0
  70. data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/InstanceMethods.html +113 -0
  71. data/rdoc/classes/Authentasaurus/Arel/Authenticatable.html +105 -0
  72. data/rdoc/classes/Authentasaurus/Arel/Authenticatable/ClassMethods.html +119 -0
  73. data/rdoc/classes/Authentasaurus/Authorization.html +230 -0
  74. data/rdoc/classes/Authentasaurus/Authorization/ActionController.html +63 -0
  75. data/rdoc/classes/Authentasaurus/Authorization/ActionController/ClassMethods.html +263 -0
  76. data/rdoc/classes/Authentasaurus/Authorization/ActionController/InstanceMethods.html +54 -0
  77. data/rdoc/classes/Authentasaurus/Authorization/ActionView.html +54 -0
  78. data/rdoc/classes/Authentasaurus/Authorization/CommonInstanceMethods.html +240 -0
  79. data/rdoc/created.rid +1 -0
  80. data/rdoc/css/main.css +278 -0
  81. data/rdoc/css/panel.css +383 -0
  82. data/rdoc/css/reset.css +53 -0
  83. data/rdoc/favicon.ico +0 -0
  84. data/rdoc/files/README_rdoc.html +366 -0
  85. data/rdoc/files/TODO.html +64 -0
  86. data/rdoc/files/lib/authentasaurus/ac/acts_as_overrider_rb.html +52 -0
  87. data/rdoc/files/lib/authentasaurus/ac/routing_rb.html +60 -0
  88. data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_rb.html +52 -0
  89. data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_validatable_rb.html +52 -0
  90. data/rdoc/files/lib/authentasaurus/ar/acts_as_overrider_rb.html +52 -0
  91. data/rdoc/files/lib/authentasaurus/ar/authenticatable_rb.html +52 -0
  92. data/rdoc/files/lib/authentasaurus/ar/migrations_rb.html +52 -0
  93. data/rdoc/files/lib/authentasaurus/arel/acts_as_authenticatable_rb.html +52 -0
  94. data/rdoc/files/lib/authentasaurus/arel/authenticatable_rb.html +72 -0
  95. data/rdoc/files/lib/authentasaurus/authorization_rb.html +208 -0
  96. data/rdoc/i/arrows.png +0 -0
  97. data/rdoc/i/results_bg.png +0 -0
  98. data/rdoc/i/tree_bg.png +0 -0
  99. data/rdoc/index.html +15 -0
  100. data/rdoc/js/jquery-1.3.2.min.js +19 -0
  101. data/rdoc/js/jquery-effect.js +593 -0
  102. data/rdoc/js/main.js +22 -0
  103. data/rdoc/js/searchdoc.js +628 -0
  104. data/rdoc/panel/index.html +71 -0
  105. data/rdoc/panel/search_index.js +1 -0
  106. data/rdoc/panel/tree.js +1 -0
  107. metadata +92 -44
  108. data/lib/action_controller/authorization.rb +0 -215
  109. data/lib/action_view/authorization.rb +0 -52
  110. data/lib/active_record/acts_as_authenticatable.rb +0 -111
  111. data/lib/active_record/acts_as_authenticatable_validatable.rb +0 -36
  112. data/lib/active_record/authenticatable.rb +0 -64
  113. data/lib/active_resource/acts_as_authenticatable.rb +0 -70
  114. data/lib/active_resource/authenticatable.rb +0 -24
  115. data/lib/authentasaurus/areas_controller.rb +0 -78
  116. data/lib/authentasaurus/groups_controller.rb +0 -79
  117. data/lib/authentasaurus/models/area.rb +0 -21
  118. data/lib/authentasaurus/models/group.rb +0 -19
  119. data/lib/authentasaurus/models/permission.rb +0 -24
  120. data/lib/authentasaurus/permissions_controller.rb +0 -79
  121. data/lib/authentasaurus/recoveries_controller.rb +0 -70
  122. data/lib/authentasaurus/registrations_controller.rb +0 -43
  123. data/lib/authentasaurus/sessions_controller.rb +0 -56
  124. data/lib/authentasaurus/user_invitations_controller.rb +0 -48
  125. data/lib/authentasaurus/users_controller.rb +0 -78
  126. data/lib/authentasaurus/validations_controller.rb +0 -51
  127. data/lib/helpers/migrations.rb +0 -171
  128. data/lib/helpers/routing.rb +0 -87
@@ -0,0 +1,383 @@
1
+ /* Panel (begin) */
2
+ .panel
3
+ {
4
+ position: absolute;
5
+ width: 100%;
6
+ height: 100%;
7
+ top: 0;
8
+ left: 0;
9
+ background: #FFF;
10
+ z-index: 2;
11
+ font-family: "Helvetica Neue", "Arial", sans-serif;
12
+ //zoom: 1;
13
+ }
14
+
15
+ .panel_tree .results,
16
+ .panel_results .tree
17
+ {
18
+ display: none;
19
+ }
20
+
21
+ /* Header with search box (begin) */
22
+ .panel .header
23
+ {
24
+ width: 100%;
25
+ height: 29px;
26
+ border-bottom: 1px solid #666;
27
+ position: relative;
28
+ left: 0; top: 0;
29
+ background: #e8e8e8;
30
+ }
31
+
32
+ .panel .header div
33
+ {
34
+ margin: 0 7px;
35
+ }
36
+ .panel .header table
37
+ {
38
+ height: 29px;
39
+ width: 100%;
40
+ }
41
+
42
+ .panel .header table td
43
+ {
44
+ vertical-align: middle;
45
+ text-align: middle;
46
+ }
47
+
48
+ .panel .header label
49
+ {
50
+ position: absolute;
51
+ font-size: 12px;
52
+ line-height: 29px;
53
+ margin-left: 3px;
54
+ color: #999;
55
+ cursor: text;
56
+ }
57
+
58
+ .panel .header table input
59
+ {
60
+ width: 100%;
61
+ box-sizing: border-box;
62
+ -moz-box-sizing: border-box;
63
+ -webkit-box-sizing: border-box;
64
+ display: inline-block;
65
+ -webkit-appearance: searchfield;
66
+ height: 22px;
67
+ //height: auto;
68
+ }
69
+
70
+ /* Header with search box (end) */
71
+
72
+
73
+ /* Results (begin) */
74
+ .panel .result
75
+ {
76
+ position: absolute;
77
+ top: 30px;
78
+ bottom: 0;
79
+ left: 0;
80
+ width: 100%;
81
+ //height: expression((this.parentNode.offsetHeight - 31));
82
+ overflow-y: scroll;
83
+ overflow-x: hidden;
84
+ -overflow-y: hidden;
85
+ background: #EDF3FE url(../i/results_bg.png);
86
+ z-index: 2;
87
+ //zoom:1;
88
+ }
89
+
90
+ .panel .result ul
91
+ {
92
+ font-size: 0.8em;
93
+ width: 100%;
94
+ background: #EDF3FE url(../i/results_bg.png);
95
+ //zoom:1;
96
+ }
97
+
98
+ .panel .result ul li
99
+ {
100
+ height: 46px;
101
+ -height: 50px;
102
+ //display: inline;
103
+ //width: 100%;
104
+ //zoom: 1;
105
+ overflow: hidden;
106
+ padding: 4px 10px 0 10px;
107
+ cursor: pointer;
108
+ }
109
+
110
+ .panel .result ul li h1
111
+ {
112
+ font-size: 13px;
113
+ font-weight: normal;
114
+ color: #333;
115
+ margin-bottom: 2px;
116
+ white-space: nowrap;
117
+ }
118
+
119
+ .panel .result ul li p
120
+ {
121
+ font-size: 11px;
122
+ color: #333;
123
+ margin-bottom: 2px;
124
+ white-space: nowrap;
125
+ }
126
+
127
+ .panel .result ul li h1 i,
128
+ .panel .result ul li p.snippet
129
+ {
130
+ color: #999;
131
+ }
132
+
133
+ .panel .result ul li b
134
+ {
135
+ color: #000;
136
+ }
137
+
138
+ .panel .result ul li.current
139
+ {
140
+ background: #3875D7;
141
+ }
142
+
143
+ .panel .result ul li.current h1,
144
+ .panel .result ul li.current p
145
+ {
146
+ color: #DDD;
147
+ }
148
+
149
+ .panel .result ul li.current h1 i,
150
+ .panel .result ul li.current p.snippet
151
+ {
152
+ color: #AAA;
153
+ }
154
+
155
+ .panel .result ul li.current b
156
+ {
157
+ color: #FFF;
158
+ }
159
+
160
+
161
+ .panel .result ul li:hover,
162
+ .panel .result ul li.selected
163
+ {
164
+ background: #d0d0d0;
165
+ }
166
+
167
+ .panel .result ul li.current:hover
168
+ {
169
+ background: #2965C0;
170
+ }
171
+
172
+ .panel .result ul li .badge
173
+ {
174
+ margin-right: 0.4em;
175
+ margin-left: -0.2em;
176
+ padding: 0 0.2em;
177
+ color: #000;
178
+ }
179
+
180
+ .panel .result ul li .badge_1
181
+ {
182
+ background: #ACDBF4;
183
+ }
184
+
185
+ .panel .result ul li.current .badge_1
186
+ {
187
+ background: #97BFD7;
188
+ }
189
+
190
+ .panel .result ul li .badge_2
191
+ {
192
+ background: #ACF3C3;
193
+ }
194
+
195
+ .panel .result ul li.current .badge_2
196
+ {
197
+ background: #98D7AC;
198
+ }
199
+
200
+ .panel .result ul li .badge_3
201
+ {
202
+ background: #E0F3AC;
203
+ }
204
+
205
+ .panel .result ul li.current .badge_3
206
+ {
207
+ background: #C4D798;
208
+ }
209
+
210
+ .panel .result ul li .badge_4
211
+ {
212
+ background: #D7CA98;
213
+ }
214
+
215
+ .panel .result ul li.current .badge_4
216
+ {
217
+ background: #A6B0AC;
218
+ }
219
+
220
+ .panel .result ul li .badge_5
221
+ {
222
+ background: #F3C8AC;
223
+ }
224
+
225
+ .panel .result ul li.current .badge_5
226
+ {
227
+ background: #D7B198;
228
+ }
229
+
230
+ .panel .result ul li .badge_6
231
+ {
232
+ background: #F3ACC3;
233
+ }
234
+
235
+ .panel .result ul li.current .badge_6
236
+ {
237
+ background: #D798AB;
238
+ }
239
+
240
+ /* Results (end) */
241
+
242
+ /* Tree (begin) */ /**/
243
+ .panel .tree
244
+ {
245
+ position: absolute;
246
+ top: 30px;
247
+ bottom: 0;
248
+ left: 0;
249
+ width: 100%;
250
+ //zoom: 1;
251
+ //height: expression((this.parentNode.offsetHeight - 31));
252
+ overflow-y: scroll;
253
+ overflow-x: hidden;
254
+ -overflow-y: hidden;
255
+ background: #EDF3FE url(../i/tree_bg.png);
256
+ z-index: 30;
257
+ }
258
+
259
+ .panel .tree ul
260
+ {
261
+ background: #EDF3FE url(../i/tree_bg.png);
262
+ }
263
+
264
+ .panel .tree li
265
+ {
266
+ cursor: pointer;
267
+ overflow: hidden;
268
+ //height: 23px;
269
+ //display: inline;
270
+ //zoom: 1;
271
+ //width: 100%;
272
+ }
273
+
274
+
275
+ .panel .tree li .content
276
+ {
277
+ padding-left: 18px;
278
+ padding-top: 5px;
279
+ height: 18px;
280
+ overflow: hidden;
281
+ position: relative;
282
+ }
283
+
284
+ .panel .tree li .icon
285
+ {
286
+ width: 10px;
287
+ height: 9px;
288
+ background: url(../i/arrows.png);
289
+ background-position: 0 -9px;
290
+ position: absolute;
291
+ left: 1px;
292
+ top: 8px;
293
+ cursor: default;
294
+ }
295
+
296
+ .panel .tree li.closed .icon
297
+ {
298
+ background-position: 0 0;
299
+ }
300
+
301
+ .panel .tree ul li h1
302
+ {
303
+ font-size: 13px;
304
+ font-weight: normal;
305
+ color: #000;
306
+ margin-bottom: 2px;
307
+ white-space: nowrap;
308
+ }
309
+
310
+ .panel .tree ul li p
311
+ {
312
+ font-size: 11px;
313
+ color: #666;
314
+ margin-bottom: 2px;
315
+ white-space: nowrap;
316
+ }
317
+
318
+ .panel .tree ul li h1 i
319
+ {
320
+ color: #999;
321
+ font-style: normal;
322
+ }
323
+
324
+ .panel .tree ul li.empty
325
+ {
326
+ cursor: text;
327
+ }
328
+
329
+ .panel .tree ul li.empty h1,
330
+ .panel .tree ul li.empty p
331
+ {
332
+ color: #666;
333
+ font-style: italic;
334
+ }
335
+
336
+ .panel .tree ul li.current
337
+ {
338
+ background: #3875D7;
339
+ }
340
+
341
+ .panel .tree ul li.current .icon
342
+ {
343
+ background-position: -10px -9px;
344
+ }
345
+
346
+ .panel .tree ul li.current.closed .icon
347
+ {
348
+ background-position: -10px 0;
349
+ }
350
+
351
+ .panel .tree ul li.current h1
352
+ {
353
+ color: #FFF;
354
+ }
355
+
356
+ .panel .tree ul li.current p
357
+ {
358
+ color: #CCC;
359
+ }
360
+
361
+ .panel .tree ul li.current.empty h1,
362
+ .panel .tree ul li.current.empty p
363
+ {
364
+ color: #999;
365
+ }
366
+
367
+ .panel .tree ul li:hover
368
+ {
369
+ background: #d0d0d0;
370
+ }
371
+
372
+ .panel .tree ul li.current:hover
373
+ {
374
+ background: #2965C0;
375
+ }
376
+
377
+ .panel .tree .stopper
378
+ {
379
+ display: none;
380
+ }
381
+ /* Tree (end) */ /**/
382
+
383
+ /* Panel (end) */
@@ -0,0 +1,53 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/ */
2
+ /* v1.0 | 20080212 */
3
+
4
+ html, body, div, span, applet, object, iframe,
5
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
6
+ a, abbr, acronym, address, big, cite, code,
7
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
8
+ small, strike, strong, sub, sup, tt, var,
9
+ b, u, i, center,
10
+ dl, dt, dd, ol, ul, li,
11
+ fieldset, form, label, legend,
12
+ table, caption, tbody, tfoot, thead, tr, th, td {
13
+ margin: 0;
14
+ padding: 0;
15
+ border: 0;
16
+ outline: 0;
17
+ font-size: 100%;
18
+ vertical-align: baseline;
19
+ background: transparent;
20
+ }
21
+ body {
22
+ line-height: 1;
23
+ }
24
+ ol, ul {
25
+ list-style: none;
26
+ }
27
+ blockquote, q {
28
+ quotes: none;
29
+ }
30
+ blockquote:before, blockquote:after,
31
+ q:before, q:after {
32
+ content: '';
33
+ content: none;
34
+ }
35
+
36
+ /* remember to define focus styles! */
37
+ :focus {
38
+ outline: 0;
39
+ }
40
+
41
+ /* remember to highlight inserts somehow! */
42
+ ins {
43
+ text-decoration: none;
44
+ }
45
+ del {
46
+ text-decoration: line-through;
47
+ }
48
+
49
+ /* tables still need 'cellspacing="0"' in the markup */
50
+ table {
51
+ border-collapse: collapse;
52
+ border-spacing: 0;
53
+ }
data/rdoc/favicon.ico ADDED
Binary file
@@ -0,0 +1,366 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title>README.rdoc</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
10
+ <script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
13
+ </head>
14
+
15
+ <body>
16
+ <div class="banner">
17
+ <h1>
18
+ README.rdoc
19
+ </h1>
20
+ <ul class="files">
21
+ <li>README.rdoc</li>
22
+ <li>Last modified: Tue Sep 28 23:34:58 +0300 2010</li>
23
+ </ul>
24
+ </div>
25
+
26
+ <div id="bodyContent">
27
+ <div id="content">
28
+
29
+ <div class="description">
30
+ <h2><a href="../classes/Authentasaurus.html">Authentasaurus</a></h2>
31
+ <p>
32
+ <a href="../classes/Authentasaurus.html">Authentasaurus</a> is a dynamic
33
+ group/permission based authentication and authorization engine plugin, its
34
+ simple to use and easy to setup.
35
+ </p>
36
+ <p>
37
+ Most helpers are inspired by Devise.
38
+ </p>
39
+ <h2>Installation</h2>
40
+ <p>
41
+ To start using <a href="../classes/Authentasaurus.html">Authentasaurus</a>
42
+ follow these simple steps :
43
+ </p>
44
+ <ol>
45
+ <li>install authentasaurus gem by running the following command
46
+
47
+ <pre>
48
+ gem install authentasaurus
49
+ </pre>
50
+ </li>
51
+ <li>add authentasaurus to your application environment; in
52
+ config/environment.rb
53
+
54
+ <pre>
55
+ config.gem &quot;authentasaurus&quot;
56
+ </pre>
57
+ </li>
58
+ <li>generate authentasaurus configuration and tasks in your application
59
+
60
+ <pre>
61
+ script/generate authentasaurus
62
+ </pre>
63
+ </li>
64
+ <li>setup your migrations using the migration helpers
65
+
66
+ <pre>
67
+ in the migration up method just use
68
+ authentasaurus_tables
69
+ in the migration down method
70
+ authentasaurus_drop_tables
71
+ </pre>
72
+ </li>
73
+ <li>migrate your database and setup your default data
74
+
75
+ <pre>
76
+ rake authentasaurus:setup_defaults
77
+ </pre>
78
+ </li>
79
+ <li>add your routes
80
+
81
+ <pre>
82
+ map.authentasaurus_routes :authorizable, :validatable, :invitable
83
+ </pre>
84
+ </li>
85
+ </ol>
86
+ <p>
87
+ that&#8217;s the most basic and quick setup, you can now test your
88
+ application by running script/server in your project root directory and
89
+ going to <a
90
+ href="http://localhost:3000/sessions/sign-in">localhost:3000/sessions/sign-in</a>
91
+ </p>
92
+ <p>
93
+ <a href="../classes/Authentasaurus.html">Authentasaurus</a> is modular, you
94
+ can install modules as you need them (the previous setup contains all
95
+ modules), refer to the documentation for more information.
96
+ </p>
97
+ <h2>Under the hood</h2>
98
+ <p>
99
+ <a href="../classes/Authentasaurus.html">Authentasaurus</a> takes advantage
100
+ of rails&#8217; before_filter; it checks for the appropriate permissions
101
+ before every action that requires a login, a write or read permission.
102
+ </p>
103
+ <p>
104
+ At login, authentasaurus would load the user&#8217;s group permissions into
105
+ a session hash and then attempts to read that hash when it meets a require
106
+ helper on a controller.
107
+ </p>
108
+ <h3><a href="../classes/Authentasaurus.html">Authentasaurus</a> uses the following terms:</h3>
109
+ <table>
110
+ <tr><td valign="top"><tt>Area</tt>:</td><td>An area is in plain english the controller&#8217;s name, so if you have a
111
+ controller named &#8220;PostsController&#8221;, the corresponding area name
112
+ would be &#8220;posts&#8221; (just as you type it in the generator command)
113
+
114
+ </td></tr>
115
+ <tr><td valign="top"><tt>Group</tt>:</td><td>A group is as the name suggests, each group contains a number of users, and
116
+ each user inherits the group permissions, also note that at any given time,
117
+ the user can only belong to one group
118
+
119
+ </td></tr>
120
+ <tr><td valign="top"><tt>Permission</tt>:</td><td>A permission is one of two, either read or write, but take care, read or
121
+ write is only a naming, and though it doesn&#8217;t make sense, you could
122
+ treat a read permission as a write permission and vice versa, but as i said
123
+ it makes no sense !
124
+
125
+ </td></tr>
126
+ </table>
127
+ <h2>Generators</h2>
128
+ <p>
129
+ There are two generators in <a
130
+ href="../classes/Authentasaurus.html">Authentasaurus</a>, the default
131
+ generator
132
+ </p>
133
+ <pre>
134
+ authentasaurus
135
+ </pre>
136
+ <p>
137
+ and the views generator
138
+ </p>
139
+ <pre>
140
+ authentasaurus_views
141
+ </pre>
142
+ <p>
143
+ The default generator generates configurations and tasks needed by <a
144
+ href="../classes/Authentasaurus.html">Authentasaurus</a>, while the views
145
+ generator generates the views used by <a
146
+ href="../classes/Authentasaurus.html">Authentasaurus</a> in your
147
+ application, this is useful for customizing authentasaurus and is totally
148
+ optional.
149
+ </p>
150
+ <p>
151
+ <a href="../classes/Authentasaurus.html">Authentasaurus</a> views generator
152
+ takes the name of the user controller, by default it&#8217;s users
153
+ </p>
154
+ <pre>
155
+ script/generate authentasaurus_views users
156
+ </pre>
157
+ <p>
158
+ You can also use namespaces:
159
+ </p>
160
+ <pre>
161
+ script/generate authentasaurus_views admin/users
162
+ </pre>
163
+ <p>
164
+ Also you can use some options with the <a
165
+ href="../classes/Authentasaurus.html">Authentasaurus</a> views generator to
166
+ add the modules you need:
167
+ </p>
168
+ <table>
169
+ <tr><td valign="top"><tt>--authorizable</tt>:</td><td>generates the views necessary for authorization (groups, areas and
170
+ permissions)
171
+
172
+ </td></tr>
173
+ <tr><td valign="top"><tt>--invitable</tt>:</td><td>generates the views necessary for invitable users
174
+
175
+ </td></tr>
176
+ <tr><td valign="top"><tt>--validatable</tt>:</td><td>generates the views necessary for validatable users
177
+
178
+ </td></tr>
179
+ </table>
180
+ <p>
181
+ You can use a combination of those options like the following example:
182
+ </p>
183
+ <pre>
184
+ script/generate authentasaurus_views users --authorizable --invitable --validatable
185
+ </pre>
186
+ <h2>Controller Authorization Helpers</h2>
187
+ <p>
188
+ There are four main authorization helpers in <a
189
+ href="../classes/Authentasaurus.html">Authentasaurus</a> for use on
190
+ controllers:
191
+ </p>
192
+ <table>
193
+ <tr><td valign="top"><tt>require_login</tt>:</td><td>requires the user to login before accessing the actions specified
194
+
195
+ <p>
196
+ <b>ex:</b> Tells <a
197
+ href="../classes/Authentasaurus.html">Authentasaurus</a> that the action
198
+ destroy requires login and that <a
199
+ href="../classes/Authentasaurus.html">Authentasaurus</a> shouldn&#8217;t
200
+ store the request in the session (typically for logout actions)
201
+ </p>
202
+ <ul>
203
+ <li>:skip_request - skips saving the original request (to redirect to after
204
+ login)
205
+
206
+ </li>
207
+ <li>:user_model - if defined, authentasaurus will use that model instead of the
208
+ default &#8220;User&#8220;
209
+
210
+ </li>
211
+ <li>:if - specifies a method, proc or string to call to determine if the
212
+ authorization should occur
213
+
214
+ </li>
215
+ <li>:unless - specifies a method, proc or string to call to determine if the
216
+ authorization should not occur
217
+
218
+ <p>
219
+ require_login :destroy, :skip_request => true
220
+ </p>
221
+ </li>
222
+ </ul>
223
+ </td></tr>
224
+ <tr><td valign="top"><tt>require_write</tt>:</td><td>requires the user to have a write permission to that area to access the
225
+ actions specified
226
+
227
+ <p>
228
+ <b>ex:</b> Tells <a
229
+ href="../classes/Authentasaurus.html">Authentasaurus</a> that the actions
230
+ create_user and delete_user requires login and write permission.
231
+ </p>
232
+ <ul>
233
+ <li>:skip_request - skips saving the original request (to redirect to after
234
+ login)
235
+
236
+ </li>
237
+ <li>:user_model - if defined, authentasaurus will use that model instead of the
238
+ default &#8220;User&#8220;
239
+
240
+ </li>
241
+ <li>:if - specifies a method, proc or string to call to determine if the
242
+ authorization should occur
243
+
244
+ </li>
245
+ <li>:unless - specifies a method, proc or string to call to determine if the
246
+ authorization should not occur
247
+
248
+ <p>
249
+ require_write :create_user, :delete_user
250
+ </p>
251
+ </li>
252
+ </ul>
253
+ </td></tr>
254
+ <tr><td valign="top"><tt>require_read</tt>:</td><td>requires the user to have a read permission to that area to access the
255
+ actions specified
256
+
257
+ <p>
258
+ <b>ex:</b> Tells <a
259
+ href="../classes/Authentasaurus.html">Authentasaurus</a> that the action
260
+ show_user requires login and read permission.
261
+ </p>
262
+ <ul>
263
+ <li>:skip_request - skips saving the original request (to redirect to after
264
+ login)
265
+
266
+ </li>
267
+ <li>:user_model - if defined, authentasaurus will use that model instead of the
268
+ default &#8220;User&#8220;
269
+
270
+ </li>
271
+ <li>:if - specifies a method, proc or string to call to determine if the
272
+ authorization should occur
273
+
274
+ </li>
275
+ <li>:unless - specifies a method, proc or string to call to determine if the
276
+ authorization should not occur
277
+
278
+ <p>
279
+ require_read :show_user, :if api_key.nil?
280
+ </p>
281
+ </li>
282
+ </ul>
283
+ </td></tr>
284
+ </table>
285
+ <p>
286
+ You can use any of those class methods on you controllers to restrict
287
+ access levels like so:
288
+ </p>
289
+ <pre>
290
+ class PostsController &lt; ApplicationController
291
+ require_login :index
292
+ require_read :show
293
+ require_write :new, :create, :edit, :update, :destroy
294
+
295
+ def index
296
+ # your code here
297
+ end
298
+
299
+ def show
300
+ # your code here
301
+ end
302
+
303
+ def new
304
+ # your code here
305
+ end
306
+
307
+ def create
308
+ # your code here
309
+ end
310
+
311
+ def edit
312
+ # your code here
313
+ end
314
+
315
+ def update
316
+ # your code here
317
+ end
318
+
319
+ def destroy
320
+ # your code here
321
+ end
322
+ end
323
+ </pre>
324
+ <p>
325
+ In addition there is also the has? helper which is available in both
326
+ Controllers and Views
327
+ </p>
328
+ <table>
329
+ <tr><td valign="top"><tt>has?(permission, area=nil)</tt>:</td><td>Checks if the current user has the appropriate permissions for the area
330
+ specified
331
+
332
+ <p>
333
+ <b>ex</b>: has?(:write) or has?(:read, :users)
334
+ </p>
335
+ </td></tr>
336
+ </table>
337
+ <p>
338
+ Copyright &#169; 2010 Mash, Ltd., released under the MIT license
339
+ </p>
340
+
341
+ </div>
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+ </div>
364
+ </div>
365
+ </body>
366
+ </html>