authentasaurus 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +173 -0
  3. data/TODO +4 -0
  4. data/app/controllers/areas_controller.rb +4 -0
  5. data/app/controllers/groups_controller.rb +4 -0
  6. data/app/controllers/permissions_controller.rb +4 -0
  7. data/app/controllers/recoveries_controller.rb +2 -0
  8. data/app/controllers/registrations_controller.rb +2 -0
  9. data/app/controllers/sessions_controller.rb +2 -0
  10. data/app/controllers/user_invitations_controller.rb +4 -0
  11. data/app/controllers/users_controller.rb +4 -0
  12. data/app/controllers/validations_controller.rb +2 -0
  13. data/app/models/area.rb +2 -0
  14. data/app/models/authentasaurus_emailer.rb +2 -0
  15. data/app/models/group.rb +2 -0
  16. data/app/models/permission.rb +2 -0
  17. data/app/models/recovery.rb +2 -0
  18. data/app/models/session.rb +2 -0
  19. data/app/models/user.rb +3 -0
  20. data/app/models/user_invitation.rb +2 -0
  21. data/app/models/user_sync.rb +3 -0
  22. data/app/models/validation.rb +2 -0
  23. data/app/views/areas/edit.html.erb +7 -0
  24. data/app/views/areas/index.html.erb +11 -0
  25. data/app/views/areas/new.html.erb +7 -0
  26. data/app/views/areas/show.html.erb +7 -0
  27. data/app/views/authentasaurus_emailer/invitation_mail.html.erb +4 -0
  28. data/app/views/authentasaurus_emailer/recovery_mail.html.erb +7 -0
  29. data/app/views/authentasaurus_emailer/validation_mail.html.erb +6 -0
  30. data/app/views/groups/edit.html.erb +7 -0
  31. data/app/views/groups/index.html.erb +11 -0
  32. data/app/views/groups/new.html.erb +7 -0
  33. data/app/views/groups/show.html.erb +7 -0
  34. data/app/views/permissions/edit.html.erb +19 -0
  35. data/app/views/permissions/index.html.erb +17 -0
  36. data/app/views/permissions/new.html.erb +19 -0
  37. data/app/views/permissions/show.html.erb +7 -0
  38. data/app/views/recoveries/edit.html.erb +24 -0
  39. data/app/views/recoveries/new.html.erb +15 -0
  40. data/app/views/registrations/new.html.erb +21 -0
  41. data/app/views/sessions/new.html.erb +41 -0
  42. data/app/views/sessions/no_access.html.erb +1 -0
  43. data/app/views/user_invitations/index.html.erb +14 -0
  44. data/app/views/user_invitations/new.html.erb +9 -0
  45. data/app/views/users/edit.html.erb +27 -0
  46. data/app/views/users/index.html.erb +19 -0
  47. data/app/views/users/new.html.erb +27 -0
  48. data/app/views/users/show.html.erb +11 -0
  49. data/app/views/validations/activate.html.erb +6 -0
  50. data/app/views/validations/resend_validation_email.html.erb +6 -0
  51. data/config/locales/en.yml +34 -0
  52. data/generators/authentasaurus/USAGE +2 -0
  53. data/generators/authentasaurus/authentasaurus_generator.rb +9 -0
  54. data/generators/authentasaurus/templates/authentasaurus_tasks.rake +48 -0
  55. data/generators/authentasaurus/templates/defaults.yml +51 -0
  56. data/generators/authentasaurus/templates/initializer.rb +3 -0
  57. data/generators/authentasaurus_views/USAGE +12 -0
  58. data/generators/authentasaurus_views/authentasaurus_views_generator.rb +87 -0
  59. data/generators/authentasaurus_views/templates/views/areas/edit.html.erb +7 -0
  60. data/generators/authentasaurus_views/templates/views/areas/index.html.erb +11 -0
  61. data/generators/authentasaurus_views/templates/views/areas/new.html.erb +7 -0
  62. data/generators/authentasaurus_views/templates/views/areas/show.html.erb +7 -0
  63. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/invitation_mail.html.erb +4 -0
  64. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/recovery_mail.html.erb +7 -0
  65. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/validation_mail.html.erb +6 -0
  66. data/generators/authentasaurus_views/templates/views/groups/edit.html.erb +7 -0
  67. data/generators/authentasaurus_views/templates/views/groups/index.html.erb +11 -0
  68. data/generators/authentasaurus_views/templates/views/groups/new.html.erb +7 -0
  69. data/generators/authentasaurus_views/templates/views/groups/show.html.erb +7 -0
  70. data/generators/authentasaurus_views/templates/views/permissions/edit.html.erb +19 -0
  71. data/generators/authentasaurus_views/templates/views/permissions/index.html.erb +17 -0
  72. data/generators/authentasaurus_views/templates/views/permissions/new.html.erb +19 -0
  73. data/generators/authentasaurus_views/templates/views/permissions/show.html.erb +7 -0
  74. data/generators/authentasaurus_views/templates/views/recoveries/edit.html.erb +24 -0
  75. data/generators/authentasaurus_views/templates/views/recoveries/new.html.erb +15 -0
  76. data/generators/authentasaurus_views/templates/views/registrations/new.html.erb +21 -0
  77. data/generators/authentasaurus_views/templates/views/sessions/new.html.erb +41 -0
  78. data/generators/authentasaurus_views/templates/views/sessions/no_access.html.erb +1 -0
  79. data/generators/authentasaurus_views/templates/views/user_invitations/index.html.erb +14 -0
  80. data/generators/authentasaurus_views/templates/views/user_invitations/new.html.erb +9 -0
  81. data/generators/authentasaurus_views/templates/views/users/edit.html.erb +27 -0
  82. data/generators/authentasaurus_views/templates/views/users/index.html.erb +19 -0
  83. data/generators/authentasaurus_views/templates/views/users/new.html.erb +27 -0
  84. data/generators/authentasaurus_views/templates/views/users/show.html.erb +11 -0
  85. data/generators/authentasaurus_views/templates/views/validations/activate.html.erb +6 -0
  86. data/generators/authentasaurus_views/templates/views/validations/resend_validation_email.html.erb +6 -0
  87. data/lib/action_controller/authorization.rb +215 -0
  88. data/lib/action_view/authorization.rb +123 -0
  89. data/lib/active_record/acts_as_authenticatable.rb +80 -0
  90. data/lib/active_record/acts_as_authenticatable_validatable.rb +32 -0
  91. data/lib/active_record/authenticatable.rb +56 -0
  92. data/lib/active_resource/acts_as_authenticatable.rb +42 -0
  93. data/lib/active_resource/authenticatable.rb +22 -0
  94. data/lib/authentasaurus.rb +21 -0
  95. data/lib/authentasaurus/areas_controller.rb +71 -0
  96. data/lib/authentasaurus/authentasaurus_controller.rb +2 -0
  97. data/lib/authentasaurus/groups_controller.rb +73 -0
  98. data/lib/authentasaurus/models/area.rb +8 -0
  99. data/lib/authentasaurus/models/authentasaurus_emailer.rb +31 -0
  100. data/lib/authentasaurus/models/group.rb +8 -0
  101. data/lib/authentasaurus/models/permission.rb +9 -0
  102. data/lib/authentasaurus/models/recovery.rb +23 -0
  103. data/lib/authentasaurus/models/session.rb +63 -0
  104. data/lib/authentasaurus/models/user_invitation.rb +21 -0
  105. data/lib/authentasaurus/models/validation.rb +18 -0
  106. data/lib/authentasaurus/permissions_controller.rb +71 -0
  107. data/lib/authentasaurus/recoveries_controller.rb +59 -0
  108. data/lib/authentasaurus/registrations_controller.rb +32 -0
  109. data/lib/authentasaurus/sessions_controller.rb +45 -0
  110. data/lib/authentasaurus/user_invitations_controller.rb +39 -0
  111. data/lib/authentasaurus/users_controller.rb +71 -0
  112. data/lib/authentasaurus/validations_controller.rb +34 -0
  113. data/lib/helpers/migrations.rb +171 -0
  114. data/lib/helpers/routing.rb +90 -0
  115. data/rails/init.rb +37 -0
  116. metadata +188 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Mash Ltd.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,173 @@
