antispam 0.1.0 → 0.1.1

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: d0436bc2335d973b63d2ffb1e34a7a497ff9f86e2cf98d87c38fb2c5797f2fff
4
- data.tar.gz: a8cfe2b31913ba9c7a4ad9f0153b5f59c9b140c36cdcca20086ea7db94a8a8ba
3
+ metadata.gz: c7ff53aa93e140a619d1066589af51f818da3fefaf5444c6c03f02a1dce03130
4
+ data.tar.gz: d5aa2c041784330af13fa472aea02dfb5950d0c68ca4dd1f72a8414198c0601b
5
5
  SHA512:
6
- metadata.gz: 9755957fce4a89628c1e2b587ee046da5fccaf4692a5f0a596fa2dc5afea282a68d05d04a8ad82689f5e9d30c3660bad5fcbf75184141648b8e17ab0d693dfef
7
- data.tar.gz: 769deceafe70aafc9b5f98e1b1d995876ad98542a8c75a1633c75f6ea226331d5ce55270fce438f322927947fca539f59d60e6ea5e48603095c1e5656f906e96
6
+ metadata.gz: ae41d1216a47c3035e572a4c9646d4e29cfc022fff6010a878ed1bc31d2160bdfc1ce2f615e96d116517955cec18756111e1207ac0e4de384edcc010a30b0897
7
+ data.tar.gz: 983b88669af0fe6297ae47aab7379c559df7ea9a7144e3f93617ce67f6e4c8953ad27f7f23c7f525ba810c0b40b14301628ffd40dc881172a7e37c88645d0676
data/README.md CHANGED
@@ -27,7 +27,7 @@ You need to add this to your routes.rb
27
27
  mount Antispam::Engine => "/antispam"
28
28
  ```
29
29
  You can see what IP addresses have been blocked by going to /antispam/blocks
30
- but your applicationcontroller must have a user_has_role?("admin") function.
30
+ but your applicationcontroller must respond to ```is_admin?``` function.
31
31
 
32
32
 
33
33
  ## Installation
@@ -1,4 +1,11 @@
1
- module Antispam
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
1
+ module Antispam
2
+ class ApplicationController < ::ApplicationController
3
+ def must_be_admin
4
+ begin
5
+ render plain: 'Not available.' unless is_admin?
6
+ rescue
7
+ render plain: 'Not available.'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -3,7 +3,7 @@ require_dependency "antispam/application_controller"
3
3
  module Antispam
4
4
  class BlocksController < ApplicationController
5
5
  before_action :must_be_admin
6
- before_action :set_block, only: [:show, :edit, :update, :destroy]
6
+ before_action :set_block, only: [:show]
7
7
 
8
8
  # GET /blocks
9
9
  def index
@@ -14,41 +14,6 @@ module Antispam
14
14
  def show
15
15
  end
16
16
 
17
- # # GET /blocks/new
18
- # def new
19
- # @block = Block.new
20
- # end
21
- #
22
- # # GET /blocks/1/edit
23
- # def edit
24
- # end
25
- #
26
- # # POST /blocks
27
- # def create
28
- # @block = Block.new(block_params)
29
- #
30
- # if @block.save
31
- # redirect_to @block, notice: 'Block was successfully created.'
32
- # else
33
- # render :new
34
- # end
35
- # end
36
- #
37
- # # PATCH/PUT /blocks/1
38
- # def update
39
- # if @block.update(block_params)
40
- # redirect_to @block, notice: 'Block was successfully updated.'
41
- # else
42
- # render :edit
43
- # end
44
- # end
45
- #
46
- # # DELETE /blocks/1
47
- # def destroy
48
- # @block.destroy
49
- # redirect_to blocks_url, notice: 'Block was successfully destroyed.'
50
- # end
51
-
52
17
  private
53
18
  # Use callbacks to share common setup or constraints between actions.
54
19
  def set_block
@@ -59,12 +24,5 @@ module Antispam
59
24
  def block_params
60
25
  params.require(:block).permit(:ip, :provider, :controllername, :actionname)
61
26
  end
62
- def must_be_admin
63
- begin
64
- return false unless user_has_role?("admin")
65
- rescue
66
- return false
67
- end
68
- end
69
27
  end
70
28
  end
@@ -13,41 +13,6 @@ module Antispam
13
13
  # GET /clears/1
14
14
  def show
15
15
  end
16
- #
17
- # # GET /clears/new
18
- # def new
19
- # @clear = Clear.new
20
- # end
21
- #
22
- # # GET /clears/1/edit
23
- # def edit
24
- # end
25
- #
26
- # # POST /clears
27
- # def create
28
- # @clear = Clear.new(clear_params)
29
- #
30
- # if @clear.save
31
- # redirect_to @clear, notice: 'Clear was successfully created.'
32
- # else
33
- # render :new
34
- # end
35
- # end
36
- #
37
- # # PATCH/PUT /clears/1
38
- # def update
39
- # if @clear.update(clear_params)
40
- # redirect_to @clear, notice: 'Clear was successfully updated.'
41
- # else
42
- # render :edit
43
- # end
44
- # end
45
- #
46
- # # DELETE /clears/1
47
- # def destroy
48
- # @clear.destroy
49
- # redirect_to clears_url, notice: 'Clear was successfully destroyed.'
50
- # end
51
16
 
52
17
  private
53
18
  # Use callbacks to share common setup or constraints between actions.
@@ -1,11 +1,11 @@
1
- require "antispam/version"
2
- require "antispam/engine"
3
- require "antispam/tools"
4
- require "antispam/blacklists/httpbl"
5
-
6
- module Antispam
7
- ActiveSupport.on_load(:action_controller) do
8
- # self refers to ActionController::Base here
9
- self.include Antispam::Tools
10
- end
11
- end
1
+ require "antispam/version"
2
+ require "antispam/engine"
3
+ require "antispam/tools"
4
+ require "antispam/blacklists/httpbl"
5
+
6
+ module Antispam
7
+ ActiveSupport.on_load(:action_controller) do
8
+ # self refers to ActionController::Base here
9
+ self.include Antispam::Tools
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
- module Antispam
2
- VERSION = '0.1.0'
3
- end
1
+ module Antispam
2
+ VERSION = '0.1.1'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antispam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Kopf