wobauth 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +165 -0
  3. data/Rakefile +30 -0
  4. data/app/assets/javascripts/wobauth/admin.js +13 -0
  5. data/app/assets/javascripts/wobauth/authorities.js.coffee +31 -0
  6. data/app/assets/javascripts/wobauth/groups.js +2 -0
  7. data/app/assets/javascripts/wobauth/memberships.js +2 -0
  8. data/app/assets/javascripts/wobauth/roles.js +2 -0
  9. data/app/assets/stylesheets/wobauth/application.css +15 -0
  10. data/app/assets/stylesheets/wobauth/authorities.css +4 -0
  11. data/app/assets/stylesheets/wobauth/groups.css +4 -0
  12. data/app/assets/stylesheets/wobauth/memberships.css +4 -0
  13. data/app/assets/stylesheets/wobauth/roles.css +4 -0
  14. data/app/controllers/wobauth/ad_users_controller.rb +24 -0
  15. data/app/controllers/wobauth/application_controller.rb +25 -0
  16. data/app/controllers/wobauth/authorities_controller.rb +88 -0
  17. data/app/controllers/wobauth/groups/authorities_controller.rb +11 -0
  18. data/app/controllers/wobauth/groups/memberships_controller.rb +11 -0
  19. data/app/controllers/wobauth/groups_controller.rb +60 -0
  20. data/app/controllers/wobauth/login_controller.rb +10 -0
  21. data/app/controllers/wobauth/memberships_controller.rb +79 -0
  22. data/app/controllers/wobauth/registrations_controller.rb +26 -0
  23. data/app/controllers/wobauth/roles_controller.rb +30 -0
  24. data/app/controllers/wobauth/users/authorities_controller.rb +11 -0
  25. data/app/controllers/wobauth/users/memberships_controller.rb +11 -0
  26. data/app/controllers/wobauth/users_controller.rb +76 -0
  27. data/app/helpers/wobauth/ad_users_helper.rb +60 -0
  28. data/app/helpers/wobauth/application_helper.rb +53 -0
  29. data/app/helpers/wobauth/authorities_helper.rb +9 -0
  30. data/app/models/wobauth/ad_user.rb +4 -0
  31. data/app/models/wobauth/admin_ability.rb +67 -0
  32. data/app/models/wobauth/authority.rb +17 -0
  33. data/app/models/wobauth/group.rb +18 -0
  34. data/app/models/wobauth/membership.rb +11 -0
  35. data/app/models/wobauth/role.rb +19 -0
  36. data/app/models/wobauth/user.rb +11 -0
  37. data/app/services/wobauth/search_ad_user_service.rb +53 -0
  38. data/app/views/devise/registrations/edit.html.erb +25 -0
  39. data/app/views/devise/sessions/new.html.erb +17 -0
  40. data/app/views/devise/shared/_links.html.erb +0 -0
  41. data/app/views/wobauth/ad_users/index.html.erb +69 -0
  42. data/app/views/wobauth/authorities/_form.html.erb +32 -0
  43. data/app/views/wobauth/authorities/edit.html.erb +1 -0
  44. data/app/views/wobauth/authorities/index.html.erb +41 -0
  45. data/app/views/wobauth/authorities/new.html.erb +1 -0
  46. data/app/views/wobauth/authorities/show.html.erb +45 -0
  47. data/app/views/wobauth/groups/_form.html.erb +20 -0
  48. data/app/views/wobauth/groups/_group_memberships.html.erb +21 -0
  49. data/app/views/wobauth/groups/_group_roles.html.erb +23 -0
  50. data/app/views/wobauth/groups/edit.html.erb +1 -0
  51. data/app/views/wobauth/groups/index.html.erb +31 -0
  52. data/app/views/wobauth/groups/new.html.erb +1 -0
  53. data/app/views/wobauth/groups/show.html.erb +45 -0
  54. data/app/views/wobauth/memberships/_form.html.erb +20 -0
  55. data/app/views/wobauth/memberships/edit.html.erb +1 -0
  56. data/app/views/wobauth/memberships/index.html.erb +33 -0
  57. data/app/views/wobauth/memberships/new.html.erb +1 -0
  58. data/app/views/wobauth/memberships/show.html.erb +28 -0
  59. data/app/views/wobauth/roles/_role_authorities.html.erb +21 -0
  60. data/app/views/wobauth/roles/index.html.erb +26 -0
  61. data/app/views/wobauth/roles/show.html.erb +18 -0
  62. data/app/views/wobauth/shared/_accounting.html.erb +25 -0
  63. data/app/views/wobauth/shared/_admin.html.erb +13 -0
  64. data/app/views/wobauth/users/_form.html.erb +28 -0
  65. data/app/views/wobauth/users/_user_groups.html.erb +22 -0
  66. data/app/views/wobauth/users/_user_roles.html.erb +23 -0
  67. data/app/views/wobauth/users/edit.html.erb +1 -0
  68. data/app/views/wobauth/users/index.html.erb +52 -0
  69. data/app/views/wobauth/users/new.html.erb +1 -0
  70. data/app/views/wobauth/users/show.html.erb +130 -0
  71. data/config/initializers/assets.rb +1 -0
  72. data/config/initializers/devise.rb +260 -0
  73. data/config/initializers/devise_failure_app.rb +21 -0
  74. data/config/initializers/simple_form.rb +169 -0
  75. data/config/initializers/simple_form_bootstrap.rb +154 -0
  76. data/config/initializers/wobapphelpers.rb +18 -0
  77. data/config/locales/de.yml +80 -0
  78. data/config/locales/devise.de.yml +60 -0
  79. data/config/locales/devise.en.yml +59 -0
  80. data/config/locales/en.yml +27 -0
  81. data/config/locales/simple_form.en.yml +31 -0
  82. data/config/locales/wobapphelpers.de.yml +10 -0
  83. data/config/locales/wobapphelpers.en.yml +8 -0
  84. data/config/routes.rb +24 -0
  85. data/db/migrate/20140501113226_create_wobauth_roles.rb +9 -0
  86. data/db/migrate/20140501150743_create_wobauth_groups.rb +10 -0
  87. data/db/migrate/20140504124045_create_wobauth_memberships.rb +11 -0
  88. data/db/migrate/20140504143328_create_wobauth_authorities.rb +15 -0
  89. data/db/migrate/20140508120810_devise_create_wobauth_users.rb +55 -0
  90. data/db/migrate/20171231084355_additional_fields_to_wobauth_user.rb +8 -0
  91. data/lib/concerns/models/user.rb +44 -0
  92. data/lib/generators/templates/initializers/wobauth.rb +20 -0
  93. data/lib/generators/wobauth/install_generator.rb +20 -0
  94. data/lib/tasks/wobauth_tasks.rake +4 -0
  95. data/lib/templates/erb/scaffold/_form.html.erb +26 -0
  96. data/lib/templates/erb/scaffold/edit.html.erb +1 -0
  97. data/lib/templates/erb/scaffold/index.html.erb +32 -0
  98. data/lib/templates/erb/scaffold/new.html.erb +1 -0
  99. data/lib/templates/erb/scaffold/show.html.erb +15 -0
  100. data/lib/templates/rails/scaffold_controller/controller.rb +66 -0
  101. data/lib/wobauth/engine.rb +33 -0
  102. data/lib/wobauth/version.rb +4 -0
  103. data/lib/wobauth.rb +57 -0
  104. data/test/dummy/db/test.sqlite3 +0 -0
  105. data/test/dummy/db/test1.sqlite3 +0 -0
  106. data/test/dummy/log/test.log +1954 -0
  107. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-6/-6x3utBDawbjV5d477TJ9PeEoQTk9Yh292Yg_8Ox16U.cache +1 -0
  108. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-A/-A9u9WxFQ9YT2TSLvmYJYJf2Kg9JfDoIt6YZQRcwUHE.cache +0 -0
  109. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-C/-CJCPQLf_lB4gJr983MP5sZdH3uZuYPIe-xSw4QBln4.cache +1 -0
  110. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-K/-K6Cz6iJ4bgvnwN-rMFxBtyYEU6EGdLH9b4N38_GwIs.cache +1 -0
  111. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-x/-xwsVQHMHEQFqvVNjKKkEiujw9_CUgnJ2Hmzampfy60.cache +1 -0
  112. data/test/dummy/tmp/cache/assets/sprockets/v3.0/2J/2JNdqFTZ9i8DAT1rZCc-Xj70u9zcQtlJoqEK68sRPVM.cache +0 -0
  113. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4N/4NSPDtUmuTVU5uLI-eBtnORjzrwVgeLgrgIJh4tjWeQ.cache +1 -0
  114. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4u/4uuqiFX5bLo0J5QqMPSZc642NRkdX4l-Vguvyq6Oe3U.cache +1 -0
  115. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5O/5Oqd8RObzOeHuHy3NTiGE5p_ZkpftjQQgJgS_3KKdH0.cache +1 -0
  116. data/test/dummy/tmp/cache/assets/sprockets/v3.0/6U/6UZEqCkIx3XO_NjOjjWyLET2-dS4Gs_RPAB9NtA99-A.cache +0 -0
  117. data/test/dummy/tmp/cache/assets/sprockets/v3.0/76/767sF803BgrHtDgUPUUn-HN41e6fklZIQkVKyKD59P4.cache +1 -0
  118. data/test/dummy/tmp/cache/assets/sprockets/v3.0/77/77ZyE9pECDHt-19ik7nBaJXJQT-7V2UDr49kFOIO1DM.cache +1 -0
  119. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7n/7nJvPEaj-WV6RCKHc3hpHsAbWek8cidSKvDKLedQpH4.cache +3 -0
  120. data/test/dummy/tmp/cache/assets/sprockets/v3.0/85/856_llbCcD4ntIG6h4uR2WQY9SrutzA-9K6xT53ZPTY.cache +0 -0
  121. data/test/dummy/tmp/cache/assets/sprockets/v3.0/9A/9A6WX6bvqMDoyDrYrGQy2l6nf_JtHoQZsa-pEJ0FgDU.cache +0 -0
  122. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BA/BABtX6k2NZISYrxZSviAXC8UIxZfRhEDDbx7dMf_ShQ.cache +1 -0
  123. data/test/dummy/tmp/cache/assets/sprockets/v3.0/D4/D4_Vl_wB6Vq8O0LvQ9iHt-YqG_c0fUR4af06OZlk10k.cache +3 -0
  124. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DX/DXGc2xprS_TuG5PzNCaBHKBMWTlyrZZYA9jlvlcBn3M.cache +1 -0
  125. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ex/ExDgDLUsesHZC1FAxhQLmTyBpg6IW4gVCUB8U8Ov-X4.cache +1 -0
  126. data/test/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8M6mPdg93dPiXZzHGo3Y0I42et4yc5Hr-eCfuOUeac.cache +1 -0
  127. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Hk/Hkx4xbJvgHfFgfNDKyHxertTGvARWOgVuNuGU-OWPEU.cache +0 -0
  128. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Jo/Jom6Wnb-Sd-d3W24hNHS58BHtuw5Dsm7vvWVPtLB0PA.cache +0 -0
  129. data/test/dummy/tmp/cache/assets/sprockets/v3.0/K5/K5UnItDV1g9ixIoFloUxCNirxL5UFrOT0jz1vKy5shc.cache +31 -0
  130. data/test/dummy/tmp/cache/assets/sprockets/v3.0/K6/K6geC8zADOljHu2R2-DHUgVrgGyij9e4dnxgIdEypMU.cache +2 -0
  131. data/test/dummy/tmp/cache/assets/sprockets/v3.0/KW/KWpcGMHEfc0mpysCx46leXLgyrzubUIXWouB91Ia5Ik.cache +1 -0
  132. data/test/dummy/tmp/cache/assets/sprockets/v3.0/LD/LD1fywEt5YfgacZhvpug0VXFakWRb1jidort_y8Fl00.cache +3 -0
  133. data/test/dummy/tmp/cache/assets/sprockets/v3.0/LT/LTqeGcgCnDytohL1bGvcUZdnrp6gImr9Gzgfj6sYtW4.cache +1 -0
  134. data/test/dummy/tmp/cache/assets/sprockets/v3.0/LX/LXirLCvjN2zWwKoda0ZdfOoFufIGRC9bZFKo95Kxs2w.cache +3 -0
  135. data/test/dummy/tmp/cache/assets/sprockets/v3.0/MH/MH3Sbn3D_A-k2L9Qd_MSjC2d6zv52DnzX3REO1P8n-E.cache +1 -0
  136. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Nm/NmUDbY8fbYAMYUH3HOmHzTLkeJaf-49yXUpF5TXGnYM.cache +3 -0
  137. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O1/O1xVVUGePb-AZZi4nfbefQqZJEuQKvVAnHbbksdys0g.cache +0 -0
  138. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Og/Og28UaPh4fHs8CazZFMRRClJKMdtcZ6TLkcrwXO9888.cache +0 -0
  139. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Py/Py0iDud1Fnb6eLZHFV1BlJ1PKkeJS5bSVb8DL5Lyoyo.cache +2 -0
  140. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Qs/QscUYhnZ_Tw9H1UICqO4jqvLwSznyhEMlkTJRFR63Qk.cache +0 -0
  141. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Rx/RxBkonRxRoJzfP-2eiuZPIg4Wy1eaNd6MQ6N0QTzLbw.cache +1 -0
  142. data/test/dummy/tmp/cache/assets/sprockets/v3.0/S_/S_VAM9XIEPYa1eIrH2MGCvwgC6UuKNU3IsOsXYCbRfE.cache +1 -0
  143. data/test/dummy/tmp/cache/assets/sprockets/v3.0/TK/TK13HHucosr5_ne6uScM6nK6naCAYu11S4GxXyvGEA4.cache +1 -0
  144. data/test/dummy/tmp/cache/assets/sprockets/v3.0/TP/TPYDffricRYUN-8EoF99EbRAm5m9QVJ4NsV4JQHUaTU.cache +2 -0
  145. data/test/dummy/tmp/cache/assets/sprockets/v3.0/TQ/TQZclZQajgRAt0UPyDLa5SDHOXXd7nrs_Aw1guZ1EDE.cache +0 -0
  146. data/test/dummy/tmp/cache/assets/sprockets/v3.0/U-/U-j-KeDrdeyrmflpuJSSH3aH_tGth_0zwnjl9eaecCU.cache +0 -0
  147. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ui/Ui_ImrdWE848w92udaqCheUJypT-7QIicGTDDcF94ZY.cache +2 -0
  148. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Vy/VyeoEaFiHk-BFfUz0QQyO1ywWUjhhvXaWjOhrueWuz4.cache +1 -0
  149. data/test/dummy/tmp/cache/assets/sprockets/v3.0/WC/WCZBAZL9AYx33c-WzmPLL8ZaSkyPBwQEpJSzDMruSTA.cache +0 -0
  150. data/test/dummy/tmp/cache/assets/sprockets/v3.0/XG/XG-1Cxql9XcU0QzVsKfaImD2F-_fbQakmCOO1PZeiO8.cache +1 -0
  151. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Y-/Y-mfMOkq6o7o6NIVKY5m1HzoQPj6deRrSVoSnePwWDg.cache +0 -0
  152. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Z5/Z56duv_o-wQlnyich8DqrY8VfI5mRampXLuyzcCQSes.cache +0 -0
  153. data/test/dummy/tmp/cache/assets/sprockets/v3.0/_X/_XFCt_G6l_CeYOky6Ky04YbAJMGmZ1S55wnsXuzjbFQ.cache +3 -0
  154. data/test/dummy/tmp/cache/assets/sprockets/v3.0/_c/_cAbQgu5_t6QaopeTV6bHpVH6nABdZSHUD3dtw3TFvI.cache +1 -0
  155. data/test/dummy/tmp/cache/assets/sprockets/v3.0/aU/aUB5QePK5Y_57d0ISu6VcHykCHzl47ej-nXJSzHo7mM.cache +0 -0
  156. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ao/ao7sMvRzih2MlCNwwQnYbm-FUNM2rl1wlruiVgH8VbE.cache +0 -0
  157. data/test/dummy/tmp/cache/assets/sprockets/v3.0/b8/b8sc4SHWqZyiR9LoszM7AwU7Z9RStRdUzs5Cm4b1xi4.cache +1 -0
  158. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dG/dGu-1JGz62Geuns1TpCaYbAwvwLKjSjDp_VhKV3nWOw.cache +3 -0
  159. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dH/dHU4yPNGwU72V1rymqid8RLS4ole8B-9UGSJG-QyDsQ.cache +3 -0
  160. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ei/eiJS8jxPa_CT4ECt01iVkhPzc9QQShE__hFgFUVMqhc.cache +1 -0
  161. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hq/hqAVf5Mc94swL5QKxbwrtNQ1F6-4shrOpiZMk60yjMM.cache +0 -0
  162. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hz/hzzNh1KGk98zydo_p20ZW15iDYFoCsUZuYdK99A54Mo.cache +1 -0
  163. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ip/ip5FbXNQpdaOzVbU6_r90bYcY8R47qbE2_C79IUdlvQ.cache +1 -0
  164. data/test/dummy/tmp/cache/assets/sprockets/v3.0/je/je9xQVOnasRNd1k49Q5KJdmxQscPKO-8qeVDMmmsVrI.cache +1 -0
  165. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jt/jtOzRwEskymBEhztMwmAwvXzROImYepCy7Zb25fxexQ.cache +2 -0
  166. data/test/dummy/tmp/cache/assets/sprockets/v3.0/m3/m3BDc8KCgIUXE0VeZ142byDvlbYuOEBpNW_2ucKyb3M.cache +0 -0
  167. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mf/mfkdFcsUrRviUKGZkElnxw6dCyhyArAFbAVNuqQKcsE.cache +1 -0
  168. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mx/mxQkXyjT__7etUOHa4WpbGL4YguqInaF8rQXNK4c6JU.cache +1 -0
  169. data/test/dummy/tmp/cache/assets/sprockets/v3.0/o4/o4yHfopv-ZxcXaMdi1_2O0CkBEWWQEd0wR0tEwKJ8s8.cache +0 -0
  170. data/test/dummy/tmp/cache/assets/sprockets/v3.0/oF/oFjp7US8e9Cu4GOLqlO_vPIaX9jYwqrYbCFq6mgaYWE.cache +1 -0
  171. data/test/dummy/tmp/cache/assets/sprockets/v3.0/op/opKuUcXieH4Q4hch708zXOG2Rud2bhIilb38wKiOdjA.cache +1 -0
  172. data/test/dummy/tmp/cache/assets/sprockets/v3.0/p4/p4U2tbFHGXaOchAVtbEfIHRvWKO2i-0nsq_4vtGNABU.cache +2 -0
  173. data/test/dummy/tmp/cache/assets/sprockets/v3.0/s4/s4jckxw_fz9fwDYqkrZPCsD7cCATrXbD5R7ducBhtoU.cache +0 -0
  174. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uP/uPXk7u0shmDjGGOhtU06VSo7E81DYc2t9OGhQUvxEA0.cache +1 -0
  175. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vS/vSQW3iohJ14LLnwWgoHFeHB-I3yIzLi9tLoZkUaE81M.cache +0 -0
  176. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vu/vuRt78a_J3dg7DUMHX1Nx9DYLME15Z1NjQ-4V8BoNCU.cache +1 -0
  177. data/test/dummy/tmp/cache/assets/sprockets/v3.0/w6/w6Gz48zxIouRBGOu5VmTHWsL9r0M4LKp124UOJ3mZN0.cache +1 -0
  178. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wj/wjsRbpDa20LzSzj66UKcgy3Wif53rLBEoeuyKIKz4pk.cache +3 -0
  179. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wo/wo1g4ZKtmQmol-3MoVPFApwd5fnGEA23tCRCLuEw3D0.cache +1 -0
  180. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xG/xGQ1RojQn3N9C51pkj4Flt274TjVuszRi1Puir0p6dE.cache +0 -0
  181. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xN/xNqJDUb7i6VSD0HU-EV3dcNYRoz2d48cGwn1CBqLvVU.cache +1 -0
  182. data/test/dummy/tmp/cache/assets/sprockets/v3.0/y1/y1pwuOg2qdJFc_DgDEw6OIyr6GbmGpwV-p7X2sS64sU.cache +0 -0
  183. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zO/zOWzdA_n0s0vjbJ6IGB8gj1-mbqzbCywIQCMLr71qDE.cache +1 -0
  184. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zV/zVdKofyDUgEZzwP0GQ8q4RxOoxo-qoGazLMre0zxw9c.cache +0 -0
  185. data/test/tmp/config/initializers/wobauth.rb +15 -0
  186. data/test/tmp/config/locales/wobauth.de.yml +42 -0
  187. data/test/tmp/config/locales/wobauth.en.yml +27 -0
  188. metadata +636 -0
