Module: RbacRls::PermissionsHelper
- Defined in:
- app/helpers/rbac_rls/permissions_helper.rb
Instance Method Summary collapse
- #permission_options_for_select(form) ⇒ Object
- #role_options_for_select(form) ⇒ Object
- #table_name_options_for_select(form) ⇒ Object
- #table_selected_key_options_for_select(form) ⇒ Object
- #table_selected_value_options_for_select(form) ⇒ Object
- #user_options_for_select(form) ⇒ Object
Instance Method Details
#permission_options_for_select(form) ⇒ Object
4 5 6 7 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 4 def (form) c = RbacRls::Permission.all (c.collect { |p| [p.name, p.id] }, form.object.) end |
#role_options_for_select(form) ⇒ Object
21 22 23 24 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 21 def (form) c = RbacRls::Role.all (c.collect { |p| [p.name, p.id] }, form.object.role_id) end |
#table_name_options_for_select(form) ⇒ Object
36 37 38 39 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 36 def (form) c = RbacRls::Permission.all_tables (c.collect { |t| [t, t] }, form.object.table_name) end |
#table_selected_key_options_for_select(form) ⇒ Object
9 10 11 12 13 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 9 def (form) return ({}, nil) if form.object..nil? c = RbacRls::GroupPermission.all (c.collect { |p| [p.table_key, p.table_key] }, form.object.table_key) end |
#table_selected_value_options_for_select(form) ⇒ Object
15 16 17 18 19 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 15 def (form) return ({}, nil) if form.object..nil? c = RbacRls::GroupPermission.all (c.collect { |p| [p.table_value, p.table_value] }, form.object.table_value) end |
#user_options_for_select(form) ⇒ Object
31 32 33 34 |
# File 'app/helpers/rbac_rls/permissions_helper.rb', line 31 def (form) c = User.all (c.collect { |p| [p.email, p.id] }, form.object.user_id) end |