fat_model_auth 4.0.0 → 5.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60e63b266772142d56d536dc3985199f38ef424804a6ee4fd57918eec9cc326a
4
- data.tar.gz: '009ed5f678f7fd34af4cfaf04cde49c70ccd159be5cc80e3a12d29a13c9ab06a'
3
+ metadata.gz: bd46f66b0c3c0944de66eef838846681673ede771bc05da2aec7839ff7abf906
4
+ data.tar.gz: 636e991ce6505513fe7707c092b6c340bc167c9393ab7b2663dd31f946d0a3b5
5
5
  SHA512:
6
- metadata.gz: c2f13ff755861acee8831c829bcbfe708b0c21049e5c489b49b42d08a8d1ed719aba07dc10e2e7be30bb9bd18f3edd0b46e4bfcd40e98a01b7903b12b73fdff4
7
- data.tar.gz: 31906b600814c68081032784a2291004f5ef7e8a835018de8de243c4cdbe819ef3393b66dbb3def6d8c669948ae46f70605dbdc7c847bed311d42dec8b63d2ad
6
+ metadata.gz: 7543fc723da9599c19b098b22cbd63e524d0897355122e537d19c31c0e0f2df272ff83aa6995bf36a91dc46f29365a0b757369908915959ee3036c523c9b2d2d
7
+ data.tar.gz: ffafe0bd236e7586f063c2c009e062927b614c59ab83d7e31cc4ed413f7a2bb5a22ff7a6718a8f8c3da55ababc27fecf83fd1127d7cac141895bc87ca07bc86d
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- [![Build Status](https://semaphoreci.com/api/v1/brentgreeff/fat_model_auth/branches/master/badge.svg)](https://semaphoreci.com/brentgreeff/fat_model_auth)
1
+ [![CI](https://github.com/brentgreeff/fat_model_auth/actions/workflows/ci.yml/badge.svg)](https://github.com/brentgreeff/fat_model_auth/actions/workflows/ci.yml)
2
+
3
+ - [Example app - view installation diff](https://github.com/brentgreeff/basic_rails_5_api/commit/6f0cedff4077c1609d32567bfb889fc8fa908db7)
2
4
 
3
5
  # FatModelAuth
4
6
 
@@ -1,19 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
4
  class CannedGateKeeper
3
- def self.allows(method)
4
- self.new(method => true)
5
+ def self.allows(action)
6
+ new(action => true)
5
7
  end
6
8
 
7
- def self.denies(method)
8
- self.new(method => false)
9
+ def self.denies(action)
10
+ new(action => false)
9
11
  end
10
12
 
11
13
  def self.build(params)
12
- self.new(params)
13
- end
14
-
15
- def allows(user)
16
- self
14
+ new(params)
17
15
  end
18
16
 
19
17
  def initialize(params)
@@ -21,18 +19,26 @@ module FatModelAuth
21
19
  add_rules(params)
22
20
  end
23
21
 
24
- def add_rules(params)
25
- for param in params
26
- response = param.pop
27
- @map["to_#{param.pop}?".to_sym] = lambda { response }
28
- end
22
+ def allows(_user)
23
+ self
29
24
  end
30
25
 
31
- def method_missing(method, *args)
32
- unless @map.has_key? method
33
- raise NoMethodError, "undefined method allows(user).#{method} for #{self.class}"
34
- end
26
+ def method_missing(method, *_args)
27
+ raise NoMethodError, "undefined method allows(user).#{method} for #{self.class}" unless @map.key?(method)
28
+
35
29
  @map[method].call
36
30
  end
31
+
32
+ def respond_to_missing?(method, include_private = false)
33
+ @map.key?(method) || super
34
+ end
35
+
36
+ private
37
+
38
+ def add_rules(params)
39
+ params.each do |action, response|
40
+ @map[:"to_#{action}?"] = -> { response }
41
+ end
42
+ end
37
43
  end
38
44
  end
@@ -1,20 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
- class AuthException < Exception; end
4
+ class AuthException < StandardError; end
3
5
 
4
6
  module ControllerHelpers
5
7
  protected
6
8
 
7
9
  def auth_required
8
- authority = get_authority
9
-
10
- access_granted = authority.allows(current_user).send "to_#{params[:action]}?"
10
+ access_granted = authority.allows(current_user).send("to_#{params[:action]}?")
11
11
  respond_with_404_page unless access_granted
12
12
  end
13
13
 
14
14
  def access_denied?
15
- authority = get_authority
15
+ access_granted = authority.allows(current_user).send("to_#{params[:action]}?")
16
16
 
17
- access_granted = authority.allows(current_user).send "to_#{params[:action]}?"
18
17
  if access_granted
19
18
  false
20
19
  else
@@ -25,24 +24,25 @@ module FatModelAuth
25
24
 
26
25
  private
27
26
 
28
- def get_authority
29
- if self.respond_to?(:override_authority, true)
30
- authority = override_authority
31
- raise FatModelAuth::AuthException, "override_authority defined but nil" if authority.nil?
27
+ def authority
28
+ if respond_to?(:override_authority, true)
29
+ result = override_authority
30
+ raise FatModelAuth::AuthException, 'override_authority defined but nil' if result.nil?
31
+
32
32
  else
33
33
  authority_name = controller_name.singularize
34
- authority = instance_variable_get("@#{authority_name}")
35
- raise FatModelAuth::AuthException, "#{authority_name} is nil" if authority.nil?
36
- end
34
+ result = instance_variable_get("@#{authority_name}")
35
+ raise FatModelAuth::AuthException, "#{authority_name} is nil" if result.nil?
37
36
 
38
- return authority
37
+ end
38
+ result
39
39
  end
40
40
 
41
41
  def respond_with_404_page
42
- if defined?(Rails)
43
- render file: "#{Rails.root}/public/404.html", status: 404, layout: false
42
+ if defined?(Rails) && Rails.respond_to?(:application) && Rails.application
43
+ render file: Rails.public_path.join('404.html'), status: :not_found, layout: false
44
44
  else
45
- render nothing: true, status: 404, layout: false
45
+ head :not_found
46
46
  end
47
47
  end
48
48
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
4
  class GateKeeper
3
5
  def initialize(params)
@@ -7,33 +9,47 @@ module FatModelAuth
7
9
 
8
10
  def add_rules(params)
9
11
  *methods, options = params
12
+ unless options.is_a?(Hash) && (options[:if] || options[:unless])
13
+ raise ArgumentError, 'allows requires an :if or :unless condition'
14
+ end
15
+
10
16
  auth_condition = options[:if] || negate(options[:unless])
11
17
 
12
- for method in methods
13
- @map["to_#{method}?".to_sym] = auth_condition
18
+ methods.each do |method|
19
+ key = :"to_#{method}?"
20
+ raise ArgumentError, "rule for :#{method} is already defined" if @map.key?(key)
21
+
22
+ @map[key] = auth_condition
14
23
  end
15
24
  end
16
25
 
17
26
  def check(model, user)
18
- @model = model
19
- @user = user
20
- self
27
+ Checker.new(@map, model, user)
21
28
  end
22
29
 
23
- def method_missing(method, *args)
24
- unless @map.has_key? method
25
- raise NoMethodError, "undefined method allows(user).#{method} for #{@model.inspect}"
26
- end
27
- return false if @user.nil?
30
+ private
28
31
 
29
- @map[method].call(@model, @user)
32
+ def negate(predicate)
33
+ proc { |*args| !predicate.call(*args) }
30
34
  end
31
35
 
32
- private
36
+ class Checker
37
+ def initialize(map, model, user)
38
+ @map = map
39
+ @model = model
40
+ @user = user
41
+ end
33
42
 
34
- def negate(predicate)
35
- proc do |*args|
36
- !predicate.call(*args)
43
+ def method_missing(method, *_args)
44
+ raise NoMethodError, "undefined method allows(user).#{method} for #{@model.inspect}" unless @map.key?(method)
45
+
46
+ return false if @user.nil?
47
+
48
+ @map[method].call(@model, @user)
49
+ end
50
+
51
+ def respond_to_missing?(method, include_private = false)
52
+ @map.key?(method) || super
37
53
  end
38
54
  end
39
55
  end
@@ -1,19 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
4
  module ModelHelpers
3
-
4
5
  def allows(*params)
5
- if self.respond_to? :gate_keeper
6
- class_eval do
7
- self.gate_keeper.add_rules(params)
8
- end
6
+ if respond_to?(:gate_keeper) && gate_keeper
7
+ gate_keeper.add_rules(params)
9
8
  else
10
- class_eval do
11
- cattr_accessor :gate_keeper
12
- self.gate_keeper = FatModelAuth::GateKeeper.new(params)
9
+ class_attribute :gate_keeper
10
+ self.gate_keeper = FatModelAuth::GateKeeper.new(params)
13
11
 
14
- define_method "allows" do |user|
15
- self.gate_keeper.check(self, user)
16
- end
12
+ define_method :allows do |user|
13
+ self.class.gate_keeper.check(self, user)
17
14
  end
18
15
  end
19
16
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/railtie'
2
4
 
3
5
  module FatModelAuth
4
6
  class Railtie < Rails::Railtie
5
- initializer "fat_model_auth.initialize" do |app|
7
+ initializer 'fat_model_auth.initialize' do |_app|
6
8
  ActiveSupport.on_load :action_controller do
7
9
  include FatModelAuth::ControllerHelpers
8
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
- VERSION = "4.0.0"
4
+ VERSION = '5.0.0'
3
5
  end
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatModelAuth
2
4
  module ViewHelpers
3
5
  def allowed_to?(options)
4
6
  actions, authority = options.first
7
+ raise FatModelAuth::AuthException, "#{authority.inspect} is nil" if authority.nil?
5
8
 
6
9
  actions.to_s.split('_or_').any? do |action|
7
- authority.allows(current_user).send "to_#{action}?"
10
+ authority.allows(current_user).send("to_#{action}?")
8
11
  end
9
12
  end
10
13
  end
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'action_pack'
2
4
  require 'active_support'
3
5
 
4
- require "fat_model_auth/version"
6
+ require 'fat_model_auth/version'
5
7
 
6
8
  require 'fat_model_auth/railtie' if defined?(Rails)
7
9
 
8
10
  module FatModelAuth
9
11
  extend ActiveSupport::Autoload
10
- autoload :ControllerHelpers, 'fat_model_auth/controller_helpers.rb'
11
- autoload :ModelHelpers, 'fat_model_auth/model_helpers.rb'
12
- autoload :ViewHelpers, 'fat_model_auth/view_helpers.rb'
13
- autoload :GateKeeper, 'fat_model_auth/gate_keeper.rb'
14
- autoload :CannedGateKeeper, 'fat_model_auth/canned_gate_keeper.rb'
12
+
13
+ autoload :ControllerHelpers, 'fat_model_auth/controller_helpers'
14
+ autoload :ModelHelpers, 'fat_model_auth/model_helpers'
15
+ autoload :ViewHelpers, 'fat_model_auth/view_helpers'
16
+ autoload :GateKeeper, 'fat_model_auth/gate_keeper'
17
+ autoload :CannedGateKeeper, 'fat_model_auth/canned_gate_keeper'
15
18
  end
metadata CHANGED
@@ -1,59 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_model_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Greeff
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2018-01-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: activesupport
13
+ name: actionpack
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '5.1'
20
- type: :development
18
+ version: '7.0'
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '5.1'
25
+ version: '7.0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: activerecord
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '5.1'
34
- type: :development
32
+ version: '7.0'
33
+ type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - "~>"
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '5.1'
39
+ version: '7.0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: actionpack
41
+ name: activesupport
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '7.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '7.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: bundler-audit
43
56
  requirement: !ruby/object:Gem::Requirement
44
57
  requirements:
45
- - - "~>"
58
+ - - ">="
46
59
  - !ruby/object:Gem::Version
47
- version: '5.1'
60
+ version: '0'
48
61
  type: :development
49
62
  prerelease: false
50
63
  version_requirements: !ruby/object:Gem::Requirement
51
64
  requirements:
52
- - - "~>"
65
+ - - ">="
53
66
  - !ruby/object:Gem::Version
54
- version: '5.1'
67
+ version: '0'
55
68
  - !ruby/object:Gem::Dependency
56
- name: sqlite3
69
+ name: lefthook
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
72
  - - ">="
@@ -67,7 +80,7 @@ dependencies:
67
80
  - !ruby/object:Gem::Version
68
81
  version: '0'
69
82
  - !ruby/object:Gem::Dependency
70
- name: bundler
83
+ name: ostruct
71
84
  requirement: !ruby/object:Gem::Requirement
72
85
  requirements:
73
86
  - - ">="
@@ -84,16 +97,16 @@ dependencies:
84
97
  name: rake
85
98
  requirement: !ruby/object:Gem::Requirement
86
99
  requirements:
87
- - - "~>"
100
+ - - ">="
88
101
  - !ruby/object:Gem::Version
89
- version: '10.0'
102
+ version: '0'
90
103
  type: :development
91
104
  prerelease: false
92
105
  version_requirements: !ruby/object:Gem::Requirement
93
106
  requirements:
94
- - - "~>"
107
+ - - ">="
95
108
  - !ruby/object:Gem::Version
96
- version: '10.0'
109
+ version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rspec
99
112
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +122,21 @@ dependencies:
109
122
  - !ruby/object:Gem::Version
110
123
  version: '0'
111
124
  - !ruby/object:Gem::Dependency
112
- name: guard-rspec
125
+ name: rubocop-rails-omakase
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop-rspec
113
140
  requirement: !ruby/object:Gem::Requirement
114
141
  requirements:
115
142
  - - ">="
@@ -123,7 +150,7 @@ dependencies:
123
150
  - !ruby/object:Gem::Version
124
151
  version: '0'
125
152
  - !ruby/object:Gem::Dependency
126
- name: awesome_print
153
+ name: sqlite3
127
154
  requirement: !ruby/object:Gem::Requirement
128
155
  requirements:
129
156
  - - ">="
@@ -136,30 +163,16 @@ dependencies:
136
163
  - - ">="
137
164
  - !ruby/object:Gem::Version
138
165
  version: '0'
139
- description: Define the rules for accessing resources through a simple DSL.
166
+ description: Models define access rules via a DSL. Controllers call auth_required.
167
+ Access denied returns 404.
140
168
  email:
141
169
  - email@brentgreeff.com
142
170
  executables: []
143
171
  extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
146
- - ".DS_Store"
147
- - ".gitignore"
148
- - ".rspec"
149
- - ".ruby-gemset"
150
- - ".ruby-version"
151
- - ".travis.yml"
152
- - Gemfile
153
- - Gemfile.lock
154
- - Guardfile
155
174
  - LICENSE.txt
156
- - MIT-LICENSE
157
175
  - README.md
158
- - Rakefile
159
- - VERSION
160
- - bin/console
161
- - bin/setup
162
- - fat_model_auth.gemspec
163
176
  - lib/fat_model_auth.rb
164
177
  - lib/fat_model_auth/canned_gate_keeper.rb
165
178
  - lib/fat_model_auth/controller_helpers.rb
@@ -171,8 +184,11 @@ files:
171
184
  homepage: https://github.com/brentgreeff/fat_model_auth
172
185
  licenses:
173
186
  - MIT
174
- metadata: {}
175
- post_install_message:
187
+ metadata:
188
+ rubygems_mfa_required: 'true'
189
+ homepage_uri: https://github.com/brentgreeff/fat_model_auth
190
+ source_code_uri: https://github.com/brentgreeff/fat_model_auth
191
+ changelog_uri: https://github.com/brentgreeff/fat_model_auth/blob/main/CHANGELOG.md
176
192
  rdoc_options: []
177
193
  require_paths:
178
194
  - lib
@@ -180,16 +196,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
196
  requirements:
181
197
  - - ">="
182
198
  - !ruby/object:Gem::Version
183
- version: '0'
199
+ version: '3.3'
184
200
  required_rubygems_version: !ruby/object:Gem::Requirement
185
201
  requirements:
186
202
  - - ">="
187
203
  - !ruby/object:Gem::Version
188
204
  version: '0'
189
205
  requirements: []
190
- rubyforge_project:
191
- rubygems_version: 2.7.3
192
- signing_key:
206
+ rubygems_version: 3.6.9
193
207
  specification_version: 4
194
- summary: Clean resource based Authorisation system for Rails.
208
+ summary: 'Resource-level Rails authorization: models declare rules, controllers enforce
209
+ them.'
195
210
  test_files: []
data/.DS_Store DELETED
Binary file
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- fat_model_auth
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.5.0
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in fat_model_auth.gemspec
6
- gemspec
data/Gemfile.lock DELETED
@@ -1,133 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fat_model_auth (4.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- actionpack (5.1.4)
10
- actionview (= 5.1.4)
11
- activesupport (= 5.1.4)
12
- rack (~> 2.0)
13
- rack-test (>= 0.6.3)
14
- rails-dom-testing (~> 2.0)
15
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
16
- actionview (5.1.4)
17
- activesupport (= 5.1.4)
18
- builder (~> 3.1)
19
- erubi (~> 1.4)
20
- rails-dom-testing (~> 2.0)
21
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
22
- activemodel (5.1.4)
23
- activesupport (= 5.1.4)
24
- activerecord (5.1.4)
25
- activemodel (= 5.1.4)
26
- activesupport (= 5.1.4)
27
- arel (~> 8.0)
28
- activesupport (5.1.4)
29
- concurrent-ruby (~> 1.0, >= 1.0.2)
30
- i18n (~> 0.7)
31
- minitest (~> 5.1)
32
- tzinfo (~> 1.1)
33
- arel (8.0.0)
34
- awesome_print (1.8.0)
35
- builder (3.2.3)
36
- coderay (1.1.2)
37
- concurrent-ruby (1.0.5)
38
- crass (1.0.3)
39
- diff-lcs (1.3)
40
- erubi (1.7.0)
41
- ffi (1.9.18)
42
- ffi (1.9.18-x86-mingw32)
43
- formatador (0.2.5)
44
- guard (2.14.2)
45
- formatador (>= 0.2.4)
46
- listen (>= 2.7, < 4.0)
47
- lumberjack (>= 1.0.12, < 2.0)
48
- nenv (~> 0.1)
49
- notiffany (~> 0.0)
50
- pry (>= 0.9.12)
51
- shellany (~> 0.0)
52
- thor (>= 0.18.1)
53
- guard-compat (1.2.1)
54
- guard-rspec (4.7.3)
55
- guard (~> 2.1)
56
- guard-compat (~> 1.1)
57
- rspec (>= 2.99.0, < 4.0)
58
- i18n (0.9.1)
59
- concurrent-ruby (~> 1.0)
60
- listen (3.1.5)
61
- rb-fsevent (~> 0.9, >= 0.9.4)
62
- rb-inotify (~> 0.9, >= 0.9.7)
63
- ruby_dep (~> 1.2)
64
- loofah (2.1.1)
65
- crass (~> 1.0.2)
66
- nokogiri (>= 1.5.9)
67
- lumberjack (1.0.12)
68
- method_source (0.9.0)
69
- mini_portile2 (2.3.0)
70
- minitest (5.11.1)
71
- nenv (0.3.0)
72
- nokogiri (1.8.1)
73
- mini_portile2 (~> 2.3.0)
74
- nokogiri (1.8.1-x86-mingw32)
75
- mini_portile2 (~> 2.3.0)
76
- notiffany (0.1.1)
77
- nenv (~> 0.1)
78
- shellany (~> 0.0)
79
- pry (0.11.3)
80
- coderay (~> 1.1.0)
81
- method_source (~> 0.9.0)
82
- rack (2.0.3)
83
- rack-test (0.8.2)
84
- rack (>= 1.0, < 3)
85
- rails-dom-testing (2.0.3)
86
- activesupport (>= 4.2.0)
87
- nokogiri (>= 1.6)
88
- rails-html-sanitizer (1.0.3)
89
- loofah (~> 2.0)
90
- rake (10.3.2)
91
- rb-fsevent (0.10.2)
92
- rb-inotify (0.9.10)
93
- ffi (>= 0.5.0, < 2)
94
- rspec (3.7.0)
95
- rspec-core (~> 3.7.0)
96
- rspec-expectations (~> 3.7.0)
97
- rspec-mocks (~> 3.7.0)
98
- rspec-core (3.7.1)
99
- rspec-support (~> 3.7.0)
100
- rspec-expectations (3.7.0)
101
- diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.7.0)
103
- rspec-mocks (3.7.0)
104
- diff-lcs (>= 1.2.0, < 2.0)
105
- rspec-support (~> 3.7.0)
106
- rspec-support (3.7.0)
107
- ruby_dep (1.5.0)
108
- shellany (0.0.1)
109
- sqlite3 (1.3.13)
110
- sqlite3 (1.3.13-x86-mingw32)
111
- thor (0.20.0)
112
- thread_safe (0.3.6)
113
- tzinfo (1.2.4)
114
- thread_safe (~> 0.1)
115
-
116
- PLATFORMS
117
- ruby
118
- x86-mingw32
119
-
120
- DEPENDENCIES
121
- actionpack (~> 5.1)
122
- activerecord (~> 5.1)
123
- activesupport (~> 5.1)
124
- awesome_print
125
- bundler
126
- fat_model_auth!
127
- guard-rspec
128
- rake (~> 10.0)
129
- rspec
130
- sqlite3
131
-
132
- BUNDLED WITH
133
- 1.16.1
data/Guardfile DELETED
@@ -1,72 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- ## Uncomment and set this to only include directories you want to watch
5
- # directories %w(app lib config test spec features) \
6
- # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
-
8
- ## Note: if you are using the `directories` clause above and you are not
9
- ## watching the project directory ('.'), then you will want to move
10
- ## the Guardfile to a watched dir and symlink it back, e.g.
11
- #
12
- # $ mkdir config
13
- # $ mv Guardfile config/
14
- # $ ln -s config/Guardfile .
15
- #
16
- # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
-
18
- # Note: The cmd option is now required due to the increasing number of ways
19
- # rspec may be run, below are examples of the most common uses.
20
- # * bundler: 'bundle exec rspec'
21
- # * bundler binstubs: 'bin/rspec'
22
- # * spring: 'bin/rspec' (This will use spring if running and you have
23
- # installed the spring binstubs per the docs)
24
- # * zeus: 'zeus rspec' (requires the server to be started separately)
25
- # * 'just' rspec: 'rspec'
26
-
27
- guard :rspec, cmd: "bundle exec rspec" do
28
- require "guard/rspec/dsl"
29
- dsl = Guard::RSpec::Dsl.new(self)
30
-
31
- # Feel free to open issues for suggestions and improvements
32
-
33
- clearing :on
34
-
35
- # RSpec files
36
- rspec = dsl.rspec
37
- watch(rspec.spec_helper) { rspec.spec_dir }
38
- watch(rspec.spec_support) { rspec.spec_dir }
39
- watch(rspec.spec_files)
40
-
41
- # Ruby files
42
- ruby = dsl.ruby
43
- dsl.watch_spec_files_for(ruby.lib_files)
44
-
45
- # Rails files
46
- rails = dsl.rails(view_extensions: %w(erb haml slim))
47
- dsl.watch_spec_files_for(rails.app_files)
48
- dsl.watch_spec_files_for(rails.views)
49
-
50
- watch(rails.controllers) do |m|
51
- [
52
- rspec.spec.call("routing/#{m[1]}_routing"),
53
- rspec.spec.call("controllers/#{m[1]}_controller"),
54
- rspec.spec.call("acceptance/#{m[1]}")
55
- ]
56
- end
57
-
58
- # Rails config changes
59
- watch(rails.spec_helper) { rspec.spec_dir }
60
- watch(rails.routes) { "#{rspec.spec_dir}/routing" }
61
- watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
62
-
63
- # Capybara features specs
64
- watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
65
- watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
66
-
67
- # Turnip features and steps
68
- watch(%r{^spec/acceptance/(.+)\.feature$})
69
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
70
- Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
71
- end
72
- end
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2009 [Brent Greeff]
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.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.0.0
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "fat_model_auth"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,36 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "fat_model_auth/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "fat_model_auth"
7
- spec.version = FatModelAuth::VERSION
8
- spec.authors = ["Brent Greeff"]
9
- spec.email = ["email@brentgreeff.com"]
10
-
11
- spec.summary = %q{Clean resource based Authorisation system for Rails.}
12
- spec.description = %q{Define the rules for accessing resources through a simple DSL.}
13
- spec.homepage = "https://github.com/brentgreeff/fat_model_auth"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
18
- end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
22
-
23
- spec.add_development_dependency "activesupport", "~> 5.1"
24
- spec.add_development_dependency "activerecord", "~> 5.1"
25
- spec.add_development_dependency "actionpack", "~> 5.1"
26
- spec.add_development_dependency "sqlite3"
27
-
28
- spec.add_development_dependency "bundler"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec"
31
-
32
- spec.add_development_dependency "guard-rspec"
33
- # spec.add_development_dependency "cucumber"
34
- # spec.add_development_dependency "aruba"
35
- spec.add_development_dependency "awesome_print"
36
- end