edgarj 0.01.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +23 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/edgarj/base.js +49 -0
  6. data/app/assets/javascripts/edgarj/menu.js +39 -0
  7. data/app/assets/javascripts/edgarj/operator_selection.js +133 -0
  8. data/app/assets/stylesheets/edgarj/base.css +304 -0
  9. data/app/assets/stylesheets/edgarj/menu.css +65 -0
  10. data/app/controllers/edgarj/authentication_mixin.rb.sample +30 -0
  11. data/app/controllers/edgarj/controller_mixin_common.rb +80 -0
  12. data/app/controllers/edgarj/controller_mixin_for_app.rb +71 -0
  13. data/app/controllers/edgarj/edgarj_controller.rb +535 -0
  14. data/app/controllers/edgarj/model_permissions_controller.rb +8 -0
  15. data/app/controllers/edgarj/permission_mixin.rb +84 -0
  16. data/app/controllers/edgarj/popup_controller.rb +128 -0
  17. data/app/controllers/edgarj/rescue_mixin.rb +37 -0
  18. data/app/controllers/edgarj/user_group_users_controller.rb +8 -0
  19. data/app/controllers/edgarj/user_groups_controller.rb +9 -0
  20. data/app/controllers/edgarj/user_groups_popup_controller.rb +8 -0
  21. data/app/helpers/edgarj/assoc_helper.rb +369 -0
  22. data/app/helpers/edgarj/common_helper.rb +37 -0
  23. data/app/helpers/edgarj/edgarj_helper.rb +20 -0
  24. data/app/helpers/edgarj/field_helper.rb +397 -0
  25. data/app/helpers/edgarj/form_drawer.rb +322 -0
  26. data/app/helpers/edgarj/list_drawer.rb +169 -0
  27. data/app/helpers/edgarj/menu_helper.rb +92 -0
  28. data/app/helpers/edgarj/model_permissions_helper.rb +9 -0
  29. data/app/helpers/edgarj/popup_helper.rb +40 -0
  30. data/app/helpers/edgarj/search_helper.rb +14 -0
  31. data/app/helpers/edgarj/sessions_helper.rb +9 -0
  32. data/app/helpers/edgarj/user_group_users_helper.rb +9 -0
  33. data/app/helpers/edgarj/user_groups_helper.rb +9 -0
  34. data/app/helpers/edgarj/user_groups_popup_helper.rb +9 -0
  35. data/app/models/edgarj/drawer/base.rb +234 -0
  36. data/app/models/edgarj/drawer/normal.rb +6 -0
  37. data/app/models/edgarj/drawer/popup.rb +47 -0
  38. data/app/models/edgarj/drawer.rb +13 -0
  39. data/app/models/edgarj/model_permission.rb +41 -0
  40. data/app/models/edgarj/page_info.rb +47 -0
  41. data/app/models/edgarj/search.rb +81 -0
  42. data/app/models/edgarj/search_form.rb +255 -0
  43. data/app/models/edgarj/search_popup.rb +44 -0
  44. data/app/models/edgarj/sssn.rb +120 -0
  45. data/app/models/edgarj/user_group.rb +67 -0
  46. data/app/models/edgarj/user_group_user.rb +18 -0
  47. data/app/models/edgarj.rb +5 -0
  48. data/app/views/edgarj/edgarj/_form.html.erb +25 -0
  49. data/app/views/edgarj/edgarj/_list.html.erb +52 -0
  50. data/app/views/edgarj/edgarj/_message_popup.html.erb +15 -0
  51. data/app/views/edgarj/edgarj/_search_form.html.erb +64 -0
  52. data/app/views/edgarj/edgarj/_search_operator.html.erb +17 -0
  53. data/app/views/edgarj/edgarj/_search_operator_selection.html.erb +12 -0
  54. data/app/views/edgarj/edgarj/clear.js.erb +1 -0
  55. data/app/views/edgarj/edgarj/create.js.erb +4 -0
  56. data/app/views/edgarj/edgarj/destroy.js.erb +2 -0
  57. data/app/views/edgarj/edgarj/index.html.erb +37 -0
  58. data/app/views/edgarj/edgarj/index.js.erb +1 -0
  59. data/app/views/edgarj/edgarj/message_popup.js.erb +3 -0
  60. data/app/views/edgarj/edgarj/page_info_save.js.erb +1 -0
  61. data/app/views/edgarj/edgarj/search.js.erb +4 -0
  62. data/app/views/edgarj/edgarj/search_clear.js.erb +1 -0
  63. data/app/views/edgarj/edgarj/show.js.erb +1 -0
  64. data/app/views/edgarj/edgarj/top.html.erb +4 -0
  65. data/app/views/edgarj/edgarj/update.js.erb +4 -0
  66. data/app/views/edgarj/popup/_index.html.erb +16 -0
  67. data/app/views/edgarj/popup/_list.html.erb +42 -0
  68. data/app/views/edgarj/popup/_message_popup.html.erb +15 -0
  69. data/app/views/edgarj/popup/_search.html.erb +42 -0
  70. data/app/views/edgarj/popup/_search_save_popup.html.erb +16 -0
  71. data/app/views/edgarj/popup/index.js.erb +5 -0
  72. data/app/views/edgarj/popup/message_popup.js.erb +3 -0
  73. data/app/views/edgarj/popup/page_info_save.js.erb +1 -0
  74. data/app/views/edgarj/popup/search.js.erb +15 -0
  75. data/app/views/edgarj/popup/view_status_save.js.erb +1 -0
  76. data/config/routes.rb +15 -0
  77. data/config/settings.yml +5 -0
  78. data/db/migrate/20131118084600_create_edgar_sssns.rb +14 -0
  79. data/db/migrate/20131123124730_create_edgar_page_infos.rb +15 -0
  80. data/db/migrate/20140116062252_create_edgar_user_groups.rb +18 -0
  81. data/db/migrate/20140116062327_create_edgar_user_group_users.rb +10 -0
  82. data/db/migrate/20140206222308_create_edgar_model_permissions.rb +14 -0
  83. data/db/migrate/20141209053055_rename_edgar_to_edgarj.rb +17 -0
  84. data/lib/core_ext/active_record.rb +123 -0
  85. data/lib/core_ext/resources.rb +71 -0
  86. data/lib/edgarj/engine.rb +64 -0
  87. data/lib/edgarj/enum_cache.rb +46 -0
  88. data/lib/edgarj/templates/rails/helper/helper.rb +10 -0
  89. data/lib/edgarj/templates/test_unit/scaffold/functional_test.rb +575 -0
  90. data/lib/edgarj/version.rb +3 -0
  91. data/lib/edgarj.rb +14 -0
  92. data/lib/generators/edgarj/popup_scaffold/USAGE +6 -0
  93. data/lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb +35 -0
  94. data/lib/generators/edgarj/popup_scaffold/templates/controller.rb +13 -0
  95. data/lib/generators/edgarj/popup_scaffold/templates/functional_test.rb +197 -0
  96. data/lib/generators/edgarj/popup_scaffold/templates/helper.rb +9 -0
  97. data/lib/generators/edgarj/scaffold/USAGE +17 -0
  98. data/lib/generators/edgarj/scaffold/scaffold_generator.rb +40 -0
  99. data/lib/generators/edgarj/scaffold/templates/controller.rb +13 -0
  100. data/lib/tasks/edgarj_tasks.rake +32 -0
  101. data/lib/tasks/pakcage.rake +18 -0
  102. data/locale/en.yml +94 -0
  103. data/locale/ja.yml +100 -0
  104. data/test/dummy/README.rdoc +28 -0
  105. data/test/dummy/Rakefile +6 -0
  106. data/test/dummy/app/assets/javascripts/application.js +21 -0
  107. data/test/dummy/app/assets/javascripts/authors.js +2 -0
  108. data/test/dummy/app/assets/stylesheets/application.css +16 -0
  109. data/test/dummy/app/assets/stylesheets/authors.css +4 -0
  110. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  111. data/test/dummy/app/controllers/application_controller.rb +15 -0
  112. data/test/dummy/app/controllers/authors_controller.rb +6 -0
  113. data/test/dummy/app/controllers/authors_popup_controller.rb +6 -0
  114. data/test/dummy/app/controllers/books_controller.rb +6 -0
  115. data/test/dummy/app/controllers/dummy_auth_mixin.rb +36 -0
  116. data/test/dummy/app/decorators/models/edgarj/user_group_decorator.rb +1 -0
  117. data/test/dummy/app/helpers/application_helper.rb +3 -0
  118. data/test/dummy/app/helpers/authors_helper.rb +7 -0
  119. data/test/dummy/app/helpers/authors_popup_helper.rb +7 -0
  120. data/test/dummy/app/helpers/books_helper.rb +7 -0
  121. data/test/dummy/app/models/author.rb +32 -0
  122. data/test/dummy/app/models/book.rb +5 -0
  123. data/test/dummy/app/models/user.rb +13 -0
  124. data/test/dummy/app/views/layouts/application.html.erb +32 -0
  125. data/test/dummy/app/views/layouts/login.html.erb +20 -0
  126. data/test/dummy/bin/bundle +3 -0
  127. data/test/dummy/bin/rails +4 -0
  128. data/test/dummy/bin/rake +4 -0
  129. data/test/dummy/config/application.rb +59 -0
  130. data/test/dummy/config/boot.rb +10 -0
  131. data/test/dummy/config/database.yml +15 -0
  132. data/test/dummy/config/edgarj/menu_config.rb +28 -0
  133. data/test/dummy/config/environment.rb +5 -0
  134. data/test/dummy/config/environments/development.rb +42 -0
  135. data/test/dummy/config/environments/production.rb +79 -0
  136. data/test/dummy/config/environments/test.rb +34 -0
  137. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  138. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  139. data/test/dummy/config/initializers/inflections.rb +16 -0
  140. data/test/dummy/config/initializers/mime_types.rb +5 -0
  141. data/test/dummy/config/initializers/secret_token.rb +12 -0
  142. data/test/dummy/config/initializers/session_store.rb +3 -0
  143. data/test/dummy/config/initializers/strong_parameter.rb +3 -0
  144. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  145. data/test/dummy/config/locales/en.yml +26 -0
  146. data/test/dummy/config/routes.rb +60 -0
  147. data/test/dummy/config.ru +4 -0
  148. data/test/dummy/db/migrate/20131107120635_create_authors.rb +9 -0
  149. data/test/dummy/db/migrate/20131218011851_create_books.rb +10 -0
  150. data/test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb +5 -0
  151. data/test/dummy/db/migrate/20140807065420_create_users.rb +10 -0
  152. data/test/dummy/db/schema.rb +93 -0
  153. data/test/dummy/public/404.html +58 -0
  154. data/test/dummy/public/422.html +58 -0
  155. data/test/dummy/public/500.html +57 -0
  156. data/test/dummy/public/favicon.ico +0 -0
  157. data/test/dummy/script/rails +6 -0
  158. data/test/dummy/test/functional/authors_controller_test.rb +631 -0
  159. data/test/dummy/test/functional/books_controller_test.rb +516 -0
  160. data/test/dummy/test/helpers/authors_helper_test.rb +4 -0
  161. data/test/dummy/test/unit/author_test.rb +7 -0
  162. data/test/dummy/test/unit/book_test.rb +7 -0
  163. data/test/edgar_test.rb +7 -0
  164. data/test/fixtures/authors.yml +32 -0
  165. data/test/fixtures/books.yml +56 -0
  166. data/test/fixtures/edgarj/model_permissions.yml +97 -0
  167. data/test/fixtures/edgarj/page_infos.yml +84 -0
  168. data/test/fixtures/edgarj/sssns.yml +38 -0
  169. data/test/fixtures/edgarj/user_group_users.yml +114 -0
  170. data/test/fixtures/edgarj/user_groups.yml +95 -0
  171. data/test/fixtures/users.yml +49 -0
  172. data/test/functional/edgarj/edgarj_controller_test.rb +24 -0
  173. data/test/functional/edgarj/model_permissions_controller_test.rb +554 -0
  174. data/test/functional/edgarj/user_group_users_controller_test.rb +567 -0
  175. data/test/integration/navigation_test.rb +10 -0
  176. data/test/support/edgarj/controller_supporter.rb +23 -0
  177. data/test/test_helper.rb +23 -0
  178. data/test/unit/edgarj/model_permission_test.rb +27 -0
  179. data/test/unit/edgarj/page_info_test.rb +7 -0
  180. data/test/unit/edgarj/sssn_test.rb +10 -0
  181. data/test/unit/edgarj/user_group_test.rb +32 -0
  182. data/test/unit/edgarj/user_group_user_test.rb +9 -0
  183. data/test/unit/helpers/edgarj/model_permissions_helper_test.rb +6 -0
  184. data/test/unit/helpers/edgarj/user_group_users_helper_test.rb +6 -0
  185. metadata +456 -0