1
+ == Authentasaurus
2
+
3
+ Authentasaurus is a dynamic group/permission based authentication and authorization engine plugin, its simple to use and easy
4
+ to setup.
5
+
6
+ Most helpers are inspired by Devise.
7
+
8
+ == Installation
9
+
10
+ To start using Authentasaurus follow these simple steps :
11
+
12
+ 1. install authentasaurus gem by running the following command
13
+ gem install authentasaurus
14
+ 2. add authentasaurus to your application environment; in config/environment.rb
15
+ config.gem "authentasaurus"
16
+ 3. generate authentasaurus configuration and tasks in your application
17
+ script/generate authentasaurus
18
+ 4. setup your migrations using the migration helpers
19
+ in the migration up method just use
20
+ authentasaurus_tables
21
+ in the migration down method
22
+ authentasaurus_drop_tables
23
+ 5. migrate your database and setup your default data
24
+ rake authentasaurus:setup_defaults
25
+ 6. add your routes
26
+ map.authentasaurus_routes :authorizable, :validatable, :invitable
27
+
28
+ that's the most basic and quick setup, you can now test your application by running script/server in your
29
+ project root directory and going to http://localhost:3000/sessions/sign-in
30
+
31
+ Authentasaurus is modular, you can install modules as you need them (the previous setup contains all modules), refer to the documentation for more
32
+ information.
33
+
34
+ == Under the hood
35
+
36
+ Authentasaurus takes advantage of rails' before_filter; it checks for the appropriate permissions before
37
+ every action that requires a login, a write or read permission.
38
+
39
+ At login, authentasaurus would load the user's group permissions into a session hash and then attempts to read that hash
40
+ when it meets a require helper on a controller.
41
+
42
+ === Authentasaurus uses the following terms:
43
+
44
+ <tt>Area</tt>::
45
+ An area is in plain english the controller's name, so if you have a controller named "PostsController", the corresponding
46
+ area name would be "posts" (just as you type it in the generator command)
47
+
48
+ <tt>Group</tt>::
49
+ A group is as the name suggests, each group contains a number of users, and each user inherits the group permissions,
50
+ also note that at any given time, the user can only belong to one group
51
+
52
+ <tt>Permission</tt>::
53
+ A permission is one of two, either read or write, but take care, read or write is only a naming, and though it doesn't make
54
+ sense, you could treat a read permission as a write permission and vice versa, but as i said it makes no sense !
55
+
56
+ == Generators
57
+
58
+ There are two generators in Authentasaurus, the default generator
59
+ authentasaurus
60
+ and the views generator
61
+ authentasaurus_views
62
+
63
+ The default generator generates configurations and tasks needed by Authentasaurus, while the views generator
64
+ generates the views used by Authentasaurus in your application, this is useful for customizing authentasaurus and is totally
65
+ optional.
66
+
67
+ Authentasaurus views generator takes the name of the user controller, by default it's users
68
+ script/generate authentasaurus_views users
69
+
70
+ You can also use namespaces:
71
+ script/generate authentasaurus_views admin/users
72
+
73
+ Also you can use some options with the Authentasaurus views generator to add the modules you need:
74
+
75
+ <tt>--authorizable</tt>::
76
+ generates the views necessary for authorization (groups, areas and permissions)
77
+
78
+ <tt>--invitable</tt>::
79
+ generates the views necessary for invitable users
80
+
81
+ <tt>--validatable</tt>::
82
+ generates the views necessary for validatable users
83
+
84
+ You can use a combination of those options like the following example:
85
+ script/generate authentasaurus_views users --authorizable --invitable --validatable
86
+
87
+ == Controller Authorization Helpers
88
+
89
+ There are four main authorization helpers in Authentasaurus for use on controllers:
90
+
91
+ <tt>require_login</tt>::
92
+ requires the user to login before accessing the actions specified
93
+
94
+ <b>ex:</b> Tells Authentasaurus that the action destroy requires login and that
95
+ Authentasaurus shouldn't store the request in the session
96
+ (typically for logout actions)
97
+
98
+ * :skip_request - skips saving the original request (to redirect to after login)
99
+ * :user_model - if defined, authentasaurus will use that model instead of the default "User"
100
+ * :if - specifies a method, proc or string to call to determine if the authorization should occur
101
+ * :unless - specifies a method, proc or string to call to determine if the authorization should not occur
102
+
103
+ require_login :destroy, :skip_request => true
104
+
105
+ <tt>require_write</tt>::
106
+ requires the user to have a write permission to that area to access the actions specified
107
+
108
+ <b>ex:</b> Tells Authentasaurus that the actions create_user and delete_user
109
+ requires login and write permission.
110
+
111
+ * :skip_request - skips saving the original request (to redirect to after login)
112
+ * :user_model - if defined, authentasaurus will use that model instead of the default "User"
113
+ * :if - specifies a method, proc or string to call to determine if the authorization should occur
114
+ * :unless - specifies a method, proc or string to call to determine if the authorization should not occur
115
+
116
+ require_write :create_user, :delete_user
117
+
118
+ <tt>require_read</tt>::
119
+ requires the user to have a read permission to that area to access the actions specified
120
+
121
+ <b>ex:</b> Tells Authentasaurus that the action show_user requires login and read
122
+ permission.
123
+
124
+ * :skip_request - skips saving the original request (to redirect to after login)
125
+ * :user_model - if defined, authentasaurus will use that model instead of the default "User"
126
+ * :if - specifies a method, proc or string to call to determine if the authorization should occur
127
+ * :unless - specifies a method, proc or string to call to determine if the authorization should not occur
128
+
129
+ require_read :show_user, :if api_key.nil?
130
+
131
+ You can use any of those class methods on you controllers to restrict access levels like so:
132
+ class PostsController < ApplicationController
133
+ require_login :index
134
+ require_read :show
135
+ require_write :new, :create, :edit, :update, :destroy
136
+
137
+ def index
138
+ # your code here
139
+ end
140
+
141
+ def show
142
+ # your code here
143
+ end
144
+
145
+ def new
146
+ # your code here
147
+ end
148
+
149
+ def create
150
+ # your code here
151
+ end
152
+
153
+ def edit
154
+ # your code here
155
+ end
156
+
157
+ def update
158
+ # your code here
159
+ end
160
+
161
+ def destroy
162
+ # your code here
163
+ end
164
+ end
165
+
166
+ In addition there is also the has? helper which is available in both Controllers and Views
167
+
168
+ <tt>has?(permission, area=nil)</tt>::
169
+ Checks if the current user has the appropriate permissions for the area specified
170
+
171
+ <b>ex</b>: has?(:write) or has?(:read, :users)
172
+
173
+ Copyright (c) 2010 Mash, Ltd., released under the MIT license
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ * Update views to use the new flash convention
2
+ * flash[:notice] for information messages
3
+ * flash[:alert] for error messages
4
+ * Localize views
@@ -0,0 +1,4 @@
1
+ class AreasController < Authentasaurus::AreasController
2
+ require_read :index, :show
3
+ require_write :new, :create, :edit, :update, :destroy
4
+ end
@@ -0,0 +1,4 @@
1
+ class GroupsController < Authentasaurus::GroupsController
2
+ require_read :index, :show
3
+ require_write :new, :create, :edit, :update, :destroy
4
+ end
@@ -0,0 +1,4 @@
1
+ class PermissionsController < Authentasaurus::PermissionsController
2
+ require_read :index, :show
3
+ require_write :new, :create, :edit, :update, :destroy
4
+ end
@@ -0,0 +1,2 @@
1
+ class RecoveriesController < Authentasaurus::RecoveriesController
2
+ end
@@ -0,0 +1,2 @@
1
+ class RegistrationsController < Authentasaurus::RegistrationsController
2
+ end
@@ -0,0 +1,2 @@
1
+ class SessionsController < Authentasaurus::SessionsController
2
+ end
@@ -0,0 +1,4 @@
1
+ class UserInvitationsController < Authentasaurus::UserInvitationsController
2
+ require_read :index
3
+ require_write :new, :create, :destroy
4
+ end
@@ -0,0 +1,4 @@
1
+ class UsersController < Authentasaurus::UsersController
2
+ require_read :index, :show
3
+ require_write :new, :create, :edit, :update, :destroy
4
+ end
@@ -0,0 +1,2 @@
1
+ class ValidationsController < Authentasaurus::ValidationsController
2
+ end
@@ -0,0 +1,2 @@
1
+ class Area < Authentasaurus::Models::Area
2
+ end
@@ -0,0 +1,2 @@
1
+ class AuthentasaurusEmailer < Authentasaurus::Models::AuthentasaurusEmailer
2
+ end
@@ -0,0 +1,2 @@
1
+ class Group < Authentasaurus::Models::Group
2
+ end
@@ -0,0 +1,2 @@
1
+ class Permission < Authentasaurus::Models::Permission
2
+ end
@@ -0,0 +1,2 @@
1
+ class Recovery < Authentasaurus::Models::Recovery
2
+ end
@@ -0,0 +1,2 @@
1
+ class Session < Authentasaurus::Models::Session
2
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ authenticatable :strong_password, :validatable
3
+ end
@@ -0,0 +1,2 @@
1
+ class UserInvitation < Authentasaurus::Models::UserInvitation
2
+ end
@@ -0,0 +1,3 @@
1
+ class UserSync < ActiveResource::Base
2
+ authenticatable
3
+ end
@@ -0,0 +1,2 @@
1
+ class Validation < Authentasaurus::Models::Validation
2
+ end
@@ -0,0 +1,7 @@
1
+ <h1>Editing <%= @area.name %></h1>
2
+ <% form_for @area do |f| %>
3
+ <%= f.label :name %>
4
+ <%= f.text_field :name, :size => 30 %>
5
+ <br>
6
+ <%= f.submit %>
7
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <h1>Areas</h1>
2
+ <table>
3
+ <tr>
4
+ <th>Target</th>
5
+ </tr>
6
+ <% @areas.each do |area| %>
7
+ <tr>
8
+ <td><%= link_to area.name, area %></td>
9
+ </tr>
10
+ <% end %>
11
+ </table>
@@ -0,0 +1,7 @@
1
+ <h1>Create Area</h1>
2
+ <% form_for @area do |f| %>
3
+ <%= f.label :name %>
4
+ <%= f.text_field :name, :size => 30 %>
5
+ <br>
6
+ <%= f.submit %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h1><%= @area.name %></h1>
2
+ <h3>Groups that have permission on this area</h3>
3
+ <ul>
4
+ <% @area.groups.each do |group| %>
5
+ <li><%= link_to group.name, group %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,4 @@
1
+ <p>You've been invited to create an account at your-domain.com follow this <%= link_to "link", new_registrations_url(:token => @token) %> to respond to the invitation.</p>
2
+
3
+ <p>Best Regards,</p>
4
+ <p>your-domain.com Team</p>
@@ -0,0 +1,7 @@
1
+ <p>Dear <%= @name %>,</p>
2
+
3
+ <p>A request has been made to recover your account's password.</p>
4
+ <p>Please visit this <%= link_to "link", recover_password_url(@token) %> and follow the instructions.</p>
5
+
6
+ <p>Best Regards,</p>
7
+ <p>your-domain.com Team</p>
@@ -0,0 +1,6 @@
1
+ <p>Dear <%= @name %>,</p>
2
+
3
+ <p>Please validate your account at your-domain.com by visiting this <%= link_to "link", validate_url, :code => @vcode %>.</p>
4
+
5
+ <p>Best Regards,</p>
6
+ <p>your-domain.com Team</p>
@@ -0,0 +1,7 @@
1
+ <h1>Editing <%= @group.name %></h1>
2
+ <% form_for @group do |f| %>
3
+ <%= f.label :name %>
4
+ <%= f.text_field :name, :size => 30 %>
5
+ <br>
6
+ <%= f.submit %>
7
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <h1>Groups</h1>
2
+ <table width="100%">
3
+ <tr>
4
+ <th>Name</th>
5
+ </tr>
6
+ <% @groups.each do |group| %>
7
+ <tr>
8
+ <td><%= link_to group.name, group %></td>
9
+ </tr>
10
+ <% end %>
11
+ </table>
@@ -0,0 +1,7 @@
1
+ <h1>Create Group</h1>
2
+ <% form_for @group do |f| %>
3
+ <%= f.label :name %>
4
+ <%= f.text_field :name, :size => 30 %>
5
+ <br>
6
+ <%= f.submit %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h1><%= @group.name %></h1>
2
+ <h2>Permissions</h2>
3
+ <ul>
4
+ <% @group.permissions.each do |permission| %>
5
+ <li><%= link_to permission.area.name, permission %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,19 @@
1
+ <h1>Editing <%= @permission.area.target %> permissions for <%= @permission.group.name %></h1>
2
+ <% form_for @permission do |f| %>
3
+ <%= f.label :group_id %>
4
+ <%= f.collection_select(:group_id, Group.find(:all), :id, :name, {:prompt => true}) %>
5
+ <br>
6
+ <%= f.label :area_id %>
7
+ <%= f.collection_select(:area_id, Area.find(:all), :id, :name, {:prompt => true}) %>
8
+ <br>
9
+ <%= f.label :group_id %>
10
+ <%= f.collection_select(:group_id, Group.find(:all), :id, :name, {:prompt => true}) %>
11
+ <br>
12
+ <%= f.label :read %>
13
+ <%= f.check_box :read %>
14
+ <br>
15
+ <%= f.label :write %>
16
+ <%= f.check_box :write %>
17
+ <br>
18
+ <%= f.submit %>
19
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <h1>Permissions</h1>
2
+ <table>
3
+ <tr>
4
+ <th>Group</th>
5
+ <th>Area</th>
6
+ <th>Read</th>
7
+ <th>Write</th>
8
+ </tr>
9
+ <% @permissions.each do |permission| %>
10
+ <tr>
11
+ <td><%= link_to permission.group.name, permission.group %></td>
12
+ <td><%= link_to permission.area.name, permission.area %></td>
13
+ <td><%= check_box_tag :read, "read", permission.read, :disabled => true %></td>
14
+ <td><%= check_box_tag :write, "write", permission.write, :disabled => true %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
@@ -0,0 +1,19 @@
1
+ <h1>Create Permission</h1>
2
+ <% form_for @permission do |f| %>
3
+ <%= f.label :group_id %>
4
+ <%= f.collection_select(:group_id, Group.find(:all), :id, :name, {:prompt => true}) %>
5
+ <br>
6
+ <%= f.label :area_id %>
7
+ <%= f.collection_select(:area_id, Area.find(:all), :id, :name, {:prompt => true}) %>
8
+ <br>
9
+ <%= f.label :group_id %>
10
+ <%= f.collection_select(:group_id, Group.find(:all), :id, :name, {:prompt => true}) %>
11
+ <br>
12
+ <%= f.label :read %>
13
+ <%= f.check_box :read %>
14
+ <br>
15
+ <%= f.label :write %>
16
+ <%= f.check_box :write %>
17
+ <br>
18
+ <%= f.submit %>
19
+ <% end %>