arcadex 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/db/migrate/20141020173616_add_max_uses_to_arcadex_tokens.rb +5 -0
  3. data/lib/arcadex/authentication.rb +45 -51
  4. data/lib/arcadex/create.rb +2 -1
  5. data/lib/arcadex/header.rb +8 -21
  6. data/lib/arcadex/version.rb +1 -1
  7. data/test/dummy/db/development.sqlite3 +0 -0
  8. data/test/dummy/db/schema.rb +2 -1
  9. data/test/dummy/db/test.sqlite3 +0 -0
  10. data/test/dummy/log/development.log +15 -0
  11. data/test/dummy/log/test.log +35 -0
  12. data/test/test_app/Gemfile +77 -0
  13. data/test/test_app/Gemfile.lock +281 -0
  14. data/test/test_app/README.md +1 -0
  15. data/test/test_app/Rakefile +6 -0
  16. data/test/test_app/app/admin/arcadex_token.rb +94 -0
  17. data/test/test_app/app/admin/dashboard.rb +69 -0
  18. data/test/test_app/app/admin/defcon_admin_user.rb +99 -0
  19. data/test/test_app/app/admin/people_user.rb +83 -0
  20. data/test/test_app/app/assets/javascripts/active_admin.js.coffee +1 -0
  21. data/test/test_app/app/assets/javascripts/application.js +16 -0
  22. data/test/test_app/app/assets/stylesheets/active_admin.css.scss +17 -0
  23. data/test/test_app/app/assets/stylesheets/application.css +13 -0
  24. data/test/test_app/app/controllers/api/v1/api_controller.rb +71 -0
  25. data/test/test_app/app/controllers/app_index_controller.rb +4 -0
  26. data/test/test_app/app/controllers/application_controller.rb +21 -0
  27. data/test/test_app/app/helpers/application_helper.rb +2 -0
  28. data/test/test_app/app/views/app_index/app.html.erb +0 -0
  29. data/test/test_app/app/views/layouts/app_index.html.erb +9 -0
  30. data/test/test_app/app/views/layouts/application.html.erb +14 -0
  31. data/test/test_app/bin/bundle +3 -0
  32. data/test/test_app/bin/rails +4 -0
  33. data/test/test_app/bin/rake +4 -0
  34. data/test/test_app/config.ru +4 -0
  35. data/test/test_app/config/application.rb +27 -0
  36. data/test/test_app/config/boot.rb +4 -0
  37. data/test/test_app/config/database.yml +25 -0
  38. data/test/test_app/config/environment.rb +5 -0
  39. data/test/test_app/config/environments/development.rb +29 -0
  40. data/test/test_app/config/environments/production.rb +80 -0
  41. data/test/test_app/config/environments/test.rb +36 -0
  42. data/test/test_app/config/initializers/active_admin.rb +252 -0
  43. data/test/test_app/config/initializers/backtrace_silencers.rb +7 -0
  44. data/test/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/test/test_app/config/initializers/inflections.rb +16 -0
  46. data/test/test_app/config/initializers/mime_types.rb +5 -0
  47. data/test/test_app/config/initializers/secret_token.rb +12 -0
  48. data/test/test_app/config/initializers/session_store.rb +3 -0
  49. data/test/test_app/config/initializers/wrap_parameters.rb +14 -0
  50. data/test/test_app/config/locales/en.yml +23 -0
  51. data/test/test_app/config/routes.rb +66 -0
  52. data/test/test_app/config/schedule.rb +20 -0
  53. data/test/test_app/db/development.sqlite3 +0 -0
  54. data/test/test_app/db/migrate/20141016225515_create_active_admin_comments.rb +19 -0
  55. data/test/test_app/db/migrate/20141016225555_create_people_users.people.rb +14 -0
  56. data/test/test_app/db/migrate/20141016225556_create_arcadex_tokens.arcadex.rb +12 -0
  57. data/test/test_app/db/migrate/20141016225557_add_index_to_token.arcadex.rb +6 -0
  58. data/test/test_app/db/migrate/20141016225558_add_first_ip_address_to_arcadex_tokens.arcadex.rb +6 -0
  59. data/test/test_app/db/migrate/20141016225559_add_current_ip_address_to_arcadex_tokens.arcadex.rb +6 -0
  60. data/test/test_app/db/migrate/20141016225560_add_times_used_to_arcadex_tokens.arcadex.rb +6 -0
  61. data/test/test_app/db/migrate/20141016225561_add_expiration_minutes_to_arcadex_tokens.arcadex.rb +6 -0
  62. data/test/test_app/db/migrate/20141016225562_create_defcon_admin_users.defcon.rb +16 -0
  63. data/test/test_app/db/migrate/20141016225563_add_index_to_defcon_admin_users.defcon.rb +6 -0
  64. data/test/test_app/db/migrate/20141016225564_add_email_to_defcon_admin_users.defcon.rb +7 -0
  65. data/test/test_app/db/migrate/20141020173805_add_max_uses_to_arcadex_tokens.arcadex.rb +6 -0
  66. data/test/test_app/db/production.sqlite3 +0 -0
  67. data/test/test_app/db/schema.rb +73 -0
  68. data/test/test_app/db/seeds.rb +10 -0
  69. data/test/test_app/db/test.sqlite3 +0 -0
  70. data/test/test_app/engines/people/Gemfile +14 -0
  71. data/test/test_app/engines/people/Gemfile.lock +81 -0
  72. data/test/test_app/engines/people/MIT-LICENSE +20 -0
  73. data/test/test_app/engines/people/README.md +1 -0
  74. data/test/test_app/engines/people/Rakefile +34 -0
  75. data/test/test_app/engines/people/app/assets/javascripts/people/application.js +13 -0
  76. data/test/test_app/engines/people/app/assets/javascripts/people/users.js +2 -0
  77. data/test/test_app/engines/people/app/assets/stylesheets/people/application.css +13 -0
  78. data/test/test_app/engines/people/app/assets/stylesheets/people/users.css +4 -0
  79. data/test/test_app/engines/people/app/assets/stylesheets/scaffold.css +56 -0
  80. data/test/test_app/engines/people/app/controllers/people/api/v1/application_controller.rb +5 -0
  81. data/test/test_app/engines/people/app/controllers/people/api/v1/users_controller.rb +169 -0
  82. data/test/test_app/engines/people/app/controllers/people/application_controller.rb +4 -0
  83. data/test/test_app/engines/people/app/controllers/people/users_controller.rb +62 -0
  84. data/test/test_app/engines/people/app/helpers/people/application_helper.rb +4 -0
  85. data/test/test_app/engines/people/app/helpers/people/users_helper.rb +4 -0
  86. data/test/test_app/engines/people/app/models/people/user.rb +9 -0
  87. data/test/test_app/engines/people/app/models/people/v1/user.rb +32 -0
  88. data/test/test_app/engines/people/app/serializers/people/v1/user_serializer.rb +43 -0
  89. data/test/test_app/engines/people/app/views/layouts/people/default/application.html.erb +14 -0
  90. data/test/test_app/engines/people/app/views/people/users/_form.html.erb +29 -0
  91. data/test/test_app/engines/people/app/views/people/users/edit.html.erb +6 -0
  92. data/test/test_app/engines/people/app/views/people/users/index.html.erb +31 -0
  93. data/test/test_app/engines/people/app/views/people/users/new.html.erb +5 -0
  94. data/test/test_app/engines/people/app/views/people/users/show.html.erb +19 -0
  95. data/test/test_app/engines/people/bin/rails +12 -0
  96. data/test/test_app/engines/people/config/routes.rb +28 -0
  97. data/test/test_app/engines/people/db/migrate/20141016225548_create_people_users.rb +13 -0
  98. data/test/test_app/engines/people/lib/people.rb +4 -0
  99. data/test/test_app/engines/people/lib/people/engine.rb +5 -0
  100. data/test/test_app/engines/people/lib/people/version.rb +3 -0
  101. data/test/test_app/engines/people/lib/tasks/people_tasks.rake +4 -0
  102. data/test/test_app/engines/people/people.gemspec +33 -0
  103. data/test/test_app/engines/people/test/controllers/people/users_controller_test.rb +51 -0
  104. data/test/test_app/engines/people/test/dummy/README.rdoc +28 -0
  105. data/test/test_app/engines/people/test/dummy/Rakefile +6 -0
  106. data/test/test_app/engines/people/test/dummy/app/assets/javascripts/application.js +13 -0
  107. data/test/test_app/engines/people/test/dummy/app/assets/stylesheets/application.css +13 -0
  108. data/test/test_app/engines/people/test/dummy/app/controllers/application_controller.rb +5 -0
  109. data/test/test_app/engines/people/test/dummy/app/helpers/application_helper.rb +2 -0
  110. data/test/test_app/engines/people/test/dummy/app/views/layouts/application.html.erb +14 -0
  111. data/test/test_app/engines/people/test/dummy/bin/bundle +3 -0
  112. data/test/test_app/engines/people/test/dummy/bin/rails +4 -0
  113. data/test/test_app/engines/people/test/dummy/bin/rake +4 -0
  114. data/test/test_app/engines/people/test/dummy/config.ru +4 -0
  115. data/test/test_app/engines/people/test/dummy/config/application.rb +23 -0
  116. data/test/test_app/engines/people/test/dummy/config/boot.rb +5 -0
  117. data/test/test_app/engines/people/test/dummy/config/database.yml +25 -0
  118. data/test/test_app/engines/people/test/dummy/config/environment.rb +5 -0
  119. data/test/test_app/engines/people/test/dummy/config/environments/development.rb +29 -0
  120. data/test/test_app/engines/people/test/dummy/config/environments/production.rb +80 -0
  121. data/test/test_app/engines/people/test/dummy/config/environments/test.rb +36 -0
  122. data/test/test_app/engines/people/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  123. data/test/test_app/engines/people/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  124. data/test/test_app/engines/people/test/dummy/config/initializers/inflections.rb +16 -0
  125. data/test/test_app/engines/people/test/dummy/config/initializers/mime_types.rb +5 -0
  126. data/test/test_app/engines/people/test/dummy/config/initializers/secret_token.rb +12 -0
  127. data/test/test_app/engines/people/test/dummy/config/initializers/session_store.rb +3 -0
  128. data/test/test_app/engines/people/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  129. data/test/test_app/engines/people/test/dummy/config/locales/en.yml +23 -0
  130. data/test/test_app/engines/people/test/dummy/config/routes.rb +4 -0
  131. data/test/test_app/engines/people/test/dummy/public/404.html +58 -0
  132. data/test/test_app/engines/people/test/dummy/public/422.html +58 -0
  133. data/test/test_app/engines/people/test/dummy/public/500.html +57 -0
  134. data/test/test_app/engines/people/test/dummy/public/favicon.ico +0 -0
  135. data/test/test_app/engines/people/test/fixtures/people/users.yml +11 -0
  136. data/test/test_app/engines/people/test/helpers/people/users_helper_test.rb +6 -0
  137. data/test/test_app/engines/people/test/integration/navigation_test.rb +10 -0
  138. data/test/test_app/engines/people/test/models/people/user_test.rb +9 -0
  139. data/test/test_app/engines/people/test/people_test.rb +7 -0
  140. data/test/test_app/engines/people/test/test_helper.rb +15 -0
  141. data/test/test_app/gems/authorization/Gemfile +14 -0
  142. data/test/test_app/gems/authorization/Gemfile.lock +81 -0
  143. data/test/test_app/gems/authorization/MIT-LICENSE +20 -0
  144. data/test/test_app/gems/authorization/README.rdoc +3 -0
  145. data/test/test_app/gems/authorization/Rakefile +32 -0
  146. data/test/test_app/gems/authorization/authorization.gemspec +22 -0
  147. data/test/test_app/gems/authorization/lib/authorization.rb +4 -0
  148. data/test/test_app/gems/authorization/lib/authorization/people/v1/user.rb +90 -0
  149. data/test/test_app/gems/authorization/lib/authorization/version.rb +3 -0
  150. data/test/test_app/gems/authorization/lib/tasks/authorization_tasks.rake +4 -0
  151. data/test/test_app/gems/authorization/test/authorization_test.rb +7 -0
  152. data/test/test_app/gems/authorization/test/dummy/README.rdoc +28 -0
  153. data/test/test_app/gems/authorization/test/dummy/Rakefile +6 -0
  154. data/test/test_app/gems/authorization/test/dummy/app/assets/javascripts/application.js +13 -0
  155. data/test/test_app/gems/authorization/test/dummy/app/assets/stylesheets/application.css +13 -0
  156. data/test/test_app/gems/authorization/test/dummy/app/controllers/application_controller.rb +5 -0
  157. data/test/test_app/gems/authorization/test/dummy/app/helpers/application_helper.rb +2 -0
  158. data/test/test_app/gems/authorization/test/dummy/app/views/layouts/application.html.erb +14 -0
  159. data/test/test_app/gems/authorization/test/dummy/bin/bundle +3 -0
  160. data/test/test_app/gems/authorization/test/dummy/bin/rails +4 -0
  161. data/test/test_app/gems/authorization/test/dummy/bin/rake +4 -0
  162. data/test/test_app/gems/authorization/test/dummy/config.ru +4 -0
  163. data/test/test_app/gems/authorization/test/dummy/config/application.rb +23 -0
  164. data/test/test_app/gems/authorization/test/dummy/config/boot.rb +5 -0
  165. data/test/test_app/gems/authorization/test/dummy/config/database.yml +25 -0
  166. data/test/test_app/gems/authorization/test/dummy/config/environment.rb +5 -0
  167. data/test/test_app/gems/authorization/test/dummy/config/environments/development.rb +29 -0
  168. data/test/test_app/gems/authorization/test/dummy/config/environments/production.rb +80 -0
  169. data/test/test_app/gems/authorization/test/dummy/config/environments/test.rb +36 -0
  170. data/test/test_app/gems/authorization/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  171. data/test/test_app/gems/authorization/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  172. data/test/test_app/gems/authorization/test/dummy/config/initializers/inflections.rb +16 -0
  173. data/test/test_app/gems/authorization/test/dummy/config/initializers/mime_types.rb +5 -0
  174. data/test/test_app/gems/authorization/test/dummy/config/initializers/secret_token.rb +12 -0
  175. data/test/test_app/gems/authorization/test/dummy/config/initializers/session_store.rb +3 -0
  176. data/test/test_app/gems/authorization/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  177. data/test/test_app/gems/authorization/test/dummy/config/locales/en.yml +23 -0
  178. data/test/test_app/gems/authorization/test/dummy/config/routes.rb +56 -0
  179. data/test/test_app/gems/authorization/test/dummy/public/404.html +58 -0
  180. data/test/test_app/gems/authorization/test/dummy/public/422.html +58 -0
  181. data/test/test_app/gems/authorization/test/dummy/public/500.html +57 -0
  182. data/test/test_app/gems/authorization/test/dummy/public/favicon.ico +0 -0
  183. data/test/test_app/gems/authorization/test/test_helper.rb +15 -0
  184. data/test/test_app/log/development.log +79 -0
  185. data/test/test_app/log/production.log +12 -0
  186. data/test/test_app/log/test.log +13884 -0
  187. data/test/test_app/public/404.html +58 -0
  188. data/test/test_app/public/422.html +58 -0
  189. data/test/test_app/public/500.html +57 -0
  190. data/test/test_app/public/favicon.ico +0 -0
  191. data/test/test_app/public/robots.txt +5 -0
  192. data/test/test_app/spec/controllers/app_index_controller_spec.rb +12 -0
  193. data/test/test_app/spec/engines/people/api/v1/models/user_spec.rb +61 -0
  194. data/test/test_app/spec/engines/people/api/v1/requests/user_spec.rb +244 -0
  195. data/test/test_app/spec/engines/people/api/v1/routing/user_spec.rb +91 -0
  196. data/test/test_app/spec/factories/people_user_1_factory.rb +14 -0
  197. data/test/test_app/spec/rails_helper.rb +47 -0
  198. data/test/test_app/spec/spec_helper.rb +78 -0
  199. data/test/test_app/spec/support/factory_girl.rb +16 -0
  200. data/test/test_app/spec/support/request_helpers.rb +7 -0
  201. metadata +381 -2
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ username: MyString
5
+ email: MyString
6
+ password_digest: MyString
7
+
8
+ two:
9
+ username: MyString
10
+ email: MyString
11
+ password_digest: MyString
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module People
4
+ class UsersHelperTest < ActionView::TestCase
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module People
4
+ class UserTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PeopleTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, People
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in authorization.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ authorization (0.0.1)
5
+ rails (~> 4.0.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.0.10)
11
+ actionpack (= 4.0.10)
12
+ mail (~> 2.5, >= 2.5.4)
13
+ actionpack (4.0.10)
14
+ activesupport (= 4.0.10)
15
+ builder (~> 3.1.0)
16
+ erubis (~> 2.7.0)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ activemodel (4.0.10)
20
+ activesupport (= 4.0.10)
21
+ builder (~> 3.1.0)
22
+ activerecord (4.0.10)
23
+ activemodel (= 4.0.10)
24
+ activerecord-deprecated_finders (~> 1.0.2)
25
+ activesupport (= 4.0.10)
26
+ arel (~> 4.0.0)
27
+ activerecord-deprecated_finders (1.0.3)
28
+ activesupport (4.0.10)
29
+ i18n (~> 0.6, >= 0.6.9)
30
+ minitest (~> 4.2)
31
+ multi_json (~> 1.3)
32
+ thread_safe (~> 0.1)
33
+ tzinfo (~> 0.3.37)
34
+ arel (4.0.2)
35
+ builder (3.1.4)
36
+ erubis (2.7.0)
37
+ hike (1.2.3)
38
+ i18n (0.6.11)
39
+ mail (2.6.1)
40
+ mime-types (>= 1.16, < 3)
41
+ mime-types (2.4.2)
42
+ minitest (4.7.5)
43
+ multi_json (1.10.1)
44
+ rack (1.5.2)
45
+ rack-test (0.6.2)
46
+ rack (>= 1.0)
47
+ rails (4.0.10)
48
+ actionmailer (= 4.0.10)
49
+ actionpack (= 4.0.10)
50
+ activerecord (= 4.0.10)
51
+ activesupport (= 4.0.10)
52
+ bundler (>= 1.3.0, < 2.0)
53
+ railties (= 4.0.10)
54
+ sprockets-rails (~> 2.0)
55
+ railties (4.0.10)
56
+ actionpack (= 4.0.10)
57
+ activesupport (= 4.0.10)
58
+ rake (>= 0.8.7)
59
+ thor (>= 0.18.1, < 2.0)
60
+ rake (10.3.2)
61
+ sprockets (2.12.2)
62
+ hike (~> 1.2)
63
+ multi_json (~> 1.0)
64
+ rack (~> 1.0)
65
+ tilt (~> 1.1, != 1.3.0)
66
+ sprockets-rails (2.2.0)
67
+ actionpack (>= 3.0)
68
+ activesupport (>= 3.0)
69
+ sprockets (>= 2.8, < 4.0)
70
+ sqlite3 (1.3.9)
71
+ thor (0.19.1)
72
+ thread_safe (0.3.4)
73
+ tilt (1.4.1)
74
+ tzinfo (0.3.41)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ authorization!
81
+ sqlite3
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
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.
@@ -0,0 +1,3 @@
1
+ = Authorization
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Authorization'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
@@ -0,0 +1,22 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "authorization/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "authorization"
9
+ s.version = Authorization::VERSION
10
+ s.authors = ["TODO: Your name"]
11
+ s.email = ["TODO: Your email"]
12
+ s.homepage = "TODO"
13
+ s.summary = "TODO: Summary of Authorization."
14
+ s.description = "TODO: Description of Authorization."
15
+
16
+ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
17
+ s.test_files = Dir["test/**/*"]
18
+
19
+ s.add_dependency "rails", "~> 4.0.4"
20
+
21
+ s.add_development_dependency "sqlite3"
22
+ end
@@ -0,0 +1,4 @@
1
+ require 'authorization/people/v1/user'
2
+
3
+ module Authorization
4
+ end
@@ -0,0 +1,90 @@
1
+ module Authorization
2
+ module People
3
+ module V1
4
+ module User
5
+
6
+ #Used in the controller
7
+
8
+
9
+ def self.register?
10
+ return true
11
+ end
12
+
13
+ def self.login?
14
+ return true
15
+ end
16
+
17
+ def self.logout?(tokenUser)
18
+ return true
19
+ end
20
+
21
+
22
+ def self.index?(tokenUser)
23
+ return true
24
+ end
25
+
26
+ def self.show?(targetUser,tokenUser)
27
+ return true
28
+ end
29
+
30
+
31
+ def self.update?(targetUser,tokenUser)
32
+
33
+ if targetUser != tokenUser
34
+ #Can only update your own data
35
+ return false
36
+ else
37
+ return true
38
+ end
39
+
40
+ end
41
+
42
+ #Used in the serializer, current_user may be nil
43
+
44
+ def self.include_id?(current_user,user_object,options)
45
+ action = options[:url_options][:_recall][:action]
46
+ controller = options[:url_options][:_recall][:controller]
47
+ return true
48
+ end
49
+
50
+ def self.include_email?(current_user,user_object,options)
51
+ action = options[:url_options][:_recall][:action]
52
+ controller = options[:url_options][:_recall][:controller]
53
+ return true
54
+ end
55
+
56
+ def self.include_username?(current_user,user_object,options)
57
+ action = options[:url_options][:_recall][:action]
58
+ controller = options[:url_options][:_recall][:controller]
59
+ return true
60
+ end
61
+
62
+ def self.include_created_at?(current_user,user_object,options)
63
+ action = options[:url_options][:_recall][:action]
64
+ controller = options[:url_options][:_recall][:controller]
65
+ return true
66
+ end
67
+
68
+ def self.include_updated_at?(current_user,user_object,options)
69
+ action = options[:url_options][:_recall][:action]
70
+ controller = options[:url_options][:_recall][:controller]
71
+ return true
72
+ end
73
+
74
+
75
+ def self.include_tokens?(current_user,user_object,options)
76
+ action = options[:url_options][:_recall][:action]
77
+ controller = options[:url_options][:_recall][:controller]
78
+ #if action == "index" && controller == "people/api/v1/users"
79
+ #return false
80
+ #end
81
+ return false
82
+ end
83
+
84
+
85
+ private
86
+
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,3 @@
1
+ module Authorization
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :authorization do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AuthorizationTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Authorization
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end