@@ -0,0 +1,97 @@
1
+ <%
2
+ f = Edgarj::ModelPermission::FlagsBitset
3
+ %>
4
+
5
+ product_read_only:
6
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_product_read_only) %>
7
+ name: 'product read only'
8
+ model: Product
9
+ flags: <%= f::READ %>
10
+
11
+ customer_read_update:
12
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_customer_read_update) %>
13
+ name: 'customer read/update'
14
+ model: Customer
15
+ flags: <%= f::READ + f::UPDATE %>
16
+
17
+ album_viewer:
18
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_album_viewer) %>
19
+ name: 'album viewr'
20
+ model: Album::Viewer
21
+ flags: <%= f::READ %>
22
+
23
+ #= Question
24
+
25
+ question_admin:
26
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_question_admin) %>
27
+ name: 'question admin'
28
+ model: Question
29
+ flags: <%= Edgarj::ModelPermission::FLAGS_ALL %>
30
+
31
+ question_forwarder:
32
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_question_forwarder) %>
33
+ name: 'question forwarder'
34
+ model: Question
35
+ flags: <%= f::READ %>
36
+
37
+ question_user:
38
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_question_user) %>
39
+ name: 'question user'
40
+ model: Question
41
+ flags: <%= f::READ %>
42
+
43
+ #= Book
44
+
45
+ book_admin:
46
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_book_admin) %>
47
+ name: 'book admin'
48
+ model: Book
49
+ flags: <%= Edgarj::ModelPermission::FLAGS_ALL %>
50
+
51
+ book_admin_author_popup:
52
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_book_admin) %>
53
+ name: 'author popup for book admin'
54
+ model: Author
55
+ flags: <%= f::READ %>
56
+
57
+ book_reader:
58
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_book_reader) %>
59
+ name: 'book reader'
60
+ model: Book
61
+ flags: <%= f::READ %>
62
+
63
+ # book_reader does *NOT* have author-popup read permission.
64
+
65
+ book_updater:
66
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_book_updater) %>
67
+ name: 'book updater'
68
+ model: Book
69
+ flags: <%= f::READ + f::UPDATE %>
70
+
71
+ book_updater_author_popup:
72
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_book_updater) %>
73
+ name: 'author popup for book updater'
74
+ model: Author
75
+ flags: <%= f::READ %>
76
+
77
+ #= Author
78
+
79
+ author_admin:
80
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_author_admin) %>
81
+ name: 'author admin'
82
+ model: Author
83
+ flags: <%= Edgarj::ModelPermission::FLAGS_ALL %>
84
+
85
+ author_reader:
86
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_author_reader) %>
87
+ name: 'author reader'
88
+ model: Author
89
+ flags: <%= f::READ %>
90
+
91
+ #= Author-assignee
92
+
93
+ author_assignee_author_page:
94
+ user_group_id: <%= ActiveRecord::Fixtures.identify(:role_author_assignee_author_page) %>
95
+ name: 'author assignee'
96
+ model: Author
97
+ flags: <%= f::CREATE + f::READ + f::UPDATE + f::DELETE %>
@@ -0,0 +1,84 @@
1
+ root_zip_address:
2
+ sssn: root
3
+ view: edgarj/zip_address
4
+ lines: 5
5
+ order_by: created_at
6
+ dir: desc
7
+ page: 33
8
+ #record_data: '[%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Edgarj::ZipAddress))) %]'
9
+ record_data: '<%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Edgarj::Sssn))) %>'
10
+ created_at: 2012-07-17 00:00:00
11
+ updated_at: 2012-07-17 00:00:00
12
+
13
+ #---------------------------------------------------------
14
+ # Dummy App specific PageInfo
15
+ #---------------------------------------------------------
16
+ <% if File.exist?(Rails.root + 'app/models/author.rb') %>
17
+ root_authors:
18
+ sssn: root
19
+ view: authors
20
+ order_by:
21
+ dir:
22
+ page: 1
23
+ lines: 10
24
+ record_data: '<%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Author))) %>'
25
+
26
+ book_reader_authors:
27
+ sssn_id: <%= ActiveRecord::Fixtures.identify(:book_reader) %>
28
+ view: authors
29
+ lines: 2
30
+ order_by: id
31
+ dir: desc
32
+ page: 2
33
+ created_at: 2012-07-17 00:00:00
34
+ updated_at: 2012-07-17 00:00:00
35
+
36
+ author_reader_authors:
37
+ sssn_id: <%= ActiveRecord::Fixtures.identify(:author_reader) %>
38
+ view: authors
39
+ lines: 2
40
+ order_by: updated_at
41
+ dir: desc
42
+ page: 100
43
+ created_at: 2012-07-17 00:00:00
44
+ updated_at: 2012-07-17 00:00:00
45
+
46
+ comic_rep_01_authors:
47
+ sssn_id: <%= ActiveRecord::Fixtures.identify(:comic_rep_01) %>
48
+ view: authors
49
+ lines: 2
50
+ order_by: updated_at
51
+ dir: desc
52
+ page: 100
53
+ created_at: 2012-07-17 00:00:00
54
+ updated_at: 2012-07-17 00:00:00
55
+ <% end %>
56
+
57
+ <% if File.exist?(Rails.root + 'app/models/book.rb') %>
58
+ root_books:
59
+ sssn: root
60
+ view: books
61
+ order_by:
62
+ dir:
63
+ page: 1
64
+ lines: 10
65
+ record_data: '<%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Book))) %>'
66
+
67
+ book_reader_books:
68
+ sssn: book_reader
69
+ view: books
70
+ lines: 2
71
+ order_by: id
72
+ dir: desc
73
+ page: 2
74
+ record_data: '<%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Book))) %>'
75
+
76
+ comic_rep_01_books:
77
+ sssn: comic_rep_01
78
+ view: books
79
+ lines: 2
80
+ order_by: id
81
+ dir: desc
82
+ page: 2
83
+ record_data: '<%= Base64.encode64(Marshal.dump(Edgarj::SearchForm.new(Book))) %>'
84
+ <% end %>
@@ -0,0 +1,38 @@
1
+ root:
2
+ user_id: <%= Edgarj::label('root') %>
3
+ session_id: session_id_root
4
+ created_at: 2012-07-18 00:00:00
5
+ updated_at: 2012-07-18 00:00:00
6
+
7
+ not_permitted:
8
+ user_id: <%= Edgarj::label('not_permitted') %>
9
+ session_id: session_id_not_permitted
10
+ created_at: 2012-07-18 00:00:00
11
+ updated_at: 2012-07-18 00:00:00
12
+
13
+ user_group_user_reader:
14
+ user_id: <%= Edgarj::label('user_group_user_reader') %>
15
+ session_id: session_id_user_group_user_reader
16
+ created_at: 2014-08-28 00:00:00
17
+ updated_at: 2014-08-28 00:00:00
18
+
19
+ #---------------------------------------------------------
20
+ # Dummy App specific session
21
+ #---------------------------------------------------------
22
+ book_reader:
23
+ user_id: <%= Edgarj::label('book_reader') %>
24
+ session_id: session_id_book_reader
25
+ created_at: 2012-07-18 00:00:00
26
+ updated_at: 2012-07-18 00:00:00
27
+
28
+ author_reader:
29
+ user_id: <%= Edgarj::label('author_reader') %>
30
+ session_id: session_id_author_reader
31
+ created_at: 2012-07-18 00:00:00
32
+ updated_at: 2012-07-18 00:00:00
33
+
34
+ comic_rep_01:
35
+ user_id: <%= Edgarj::label('comic_rep_01') %>
36
+ session_id: session_id_comic_rep_01
37
+ created_at: 2012-07-18 00:00:00
38
+ updated_at: 2012-07-18 00:00:00
@@ -0,0 +1,114 @@
1
+ role_admin:
2
+ user_group: role_admin
3
+ user: root
4
+
5
+ role_edgarj_zip_address_reader:
6
+ user_group: role_edgarj_zip_address_reader
7
+ user: edgarj_zip_address_reader
8
+
9
+ role_user_group_user_reader:
10
+ user_group_id: <%= Edgarj::label('role_user_group_user_reader') %>
11
+ user_id: <%= Edgarj::label('user_group_user_reader') %>
12
+
13
+ #---------------------------------------------------------
14
+ # Dummy App specific role assignments
15
+ #---------------------------------------------------------
16
+ role_product_read_only:
17
+ user_group: role_product_read_only
18
+ user_id: 2
19
+
20
+ role_product_read_only2:
21
+ user_group: role_product_read_only
22
+ user_id: 3
23
+
24
+ role_customer_read_update:
25
+ user_group: role_customer_read_update
26
+ user_id: 2
27
+
28
+ role_album_viewer_album_reader:
29
+ user_group: role_album_viewer
30
+ user_id: 4
31
+
32
+ role_question_admin_1:
33
+ user_group: role_question_admin
34
+ user_id: 6
35
+
36
+ role_question_forwarder_1:
37
+ user_group: role_question_forwarder
38
+ user_id: 7
39
+
40
+ role_question_user_1:
41
+ user_group: role_question_user
42
+ user_id: 8
43
+
44
+ role_book_admin:
45
+ user_group: role_book_admin
46
+ user: book_admin
47
+
48
+ role_book_admin_on_guest:
49
+ user_group: role_book_admin
50
+ user: guest
51
+
52
+ role_book_reader:
53
+ user_group: role_book_reader
54
+ user: book_reader
55
+
56
+ role_book_updater:
57
+ user_group: role_book_updater
58
+ user: book_updater
59
+
60
+ role_author_admin_on_guest:
61
+ user_group: role_author_admin
62
+ user: guest
63
+
64
+ role_author_reader:
65
+ user_group: role_author_reader
66
+ user: author_reader
67
+
68
+ role_author_assignee_author_page:
69
+ user_group: role_author_assignee_author_page
70
+ user: comic_rep_01
71
+
72
+
73
+ #-------------------------------------------------
74
+ # Org starts here.
75
+ #-------------------------------------------------
76
+
77
+ user_org_top_root:
78
+ user_group: user_org_top
79
+ user: root
80
+
81
+ user_org_top_question_forwarder:
82
+ user_group: user_org_top
83
+ user_id: 7
84
+
85
+ user_org_sales_root:
86
+ user_group: user_org_sales
87
+ user: root
88
+
89
+ user_org_sales_aaron:
90
+ user_group: user_org_sales
91
+ user_id: 2
92
+
93
+ user_org_sales_wells:
94
+ user_group: user_org_sales
95
+ user_id: 5
96
+
97
+ user_org_sales_question_user:
98
+ user_group: user_org_sales
99
+ user_id: 8
100
+
101
+ #-------------------------------------------------
102
+ # AUTHOR_ASSIGNEE starts here.
103
+ #-------------------------------------------------
104
+ author_assignee_comic_rep_01:
105
+ user_group: author_assignee_comic_rep
106
+ user: comic_rep_01
107
+
108
+ author_assignee_book_admin:
109
+ user_group: author_assignee_comic_rep
110
+ user: book_admin
111
+
112
+ author_assignee_comic_rep_02:
113
+ user_group: author_assignee_comic_rep
114
+ user: comic_rep_02
@@ -0,0 +1,95 @@
1
+ role_admin:
2
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
3
+ name: admin
4
+
5
+ role_edgarj_zip_address_reader:
6
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
7
+ name: edgarj_zip_address_reader
8
+
9
+ role_user_group_user_reader:
10
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
11
+ name: user_group_user_reader
12
+
13
+ #---------------------------------------------------------
14
+ # Dummy App specific roles
15
+ #---------------------------------------------------------
16
+ role_product_read_only:
17
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
18
+ name: product_read_only
19
+
20
+ role_customer_read_update:
21
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
22
+ name: customer_read_update
23
+
24
+ role_album_viewer:
25
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
26
+ name: 'album/viewer'
27
+
28
+ role_question_admin:
29
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
30
+ name: 'question/admin'
31
+
32
+ role_question_forwarder:
33
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
34
+ name: 'question/forwarder'
35
+
36
+ role_question_user:
37
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
38
+ name: 'question/user'
39
+
40
+ role_book_admin:
41
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
42
+ name: 'book/admin'
43
+
44
+ role_book_reader:
45
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
46
+ name: 'book/reader'
47
+
48
+ role_book_updater:
49
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
50
+ name: 'book/updater'
51
+
52
+ role_author_reader:
53
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
54
+ name: 'author/reader'
55
+
56
+ role_author_admin:
57
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
58
+ name: 'author/admin'
59
+
60
+ # author_assignee can access author-page and book page
61
+ # with limited scope + create/read/update only (no delete)
62
+ role_author_assignee_author_page:
63
+ kind: <%= Edgarj::UserGroup::Kind::ROLE %>
64
+ name: 'author_assignee'
65
+
66
+ #-------------------------------------------------
67
+ # Org starts here.
68
+ #-------------------------------------------------
69
+
70
+ user_org_top:
71
+ kind: <%= Edgarj::UserGroup::Kind::USER_ORG %>
72
+ name: Top
73
+
74
+ user_org_sales:
75
+ kind: <%= Edgarj::UserGroup::Kind::USER_ORG %>
76
+ name: Sales
77
+
78
+ #-------------------------------------------------
79
+ # AUTHOR_ASSIGNEE starts here.
80
+ #
81
+ # NOTE: AUTHOR_ASSIGNEE is additional value of 'kind' column
82
+ # just for test/dummy app. It is required to define here
83
+ # for test of Edgarj engine, but is *NOT* required for external
84
+ # application (e.g. MyApp) test with this. That's why if-statement
85
+ # exists here.
86
+ #-------------------------------------------------
87
+ <% if Edgarj::UserGroup::Kind.const_defined?(:AUTHOR_ASSIGNEE) %>
88
+ author_assignee_comic_rep:
89
+ kind: <%= Edgarj::UserGroup::Kind::AUTHOR_ASSIGNEE %>
90
+ name: Comic Rep
91
+
92
+ author_assignee_science_rep:
93
+ kind: <%= Edgarj::UserGroup::Kind::AUTHOR_ASSIGNEE %>
94
+ name: Sicence Rep
95
+ <% end %>
@@ -0,0 +1,49 @@
1
+ root:
2
+ name: root
3
+ code: root
4
+
5
+ not_permitted:
6
+ name: not_permitted
7
+ code: not_permitted
8
+
9
+ edgarj_zip_address_reader:
10
+ name: Edgarj::ZipAddress Reader
11
+ code: edgarj_zip_address_reader
12
+
13
+ user_group_user_reader:
14
+ name: user_group_user_reader
15
+ code: user_group_user_reader
16
+
17
+ #---------------------------------------------------------
18
+ # Dummy App specific users
19
+ #---------------------------------------------------------
20
+ book_admin:
21
+ name: Book Admin
22
+ code: book_admin
23
+
24
+ book_reader:
25
+ name: Book Reader
26
+ code: book_reader
27
+
28
+ book_updater:
29
+ name: Book Updater
30
+ code: book_updater
31
+
32
+ author_reader:
33
+ name: Author Reader
34
+ code: author_reader
35
+
36
+ comic_rep_01:
37
+ name: Comic Rep 01
38
+ code: comic_rep_01
39
+
40
+ comic_rep_02:
41
+ name: Comic Rep 02
42
+ code: comic_rep_02
43
+
44
+ # 'guest' user is an admin on only author and book, not edgarj*.
45
+ # Same as test/dummy/db/seeds.rb, which is for demo site, and
46
+ # fixture here is for development.
47
+ guest:
48
+ name: Guest User
49
+ code: guest
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ module Edgarj
4
+ class EdgarjControllerTest < ActionController::TestCase
5
+ context 'login' do
6
+ setup do
7
+ login_as(:root)
8
+ end
9
+
10
+ should 'get top' do
11
+ get :top
12
+ assert_response :success
13
+ assert_template 'edgarj/top'
14
+ end
15
+ end
16
+
17
+ context 'not-login' do
18
+ should 'redirect to login page' do
19
+ get :top
20
+ assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
21
+ end
22
+ end
23
+ end
24
+ end