@@ -0,0 +1,80 @@
1
+ de:
2
+ wobauth:
3
+ action: Aktion
4
+ configuration: Konfiguration
5
+ change_columns: Spalten ändern
6
+ show_all: alles anzeigen
7
+ restore: zurücksetzen
8
+ search: Suche
9
+ sort_helper: Sortierhilfe
10
+ applied_filter: Angewandter Filter
11
+ new_user_from_ad: Benutzer mit Vorlage erstellen
12
+
13
+ activerecord:
14
+ models:
15
+ wobauth/user: Benutzer
16
+ wobauth/ad_user: Active Directory User
17
+ wobauth/authority: Berechtigung
18
+ wobauth/group: Gruppe
19
+ wobauth/membership: Mitgliedschaft
20
+ wobauth/role: Rolle
21
+ wobauth/users/authority: Berechtigung
22
+ wobauth/users/membership: Mitgliedschaft
23
+ wobauth/groups/authority: Berechtigung
24
+ wobauth/groups/membership: Mitgliedschaft
25
+ wobauth/registration: Userprofil
26
+ wobauth/session: Login
27
+
28
+
29
+ attributes:
30
+ active_directory_guid: Active Directory GUID
31
+ authorizable: Authorisierbar
32
+ authorizable_id: Authorisierbar
33
+ authorizable_type: Authorisierbar/Typ
34
+ authorized_for: Berechtigung auf
35
+ authorized_for_id: Berechtigung auf
36
+ authorized_for_type: Berechtigung auf/Typ
37
+ auto: Auto
38
+ care_of: c/o
39
+ company: Organisation
40
+ current_sign_in_at: Login am
41
+ current_sign_in_ip: Login-IP
42
+ department: Abteilung
43
+ description: Beschreibung
44
+ displayname: Anzeigename
45
+ email: E-Mail
46
+ facsimiletelephonenumber: Telefax
47
+ group: Gruppe
48
+ gruppen: Gruppen (auto)
49
+ last_sign_in_at: Letzter Login
50
+ last_sign_in_ip: Letzte Login-IP
51
+ location: Ort
52
+ mail: E-Mail
53
+ members: Mitglieder
54
+ membership: Mitgliedschaft
55
+ mobile: Mobil
56
+ name: Name
57
+ ort: Ort
58
+ plz: PLZ
59
+ position: Position
60
+ postfach: Postfach
61
+ postfachplz: PLZ (Postfach)
62
+ role: Rolle
63
+ sign_in_count: Anzahl Logins
64
+ streetaddress: Straße, Nr.
65
+ telephone: Telefon
66
+ telephonenumber: Telefon
67
+ title: Titel
68
+ user: Benutzer
69
+ username: Username
70
+ userprincipalname: Principalname
71
+ valid_from: gültig von
72
+ valid_until: gültig bis
73
+
74
+ controller:
75
+ wobauth/users: Benutzer
76
+ wobauth/ad_users: Active Directory User
77
+ wobauth/authorities: Berechtigungen
78
+ wobauth/groups: Gruppen
79
+ wobauth/memberships: Mitgliedschaften
80
+ wobauth/roles: Rollen
@@ -0,0 +1,60 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ de:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Vielen Dank für Ihre Registrierung. Bitte melden Sie sich jetzt an."
7
+ confirmed_and_signed_in: "Vielen Dank für Ihre Registrierung. Sie sind jetzt angemeldet."
8
+ send_instructions: "Sie erhalten in wenigen Minuten eine E-Mail, mit der Sie Ihre Registrierung bestätigen können."
9
+ send_paranoid_instructions: "Falls Ihre E-Mail-Adresse in unserer Datenbank existiert erhalten Sie in wenigen Minuten eine E-Mail mit der Sie Ihre Registrierung bestätigen können."
10
+ failure:
11
+ already_authenticated: "Sie sind bereits angemeldet."
12
+ inactive: "Ihr Account ist nicht aktiv."
13
+ invalid: "Ungültige Anmeldedaten."
14
+ invalid_token: "Der Anmelde-Token ist ungültig."
15
+ locked: "Ihr Account ist gesperrt."
16
+ not_found_in_database: "E-Mail-Adresse oder Passwort ungültig."
17
+ timeout: "Ihre Sitzung ist abgelaufen, bitte melden Sie sich erneut an."
18
+ unauthenticated: "Sie müssen sich anmelden oder registrieren, bevor Sie fortfahren können."
19
+ unconfirmed: "Sie müssen Ihren Account bestätigen, bevor Sie fortfahren können."
20
+ mailer:
21
+ confirmation_instructions:
22
+ subject: "Anleitung zur Bestätigung Ihres Accounts"
23
+ reset_password_instructions:
24
+ subject: "Anleitung um Ihr Passwort zurückzusetzen"
25
+ unlock_instructions:
26
+ subject: "Anleitung um Ihren Account freizuschalten"
27
+ omniauth_callbacks:
28
+ failure: "Sie konnten nicht mit Ihrem %{kind}-Account angemeldet werden, weil '%{reason}'."
29
+ success: "Sie haben sich erfolgreich mit Ihrem %{kind}-Account angemeldet."
30
+ passwords:
31
+ no_token: "Sie können diese Seite nur von dem Link aus einer E-Mail zum Passwort-Zurücksetzen aufrufen. Wenn Sie einen solchen Link aufgerufen haben, stellen Sie bitte sicher, dass Sie die vollständige Adresse aufrufen."
32
+ send_instructions: "Sie erhalten in wenigen Minuten eine E-Mail mit der Anleitung, wie Sie Ihr Passwort zurücksetzen können."
33
+ send_paranoid_instructions: "Falls Ihre E-Mail-Adresse in unserer Datenbank existiert erhalten Sie in wenigen Minuten eine E-Mail mit der Anleitung, wie Sie Ihr Passwort zurücksetzen können."
34
+ updated: "Ihr Passwort wurde geändert. Sie sind jetzt angemeldet."
35
+ updated_not_active: "Ihr Passwort wurde geändert."
36
+ registrations:
37
+ destroyed: "Ihr Account wurde gelöscht."
38
+ signed_up: "Sie haben sich erfolgreich registriert."
39
+ signed_up_but_inactive: "Sie haben sich erfolgreich registriert. Wir konnten Sie noch nicht anmelden, da Ihr Account inaktiv ist."
40
+ signed_up_but_locked: "Sie haben sich erfolgreich registriert. Wir konnten Sie noch nicht anmelden, da Ihr Account gesperrt ist."
41
+ signed_up_but_unconfirmed: "Sie haben sich erfolgreich registriert. Wir konnten Sie noch nicht anmelden, da Ihr Account noch nicht bestätigt ist. Sie erhalten in Kürze eine E-Mail mit der Anleitung, wie Sie Ihren Account freischalten können."
42
+ update_needs_confirmation: "Ihre Daten wurden aktualisiert, aber Sie müssen Ihre neue E-Mail-Adresse bestätigen. Sie erhalten in wenigen Minuten eine E-Mail, mit der Sie die Änderung Ihrer E-Mail-Adresse abschliessen können."
43
+ updated: "Ihre Daten wurden aktualisiert."
44
+ sessions:
45
+ signed_in: "Erfolgreich angemeldet."
46
+ signed_out: "Erfolgreich abgemeldet."
47
+ unlocks:
48
+ send_instructions: "Sie erhalten in wenigen Minuten eine E-Mail mit der Anleitung, wie Sie Ihren Account entsperren können."
49
+ send_paranoid_instructions: "Falls Ihre E-Mail-Adresse in unserer Datenbank existiert erhalten Sie in wenigen Minuten eine E-Mail mit der Anleitung, wie Sie Ihren Account entsperren können."
50
+ unlocked: "Ihr Account wurde entsperrt. Sie sind jetzt angemeldet."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "wurde bereits bestätigt"
54
+ confirmation_period_expired: "muss innerhalb %{period} bestätigt werden, bitte fordern Sie einen neuen Link an"
55
+ expired: "ist abgelaufen, bitte neu anfordern"
56
+ not_found: "nicht gefunden"
57
+ not_locked: "ist nicht gesperrt"
58
+ not_saved:
59
+ one: "Konnte %{resource} nicht speichern: ein Fehler."
60
+ other: "Konnte %{resource} nicht speichern: %{count} Fehler."
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid email or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account will be locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,27 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ wobauth/authority: Authority
5
+ wobauth/group: Group
6
+ wobauth/membership: Member
7
+ wobauth/role: Role
8
+
9
+ attributes:
10
+ name: Name
11
+ authorizable: authorizable
12
+ authorizable_type: authorizable type
13
+ authorized_for: authorized for
14
+ authorized_for_type: authorized for type
15
+ auto: auto
16
+ group: gruppe
17
+ membership: membership
18
+ role: role
19
+ valid_from: valid from
20
+ valid_until: valid until
21
+
22
+ controller:
23
+ wobauth/authorities: Authorities
24
+ wobauth/groups: Groups
25
+ wobauth/memberships: Memberships
26
+ wobauth/roles: Roles
27
+
@@ -0,0 +1,31 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
@@ -0,0 +1,10 @@
1
+ de:
2
+ wobapphelpers:
3
+ helpers:
4
+ back: "Zurück"
5
+ cancel: "Abbrechen"
6
+ controller:
7
+ new: "%{name} erstellen"
8
+ create: "%{name} erstellen"
9
+ edit: "%{name} bearbeiten"
10
+ update: "%{name} bearbeiten"
@@ -0,0 +1,8 @@
1
+ en:
2
+ wobapphelpers:
3
+ helpers:
4
+ back: Back
5
+ cancel: Cancel
6
+ controller:
7
+ new: "create %{name}"
8
+ edit: "update %{name}"
data/config/routes.rb ADDED
@@ -0,0 +1,24 @@
1
+ Wobauth::Engine.routes.draw do
2
+
3
+ devise_for :users, path: 'accounts', class_name: "Wobauth::User", module: :devise,
4
+ controllers: {registrations: 'wobauth/registrations'}
5
+
6
+ resources :users do
7
+ resources :authorities, module: :users
8
+ resources :memberships, module: :users
9
+ end
10
+ resources :ad_users, :only => [:index] do
11
+ collection do
12
+ post :index
13
+ end
14
+ end
15
+ resources :authorities
16
+ resources :memberships
17
+ resources :groups do
18
+ resources :authorities, module: :groups
19
+ resources :memberships, module: :groups
20
+ end
21
+ resources :roles
22
+
23
+ get 'login' => 'login#login', as: :login
24
+ end
@@ -0,0 +1,9 @@
1
+ class CreateWobauthRoles < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wobauth_roles do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateWobauthGroups < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wobauth_groups do |t|
4
+ t.string :name
5
+ t.string :description
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class CreateWobauthMemberships < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wobauth_memberships do |t|
4
+ t.references :user, index: true
5
+ t.references :group, index: true
6
+ t.boolean :auto, default: false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ class CreateWobauthAuthorities < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wobauth_authorities do |t|
4
+ t.references :authorizable, index: true
5
+ t.string :authorizable_type
6
+ t.references :role, index: true
7
+ t.references :authorized_for, index: true
8
+ t.string :authorized_for_type
9
+ t.date :valid_from
10
+ t.date :valid_until
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,55 @@
1
+ class DeviseCreateWobauthUsers < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table(:wobauth_users) do |t|
4
+
5
+ # -- devise_cas_authenticable
6
+ t.string :username, :null => false, :default => ""
7
+
8
+ # -- wob's extensions
9
+ t.text "gruppen"
10
+ t.string "sn"
11
+ t.string "givenname"
12
+ t.string "displayname"
13
+ t.string "telephone"
14
+ t.string "active_directory_guid"
15
+ t.string "userprincipalname"
16
+
17
+ ## Database authenticatable
18
+ t.string :email, null: false, default: ""
19
+ t.string :encrypted_password, null: false, default: ""
20
+
21
+ ## Recoverable
22
+ t.string :reset_password_token
23
+ t.datetime :reset_password_sent_at
24
+
25
+ ## Rememberable
26
+ t.datetime :remember_created_at
27
+
28
+ ## Trackable
29
+ t.integer :sign_in_count, default: 0, null: false
30
+ t.datetime :current_sign_in_at
31
+ t.datetime :last_sign_in_at
32
+ t.string :current_sign_in_ip
33
+ t.string :last_sign_in_ip
34
+
35
+ ## Confirmable
36
+ # t.string :confirmation_token
37
+ # t.datetime :confirmed_at
38
+ # t.datetime :confirmation_sent_at
39
+ # t.string :unconfirmed_email # Only if using reconfirmable
40
+
41
+ ## Lockable
42
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
43
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
44
+ # t.datetime :locked_at
45
+
46
+
47
+ t.timestamps
48
+ end
49
+
50
+ add_index :wobauth_users, :username, unique: true
51
+ add_index :wobauth_users, :reset_password_token, unique: true
52
+ # add_index :wobauth_users, :confirmation_token, unique: true
53
+ # add_index :wobauth_users, :unlock_token, unique: true
54
+ end
55
+ end
@@ -0,0 +1,8 @@
1
+ class AdditionalFieldsToWobauthUser < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :wobauth_users, :title, :string, default: ""
4
+ add_column :wobauth_users, :position, :string, default: ""
5
+ add_column :wobauth_users, :department, :string, default: ""
6
+ add_column :wobauth_users, :company, :string, default: ""
7
+ end
8
+ end
@@ -0,0 +1,44 @@
1
+ module Wobauth
2
+ module Concerns
3
+ module Models::User
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ has_many :authorities, as: :authorizable, dependent: :destroy
8
+ has_many :roles, through: :authorities
9
+ has_many :memberships, dependent: :destroy
10
+ has_many :groups, -> { distinct }, through: :memberships
11
+ has_many :group_roles, through: :groups, source: :roles
12
+ has_many :group_authorities, through: :groups, source: :authorities
13
+
14
+ validates :username, presence: true, uniqueness: true
15
+ end
16
+
17
+
18
+ def to_s
19
+ if sn.blank? and givenname.blank?
20
+ "#{username}"
21
+ elsif title.blank?
22
+ "#{sn}, #{givenname} (#{username})"
23
+ else
24
+ "#{sn}, #{title} #{givenname} (#{username})"
25
+ end
26
+ end
27
+
28
+ def name
29
+ to_s
30
+ end
31
+
32
+ def is_admin?
33
+ role?(:admin)
34
+ end
35
+
36
+ def role?(role)
37
+ (self.authorities.joins(:role)
38
+ .where("wobauth_roles.name = ?", role.to_s.camelize).present?) ||
39
+ (self.group_authorities.joins(:role)
40
+ .where("wobauth_roles.name = ?", role.to_s.camelize).present?)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ Wobauth.setup do |config|
2
+ #
3
+ # Configuration for Authorization
4
+ # 1. Subject: Authorizable
5
+ # do not change it unless you know exactly what you are doing
6
+ #
7
+ # config.authorizable_types = [ "Wobauth::User", "Wobauth::Group" ]
8
+ # config.authorizable_group_method = :all
9
+ #
10
+ # 2. Object: Authorized_for
11
+ # depends on your application ...
12
+ # default: []
13
+ #
14
+ # config.authorized_for_types = [ "MyClass", ...]
15
+ # config.authorized_for_group_method = :all
16
+ #
17
+ # or for ancestry trees:
18
+ # config.authorized_for_group_method = :arrange_as_array
19
+ #
20
+ end
@@ -0,0 +1,20 @@
1
+ module Wobauth
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Copy locale files to your application"
7
+ def copy_locale
8
+ ['en', 'de'].each do |lang|
9
+ copy_file "../../../config/locales/#{lang}.yml",
10
+ "config/locales/wobauth.#{lang}.yml"
11
+ end
12
+ end
13
+
14
+ desc "create initializer"
15
+ def copy_initializer
16
+ copy_file "initializers/wobauth.rb", "config/initializers/wobauth.rb"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :wobauth do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,26 @@
1
+ <%%= simple_form_for(@<%= singular_table_name %>,
2
+ html: { class: 'form-horizontal well' },
3
+ wrapper: :horizontal_form,
4
+ wrapper_mappings: {
5
+ check_boxes: :horizontal_radio_and_checkboxes,
6
+ radio_buttons: :horizontal_radio_and_checkboxes,
7
+ file: :horizontal_file_input,
8
+ boolean: :horizontal_boolean
9
+ }) do |f| %>
10
+
11
+ <fieldset>
12
+ <%%= form_legend %>
13
+
14
+ <div class="form-inputs">
15
+ <%- attributes.each do |attribute| -%>
16
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %><% (attribute.field_type == :date_select) ? ', as: :string' : '' %>
17
+ %>
18
+ <%- end -%>
19
+ </div>
20
+
21
+ <div class="form-actions col-sm-9 col-sm-offset-3">
22
+ <%%= f.button :submit, class: 'btn btn-primary' %>
23
+ <%%= cancel_button %>
24
+ </div>
25
+ </fieldset>
26
+ <%% end %>
@@ -0,0 +1 @@
1
+ <%%= render 'form' %>
@@ -0,0 +1,32 @@
1
+ <h1><%%= t('controller.<%= plural_table_name %>') %></h1>
2
+
3
+ <table id="dataTable" class="table table-bordered table-striped dataTable">
4
+ <thead>
5
+ <tr>
6
+ <% attributes.each do |attribute| -%>
7
+ <th><%%= t('attributes.<%= attribute.name %>') %></th>
8
+ <% end -%>
9
+ <th></th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+
14
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
15
+ <%%= content_tag_for(:tr, <%= singular_table_name %>) do %>
16
+ <% attributes.each do |attribute| -%>
17
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
18
+ <% end -%>
19
+ <td class="nowrap">
20
+ <%%= show_link <%= singular_table_name %> %>
21
+ <%%= edit_link <%= singular_table_name %> %>
22
+ <%%= delete_link <%= singular_table_name %> %>
23
+ </td>
24
+ <%% end %>
25
+ <%% end %>
26
+ </tbody>
27
+ </table>
28
+
29
+ <br />
30
+
31
+ <%%= back_link %>
32
+ <%%= new_link <%= class_name %> %>
@@ -0,0 +1 @@
1
+ <%%= render 'form' %>
@@ -0,0 +1,15 @@
1
+ <table class="table table-bordered table-hover autowidth">
2
+ <% attributes.each do |attribute| -%>
3
+ <tr>
4
+ <th><%%= t('attributes.<%= attribute.name %>')%>:</th>
5
+ <td><%%= @<%= singular_table_name %>.<%= attribute.name %> %></td>
6
+ </tr>
7
+ <% end -%>
8
+ </table>
9
+
10
+ <div class="btn-toolbar" role="toolbar">
11
+ <%%= back_link %>
12
+ <%%= edit_link(@<%= singular_table_name %>) %>
13
+ <%%= delete_link(@<%= singular_table_name %>) %>
14
+ <%%= new_link <%= class_name %> %>
15
+ </div>
@@ -0,0 +1,66 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= controller_class_name %>Controller < ApplicationController
7
+ before_action :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
8
+ before_action :add_breadcrumb_show, only: [:show]
9
+
10
+ # GET <%= route_url %>
11
+ def index
12
+ @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
13
+ respond_with(@<%= plural_table_name %>)
14
+ end
15
+
16
+ # GET <%= route_url %>/1
17
+ def show
18
+ respond_with(@<%= singular_table_name %>)
19
+ end
20
+
21
+ # GET <%= route_url %>/new
22
+ def new
23
+ @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
24
+ respond_with(@<%= singular_table_name %>)
25
+ end
26
+
27
+ # GET <%= route_url %>/1/edit
28
+ def edit
29
+ end
30
+
31
+ # POST <%= route_url %>
32
+ def create
33
+ @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
34
+
35
+ @<%= orm_instance.save %>
36
+ respond_with(@<%= singular_table_name %>)
37
+ end
38
+
39
+ # PATCH/PUT <%= route_url %>/1
40
+ def update
41
+ @<%= orm_instance.update("#{singular_table_name}_params") %>
42
+ respond_with(@<%= singular_table_name %>)
43
+ end
44
+
45
+ # DELETE <%= route_url %>/1
46
+ def destroy
47
+ @<%= orm_instance.destroy %>
48
+ respond_with(@<%= singular_table_name %>)
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_<%= singular_table_name %>
54
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def <%= "#{singular_table_name}_params" %>
59
+ <%- if attributes_names.empty? -%>
60
+ params[:<%= singular_table_name %>]
61
+ <%- else -%>
62
+ params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
63
+ <%- end -%>
64
+ end
65
+ end
66
+ <% end -%>