api_guardian 0.1.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +125 -0
- data/Rakefile +30 -0
- data/app/controllers/api_guardian/api_controller.rb +112 -0
- data/app/controllers/api_guardian/application_controller.rb +11 -0
- data/app/controllers/api_guardian/permissions_controller.rb +7 -0
- data/app/controllers/api_guardian/registration_controller.rb +38 -0
- data/app/controllers/api_guardian/roles_controller.rb +19 -0
- data/app/controllers/api_guardian/users_controller.rb +20 -0
- data/app/models/api_guardian/permission.rb +14 -0
- data/app/models/api_guardian/role.rb +97 -0
- data/app/models/api_guardian/role_permission.rb +8 -0
- data/app/models/api_guardian/user.rb +23 -0
- data/app/serializers/api_guardian/permission_serializer.rb +7 -0
- data/app/serializers/api_guardian/role_serializer.rb +7 -0
- data/app/serializers/api_guardian/user_serializer.rb +10 -0
- data/config/initializers/api_guardian.rb +10 -0
- data/config/initializers/doorkeeper.rb +143 -0
- data/config/routes.rb +20 -0
- data/db/migrate/20151117191338_api_guardian_enable_uuid_extension.rb +5 -0
- data/db/migrate/20151117191911_create_api_guardian_roles.rb +9 -0
- data/db/migrate/20151117195618_create_api_guardian_users.rb +25 -0
- data/db/migrate/20151117212826_create_api_guardian_permissions.rb +10 -0
- data/db/migrate/20151117213145_create_api_guardian_role_permissions.rb +11 -0
- data/db/migrate/20151117225238_create_doorkeeper_tables.rb +42 -0
- data/db/seeds.rb +32 -0
- data/lib/api_guardian.rb +80 -0
- data/lib/api_guardian/concerns/api_errors/handler.rb +145 -0
- data/lib/api_guardian/concerns/api_errors/renderer.rb +45 -0
- data/lib/api_guardian/concerns/api_request/validator.rb +66 -0
- data/lib/api_guardian/configuration.rb +171 -0
- data/lib/api_guardian/engine.rb +23 -0
- data/lib/api_guardian/errors/invalid_content_type_error.rb +6 -0
- data/lib/api_guardian/errors/invalid_permission_name_error.rb +6 -0
- data/lib/api_guardian/errors/invalid_request_body_error.rb +6 -0
- data/lib/api_guardian/errors/invalid_request_resource_id_error.rb +6 -0
- data/lib/api_guardian/errors/invalid_request_resource_type_error.rb +6 -0
- data/lib/api_guardian/errors/invalid_update_action_error.rb +6 -0
- data/lib/api_guardian/errors/reset_token_expired_error.rb +6 -0
- data/lib/api_guardian/errors/reset_token_user_mismatch_error.rb +6 -0
- data/lib/api_guardian/policies/application_policy.rb +65 -0
- data/lib/api_guardian/policies/permission_policy.rb +15 -0
- data/lib/api_guardian/policies/role_policy.rb +15 -0
- data/lib/api_guardian/policies/user_policy.rb +23 -0
- data/lib/api_guardian/stores/base.rb +53 -0
- data/lib/api_guardian/stores/permission_store.rb +6 -0
- data/lib/api_guardian/stores/role_store.rb +9 -0
- data/lib/api_guardian/stores/user_store.rb +86 -0
- data/lib/api_guardian/version.rb +3 -0
- data/lib/generators/api_guardian/install/USAGE +8 -0
- data/lib/generators/api_guardian/install/install_generator.rb +19 -0
- data/lib/generators/api_guardian/install/templates/README +1 -0
- data/lib/generators/api_guardian/install/templates/api_guardian.rb +5 -0
- data/lib/tasks/api_guardian_tasks.rake +4 -0
- data/spec/concerns/api_errors/handler_spec.rb +114 -0
- data/spec/concerns/api_request/validator_spec.rb +102 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +25 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +104 -0
- data/spec/dummy/log/test.log +5031 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/permissions.rb +6 -0
- data/spec/factories/role_permissions.rb +6 -0
- data/spec/factories/roles.rb +24 -0
- data/spec/factories/users.rb +11 -0
- data/spec/models/permission_spec.rb +28 -0
- data/spec/models/role_permission_spec.rb +27 -0
- data/spec/models/role_spec.rb +209 -0
- data/spec/models/user_spec.rb +44 -0
- data/spec/policies/application_policy_spec.rb +118 -0
- data/spec/policies/permission_policy_spec.rb +28 -0
- data/spec/policies/role_policy_spec.rb +28 -0
- data/spec/policies/user_policy_spec.rb +29 -0
- data/spec/requests/permissions_controller_spec.rb +19 -0
- data/spec/requests/registration_controller_spec.rb +151 -0
- data/spec/requests/roles_controller_spec.rb +75 -0
- data/spec/requests/users_controller_spec.rb +75 -0
- data/spec/spec_helper.rb +138 -0
- data/spec/stores/base_spec.rb +113 -0
- data/spec/stores/permission_store_spec.rb +2 -0
- data/spec/stores/role_store_spec.rb +12 -0
- data/spec/stores/user_store_spec.rb +144 -0
- data/spec/support/controller_concern_test_helpers.rb +21 -0
- data/spec/support/matchers.rb +37 -0
- data/spec/support/request_helpers.rb +111 -0
- metadata +508 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'active_support/concern'
|
|
2
|
+
|
|
3
|
+
module ControllerConcernTestHelpers
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
attr_accessor :action_name
|
|
8
|
+
|
|
9
|
+
def request
|
|
10
|
+
ActionDispatch::Request.new 'test'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def params
|
|
14
|
+
ActionController::Parameters.new(id: 'test')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def resource_name
|
|
18
|
+
'User'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
RSpec::Matchers.define :have_content_type do |content_type|
|
|
2
|
+
CONTENT_HEADER_MATCHER ||= /^(.*?)(?:; charset=(.*))?$/
|
|
3
|
+
|
|
4
|
+
chain :with_charset do |charset|
|
|
5
|
+
@charset = charset
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
match do
|
|
9
|
+
_, content, charset = *content_type_header.match(CONTENT_HEADER_MATCHER).to_a
|
|
10
|
+
|
|
11
|
+
if @charset
|
|
12
|
+
@charset == charset && content == content_type
|
|
13
|
+
else
|
|
14
|
+
content == content_type
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
failure_message do
|
|
19
|
+
if @charset
|
|
20
|
+
"Content type #{content_type_header.inspect} should match #{content_type.inspect} with charset #{@charset}"
|
|
21
|
+
else
|
|
22
|
+
"Content type #{content_type_header.inspect} should match #{content_type.inspect}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
failure_message_when_negated do
|
|
27
|
+
if @charset
|
|
28
|
+
"Content type #{content_type_header.inspect} should not match #{content_type.inspect} with charset #{@charset}"
|
|
29
|
+
else
|
|
30
|
+
"Content type #{content_type_header.inspect} should not match #{content_type.inspect}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def content_type_header
|
|
35
|
+
response.headers['Content-Type']
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
module Requests
|
|
2
|
+
module JsonHelpers
|
|
3
|
+
def json
|
|
4
|
+
JSON.parse(response.body)
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module AuthHelpers
|
|
9
|
+
@@headers = {
|
|
10
|
+
'Content-Type' => 'application/vnd.api+json',
|
|
11
|
+
'Accept' => 'application/vnd.api+json'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
def seed_permissions(resource)
|
|
15
|
+
%w(create read update delete manage).each do |p|
|
|
16
|
+
create(:permission, name: "#{resource}:#{p}")
|
|
17
|
+
current_user.role.add_permission("#{resource}:#{p}")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def auth_user
|
|
22
|
+
user = current_user
|
|
23
|
+
access_token = Doorkeeper::AccessToken.create!(resource_owner_id: user.id, expires_in: 7200)
|
|
24
|
+
add_header('Authorization', "Bearer #{access_token.token}")
|
|
25
|
+
user
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def destroy_user
|
|
29
|
+
@@current_user = nil
|
|
30
|
+
remove_header('Authorization')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def add_user_permission(perm_name)
|
|
34
|
+
current_user.role.add_permission(perm_name)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def remove_user_permission(perm_name)
|
|
38
|
+
current_user.role.remove_permission(perm_name)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def current_user
|
|
42
|
+
@@current_user ||= create(:user)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def add_header(key, value)
|
|
46
|
+
@@headers[key] = value
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def remove_header(key)
|
|
50
|
+
@@headers.delete(key)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def get_headers
|
|
54
|
+
@@headers
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
module ErrorHelpers
|
|
59
|
+
def validate_unprocessable_entity(detail = '')
|
|
60
|
+
detail = detail.to_json if detail.is_a?(Array) || detail.is_a?(Hash)
|
|
61
|
+
|
|
62
|
+
validate_api_error(
|
|
63
|
+
status: 422,
|
|
64
|
+
code: 'unprocessable_entity',
|
|
65
|
+
title: 'Unprocessable Entity',
|
|
66
|
+
detail: detail
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def validate_not_found(url = '')
|
|
71
|
+
validate_api_error(
|
|
72
|
+
status: 404,
|
|
73
|
+
code: 'not_found',
|
|
74
|
+
title: 'Not Found',
|
|
75
|
+
detail: 'Resource or endpoint missing: http://www.example.com' + url
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def validate_api_error(**expected)
|
|
80
|
+
expect(response).to have_content_type('application/json')
|
|
81
|
+
expect(response).to have_http_status(expected[:status])
|
|
82
|
+
expect(error_id.length).to be 36
|
|
83
|
+
expect(error_status).to eq(expected[:status].to_s)
|
|
84
|
+
expect(error_code).to eq expected[:code]
|
|
85
|
+
expect(error_title).to eq expected[:title]
|
|
86
|
+
expect(error_detail).to eq expected[:detail]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def error_id(index = 0)
|
|
90
|
+
json['errors'][index]['id']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def error_code(index = 0)
|
|
94
|
+
json['errors'][index]['code']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def error_status(index = 0)
|
|
98
|
+
json['errors'][index]['status']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def error_title(index = 0)
|
|
102
|
+
json['errors'][index]['title']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def error_detail(index = 0)
|
|
106
|
+
detail = json['errors'][index]['detail']
|
|
107
|
+
detail = detail.to_json if detail.is_a?(Array) || detail.is_a?(Hash)
|
|
108
|
+
detail
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: api_guardian
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0.pre
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Travis Vignon
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails-api
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.4.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.4.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: paranoia
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pundit
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.0.1
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.0.1
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rack-cors
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.4.0
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.4.0
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: doorkeeper
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 3.0.1
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 3.0.1
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: doorkeeper-jwt
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 0.1.4
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 0.1.4
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: bcrypt
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 3.1.10
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 3.1.10
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: kaminari
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 0.16.3
|
|
118
|
+
type: :runtime
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 0.16.3
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: pg
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: 0.18.4
|
|
132
|
+
type: :runtime
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: 0.18.4
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rspec-rails
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - "~>"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: 3.4.0
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: 3.4.0
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: rspec-activemodel-mocks
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: 1.0.2
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: 1.0.2
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: factory_girl_rails
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - "~>"
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: 4.5.0
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - "~>"
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: 4.5.0
|
|
181
|
+
- !ruby/object:Gem::Dependency
|
|
182
|
+
name: shoulda
|
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
|
184
|
+
requirements:
|
|
185
|
+
- - "~>"
|
|
186
|
+
- !ruby/object:Gem::Version
|
|
187
|
+
version: 2.11.3
|
|
188
|
+
type: :development
|
|
189
|
+
prerelease: false
|
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
191
|
+
requirements:
|
|
192
|
+
- - "~>"
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: 2.11.3
|
|
195
|
+
- !ruby/object:Gem::Dependency
|
|
196
|
+
name: shoulda-matchers
|
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
|
198
|
+
requirements:
|
|
199
|
+
- - "~>"
|
|
200
|
+
- !ruby/object:Gem::Version
|
|
201
|
+
version: 3.0.1
|
|
202
|
+
type: :development
|
|
203
|
+
prerelease: false
|
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - "~>"
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: 3.0.1
|
|
209
|
+
- !ruby/object:Gem::Dependency
|
|
210
|
+
name: simplecov
|
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - "~>"
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: 0.11.0
|
|
216
|
+
type: :development
|
|
217
|
+
prerelease: false
|
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: 0.11.0
|
|
223
|
+
- !ruby/object:Gem::Dependency
|
|
224
|
+
name: faker
|
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - "~>"
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: 1.5.0
|
|
230
|
+
type: :development
|
|
231
|
+
prerelease: false
|
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
233
|
+
requirements:
|
|
234
|
+
- - "~>"
|
|
235
|
+
- !ruby/object:Gem::Version
|
|
236
|
+
version: 1.5.0
|
|
237
|
+
- !ruby/object:Gem::Dependency
|
|
238
|
+
name: database_cleaner
|
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
|
240
|
+
requirements:
|
|
241
|
+
- - "~>"
|
|
242
|
+
- !ruby/object:Gem::Version
|
|
243
|
+
version: 1.4.1
|
|
244
|
+
type: :development
|
|
245
|
+
prerelease: false
|
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
247
|
+
requirements:
|
|
248
|
+
- - "~>"
|
|
249
|
+
- !ruby/object:Gem::Version
|
|
250
|
+
version: 1.4.1
|
|
251
|
+
- !ruby/object:Gem::Dependency
|
|
252
|
+
name: coveralls
|
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
|
254
|
+
requirements:
|
|
255
|
+
- - "~>"
|
|
256
|
+
- !ruby/object:Gem::Version
|
|
257
|
+
version: 0.8.10
|
|
258
|
+
type: :development
|
|
259
|
+
prerelease: false
|
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
261
|
+
requirements:
|
|
262
|
+
- - "~>"
|
|
263
|
+
- !ruby/object:Gem::Version
|
|
264
|
+
version: 0.8.10
|
|
265
|
+
- !ruby/object:Gem::Dependency
|
|
266
|
+
name: capybara
|
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
|
268
|
+
requirements:
|
|
269
|
+
- - "~>"
|
|
270
|
+
- !ruby/object:Gem::Version
|
|
271
|
+
version: 2.5.0
|
|
272
|
+
type: :development
|
|
273
|
+
prerelease: false
|
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
275
|
+
requirements:
|
|
276
|
+
- - "~>"
|
|
277
|
+
- !ruby/object:Gem::Version
|
|
278
|
+
version: 2.5.0
|
|
279
|
+
- !ruby/object:Gem::Dependency
|
|
280
|
+
name: fuubar
|
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
|
282
|
+
requirements:
|
|
283
|
+
- - "~>"
|
|
284
|
+
- !ruby/object:Gem::Version
|
|
285
|
+
version: 2.0.0
|
|
286
|
+
type: :development
|
|
287
|
+
prerelease: false
|
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
289
|
+
requirements:
|
|
290
|
+
- - "~>"
|
|
291
|
+
- !ruby/object:Gem::Version
|
|
292
|
+
version: 2.0.0
|
|
293
|
+
- !ruby/object:Gem::Dependency
|
|
294
|
+
name: rubocop
|
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
|
296
|
+
requirements:
|
|
297
|
+
- - "~>"
|
|
298
|
+
- !ruby/object:Gem::Version
|
|
299
|
+
version: 0.35.1
|
|
300
|
+
type: :development
|
|
301
|
+
prerelease: false
|
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
303
|
+
requirements:
|
|
304
|
+
- - "~>"
|
|
305
|
+
- !ruby/object:Gem::Version
|
|
306
|
+
version: 0.35.1
|
|
307
|
+
description: Drop in authorization and authentication suite for Rails APIs.
|
|
308
|
+
email:
|
|
309
|
+
- travis@lookitsatravis.com
|
|
310
|
+
executables: []
|
|
311
|
+
extensions: []
|
|
312
|
+
extra_rdoc_files: []
|
|
313
|
+
files:
|
|
314
|
+
- MIT-LICENSE
|
|
315
|
+
- README.md
|
|
316
|
+
- Rakefile
|
|
317
|
+
- app/controllers/api_guardian/api_controller.rb
|
|
318
|
+
- app/controllers/api_guardian/application_controller.rb
|
|
319
|
+
- app/controllers/api_guardian/permissions_controller.rb
|
|
320
|
+
- app/controllers/api_guardian/registration_controller.rb
|
|
321
|
+
- app/controllers/api_guardian/roles_controller.rb
|
|
322
|
+
- app/controllers/api_guardian/users_controller.rb
|
|
323
|
+
- app/models/api_guardian/permission.rb
|
|
324
|
+
- app/models/api_guardian/role.rb
|
|
325
|
+
- app/models/api_guardian/role_permission.rb
|
|
326
|
+
- app/models/api_guardian/user.rb
|
|
327
|
+
- app/serializers/api_guardian/permission_serializer.rb
|
|
328
|
+
- app/serializers/api_guardian/role_serializer.rb
|
|
329
|
+
- app/serializers/api_guardian/user_serializer.rb
|
|
330
|
+
- config/initializers/api_guardian.rb
|
|
331
|
+
- config/initializers/doorkeeper.rb
|
|
332
|
+
- config/routes.rb
|
|
333
|
+
- db/migrate/20151117191338_api_guardian_enable_uuid_extension.rb
|
|
334
|
+
- db/migrate/20151117191911_create_api_guardian_roles.rb
|
|
335
|
+
- db/migrate/20151117195618_create_api_guardian_users.rb
|
|
336
|
+
- db/migrate/20151117212826_create_api_guardian_permissions.rb
|
|
337
|
+
- db/migrate/20151117213145_create_api_guardian_role_permissions.rb
|
|
338
|
+
- db/migrate/20151117225238_create_doorkeeper_tables.rb
|
|
339
|
+
- db/seeds.rb
|
|
340
|
+
- lib/api_guardian.rb
|
|
341
|
+
- lib/api_guardian/concerns/api_errors/handler.rb
|
|
342
|
+
- lib/api_guardian/concerns/api_errors/renderer.rb
|
|
343
|
+
- lib/api_guardian/concerns/api_request/validator.rb
|
|
344
|
+
- lib/api_guardian/configuration.rb
|
|
345
|
+
- lib/api_guardian/engine.rb
|
|
346
|
+
- lib/api_guardian/errors/invalid_content_type_error.rb
|
|
347
|
+
- lib/api_guardian/errors/invalid_permission_name_error.rb
|
|
348
|
+
- lib/api_guardian/errors/invalid_request_body_error.rb
|
|
349
|
+
- lib/api_guardian/errors/invalid_request_resource_id_error.rb
|
|
350
|
+
- lib/api_guardian/errors/invalid_request_resource_type_error.rb
|
|
351
|
+
- lib/api_guardian/errors/invalid_update_action_error.rb
|
|
352
|
+
- lib/api_guardian/errors/reset_token_expired_error.rb
|
|
353
|
+
- lib/api_guardian/errors/reset_token_user_mismatch_error.rb
|
|
354
|
+
- lib/api_guardian/policies/application_policy.rb
|
|
355
|
+
- lib/api_guardian/policies/permission_policy.rb
|
|
356
|
+
- lib/api_guardian/policies/role_policy.rb
|
|
357
|
+
- lib/api_guardian/policies/user_policy.rb
|
|
358
|
+
- lib/api_guardian/stores/base.rb
|
|
359
|
+
- lib/api_guardian/stores/permission_store.rb
|
|
360
|
+
- lib/api_guardian/stores/role_store.rb
|
|
361
|
+
- lib/api_guardian/stores/user_store.rb
|
|
362
|
+
- lib/api_guardian/version.rb
|
|
363
|
+
- lib/generators/api_guardian/install/USAGE
|
|
364
|
+
- lib/generators/api_guardian/install/install_generator.rb
|
|
365
|
+
- lib/generators/api_guardian/install/templates/README
|
|
366
|
+
- lib/generators/api_guardian/install/templates/api_guardian.rb
|
|
367
|
+
- lib/tasks/api_guardian_tasks.rake
|
|
368
|
+
- spec/concerns/api_errors/handler_spec.rb
|
|
369
|
+
- spec/concerns/api_request/validator_spec.rb
|
|
370
|
+
- spec/dummy/README.rdoc
|
|
371
|
+
- spec/dummy/Rakefile
|
|
372
|
+
- spec/dummy/app/controllers/application_controller.rb
|
|
373
|
+
- spec/dummy/bin/bundle
|
|
374
|
+
- spec/dummy/bin/rails
|
|
375
|
+
- spec/dummy/bin/rake
|
|
376
|
+
- spec/dummy/bin/setup
|
|
377
|
+
- spec/dummy/config.ru
|
|
378
|
+
- spec/dummy/config/application.rb
|
|
379
|
+
- spec/dummy/config/boot.rb
|
|
380
|
+
- spec/dummy/config/database.yml
|
|
381
|
+
- spec/dummy/config/environment.rb
|
|
382
|
+
- spec/dummy/config/environments/development.rb
|
|
383
|
+
- spec/dummy/config/environments/production.rb
|
|
384
|
+
- spec/dummy/config/environments/test.rb
|
|
385
|
+
- spec/dummy/config/initializers/assets.rb
|
|
386
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
387
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
388
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
389
|
+
- spec/dummy/config/initializers/inflections.rb
|
|
390
|
+
- spec/dummy/config/initializers/mime_types.rb
|
|
391
|
+
- spec/dummy/config/initializers/session_store.rb
|
|
392
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
393
|
+
- spec/dummy/config/locales/en.yml
|
|
394
|
+
- spec/dummy/config/routes.rb
|
|
395
|
+
- spec/dummy/config/secrets.yml
|
|
396
|
+
- spec/dummy/db/schema.rb
|
|
397
|
+
- spec/dummy/log/test.log
|
|
398
|
+
- spec/dummy/public/404.html
|
|
399
|
+
- spec/dummy/public/422.html
|
|
400
|
+
- spec/dummy/public/500.html
|
|
401
|
+
- spec/dummy/public/favicon.ico
|
|
402
|
+
- spec/factories/permissions.rb
|
|
403
|
+
- spec/factories/role_permissions.rb
|
|
404
|
+
- spec/factories/roles.rb
|
|
405
|
+
- spec/factories/users.rb
|
|
406
|
+
- spec/models/permission_spec.rb
|
|
407
|
+
- spec/models/role_permission_spec.rb
|
|
408
|
+
- spec/models/role_spec.rb
|
|
409
|
+
- spec/models/user_spec.rb
|
|
410
|
+
- spec/policies/application_policy_spec.rb
|
|
411
|
+
- spec/policies/permission_policy_spec.rb
|
|
412
|
+
- spec/policies/role_policy_spec.rb
|
|
413
|
+
- spec/policies/user_policy_spec.rb
|
|
414
|
+
- spec/requests/permissions_controller_spec.rb
|
|
415
|
+
- spec/requests/registration_controller_spec.rb
|
|
416
|
+
- spec/requests/roles_controller_spec.rb
|
|
417
|
+
- spec/requests/users_controller_spec.rb
|
|
418
|
+
- spec/spec_helper.rb
|
|
419
|
+
- spec/stores/base_spec.rb
|
|
420
|
+
- spec/stores/permission_store_spec.rb
|
|
421
|
+
- spec/stores/role_store_spec.rb
|
|
422
|
+
- spec/stores/user_store_spec.rb
|
|
423
|
+
- spec/support/controller_concern_test_helpers.rb
|
|
424
|
+
- spec/support/matchers.rb
|
|
425
|
+
- spec/support/request_helpers.rb
|
|
426
|
+
homepage: https://github.com/lookitsatravis/api_guardian
|
|
427
|
+
licenses:
|
|
428
|
+
- MIT
|
|
429
|
+
metadata: {}
|
|
430
|
+
post_install_message:
|
|
431
|
+
rdoc_options: []
|
|
432
|
+
require_paths:
|
|
433
|
+
- lib
|
|
434
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
435
|
+
requirements:
|
|
436
|
+
- - ">="
|
|
437
|
+
- !ruby/object:Gem::Version
|
|
438
|
+
version: '0'
|
|
439
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
440
|
+
requirements:
|
|
441
|
+
- - ">"
|
|
442
|
+
- !ruby/object:Gem::Version
|
|
443
|
+
version: 1.3.1
|
|
444
|
+
requirements: []
|
|
445
|
+
rubyforge_project:
|
|
446
|
+
rubygems_version: 2.4.8
|
|
447
|
+
signing_key:
|
|
448
|
+
specification_version: 4
|
|
449
|
+
summary: Drop in authorization and authentication suite for Rails APIs.
|
|
450
|
+
test_files:
|
|
451
|
+
- spec/concerns/api_errors/handler_spec.rb
|
|
452
|
+
- spec/concerns/api_request/validator_spec.rb
|
|
453
|
+
- spec/dummy/app/controllers/application_controller.rb
|
|
454
|
+
- spec/dummy/bin/bundle
|
|
455
|
+
- spec/dummy/bin/rails
|
|
456
|
+
- spec/dummy/bin/rake
|
|
457
|
+
- spec/dummy/bin/setup
|
|
458
|
+
- spec/dummy/config/application.rb
|
|
459
|
+
- spec/dummy/config/boot.rb
|
|
460
|
+
- spec/dummy/config/database.yml
|
|
461
|
+
- spec/dummy/config/environment.rb
|
|
462
|
+
- spec/dummy/config/environments/development.rb
|
|
463
|
+
- spec/dummy/config/environments/production.rb
|
|
464
|
+
- spec/dummy/config/environments/test.rb
|
|
465
|
+
- spec/dummy/config/initializers/assets.rb
|
|
466
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
467
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
468
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
469
|
+
- spec/dummy/config/initializers/inflections.rb
|
|
470
|
+
- spec/dummy/config/initializers/mime_types.rb
|
|
471
|
+
- spec/dummy/config/initializers/session_store.rb
|
|
472
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
473
|
+
- spec/dummy/config/locales/en.yml
|
|
474
|
+
- spec/dummy/config/routes.rb
|
|
475
|
+
- spec/dummy/config/secrets.yml
|
|
476
|
+
- spec/dummy/config.ru
|
|
477
|
+
- spec/dummy/db/schema.rb
|
|
478
|
+
- spec/dummy/log/test.log
|
|
479
|
+
- spec/dummy/public/404.html
|
|
480
|
+
- spec/dummy/public/422.html
|
|
481
|
+
- spec/dummy/public/500.html
|
|
482
|
+
- spec/dummy/public/favicon.ico
|
|
483
|
+
- spec/dummy/Rakefile
|
|
484
|
+
- spec/dummy/README.rdoc
|
|
485
|
+
- spec/factories/permissions.rb
|
|
486
|
+
- spec/factories/role_permissions.rb
|
|
487
|
+
- spec/factories/roles.rb
|
|
488
|
+
- spec/factories/users.rb
|
|
489
|
+
- spec/models/permission_spec.rb
|
|
490
|
+
- spec/models/role_permission_spec.rb
|
|
491
|
+
- spec/models/role_spec.rb
|
|
492
|
+
- spec/models/user_spec.rb
|
|
493
|
+
- spec/policies/application_policy_spec.rb
|
|
494
|
+
- spec/policies/permission_policy_spec.rb
|
|
495
|
+
- spec/policies/role_policy_spec.rb
|
|
496
|
+
- spec/policies/user_policy_spec.rb
|
|
497
|
+
- spec/requests/permissions_controller_spec.rb
|
|
498
|
+
- spec/requests/registration_controller_spec.rb
|
|
499
|
+
- spec/requests/roles_controller_spec.rb
|
|
500
|
+
- spec/requests/users_controller_spec.rb
|
|
501
|
+
- spec/spec_helper.rb
|
|
502
|
+
- spec/stores/base_spec.rb
|
|
503
|
+
- spec/stores/permission_store_spec.rb
|
|
504
|
+
- spec/stores/role_store_spec.rb
|
|
505
|
+
- spec/stores/user_store_spec.rb
|
|
506
|
+
- spec/support/controller_concern_test_helpers.rb
|
|
507
|
+
- spec/support/matchers.rb
|
|
508
|
+
- spec/support/request_helpers.rb
|