action_bouncer 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea988351cd9b96ae83cfcb77a9523a6012d87eac
4
- data.tar.gz: 9a7046bfc38c1f086854076f45a80a5535ceb621
3
+ metadata.gz: 98afc04146163930bec5b7857b33476acf994968
4
+ data.tar.gz: 0c80b87b56de12a028680089928da322b989ef4b
5
5
  SHA512:
6
- metadata.gz: 44b598c4812fb59bc9ba1758ee9d59e76119bc89347537771cf50f9ff85abcb252582f741f594f3e7f7512a0b0873e4accbfcae243d61a1286037e68317545fd
7
- data.tar.gz: 800b74c749214f02d234e9c7787b61205b2ad2be53720e5b2cb4332c67518575a43d28f4f9fb09d2dc7d34ea8faf5ca434e99d48139d89f3ea37f84745af4d7c
6
+ metadata.gz: 844c0be86c5ae2f3f643cb0391e9182d080ca40ce4676ad2369d9c1907ee9e5ab4174510b0e7c97d1575fe9ad9b00e026f3a0469e3e30f59fd8c97a4c42b505b
7
+ data.tar.gz: fa7f2f7578fecec2aa65d992b78d80d3a644415e931172fa54d4af9d0f6e18faca872ebe89bd274d085a02c6470bd834499c7e9f7261c4320207069539ae3a6b
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # ActionBouncer
2
2
 
3
- [![Circle CI](https://circleci.com/gh/oswaldoferreira/action_bouncer/tree/master.svg?style=svg)](https://circleci.com/gh/oswaldoferreira/action_bouncer/tree/master)
3
+ [![Build Status](https://travis-ci.org/oswaldoferreira/action_bouncer.svg?branch=master)](https://travis-ci.org/oswaldoferreira/action_bouncer)
4
+ [![Test Coverage](https://codeclimate.com/github/oswaldoferreira/action_bouncer/badges/coverage.svg)](https://codeclimate.com/github/oswaldoferreira/action_bouncer/coverage)
4
5
 
5
6
  It's a dead simple Rails authorization lib for well defined authorization objects interfaces.
6
7
 
@@ -5,7 +5,7 @@ module ActionBouncer
5
5
  def self.included(klass)
6
6
  klass.class_eval do
7
7
  def self.allow(resource, options)
8
- @_allowances ||= []
8
+ @_allowances ||= []
9
9
  @_allowances << Allowance.new(resource, options)
10
10
  end
11
11
 
@@ -6,9 +6,10 @@ module ActionBouncer
6
6
  @resource_sym, @options = resource_sym, options
7
7
  end
8
8
 
9
- def not_allowed?(controller, action)
9
+ def allowed?(controller, action)
10
10
  resource = controller.send(@resource_sym)
11
- !allowed_action?(action) || !matches_resource_condition?(resource)
11
+ exception_action?(action) ||
12
+ (allowed_action?(action) && matches_resource_condition?(resource))
12
13
  end
13
14
 
14
15
  private
@@ -17,6 +18,10 @@ module ActionBouncer
17
18
  allowed_actions.include?(action.to_sym) || allowed_actions.include?(:all)
18
19
  end
19
20
 
21
+ def exception_action?(action)
22
+ exception_actions.include?(action.to_sym)
23
+ end
24
+
20
25
  def matches_resource_condition?(resource)
21
26
  conditions.any? { |condition| resource.send(condition).present? }
22
27
  end
@@ -25,6 +30,10 @@ module ActionBouncer
25
30
  Array.wrap(@options[:to])
26
31
  end
27
32
 
33
+ def exception_actions
34
+ Array.wrap(@options[:except])
35
+ end
36
+
28
37
  def conditions
29
38
  Array.wrap(@options[:if])
30
39
  end
@@ -8,14 +8,14 @@ module ActionBouncer
8
8
 
9
9
  def authorize!(controller)
10
10
  return if @allowances.nil?
11
- fail Unauthorized if unauthorized?(controller)
11
+ fail Unauthorized unless authorized?(controller)
12
12
  end
13
13
 
14
14
  private
15
15
 
16
- def unauthorized?(controller)
16
+ def authorized?(controller)
17
17
  action = controller.send(:params).fetch(:action)
18
- @allowances.all? { |allowance| allowance.not_allowed?(controller, action) }
18
+ @allowances.any? { |allowance| allowance.allowed?(controller, action) }
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module ActionBouncer
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ class ExceptParamController < ActionController::Base
4
+ helper_method :current_user
5
+
6
+ include ActionBouncer
7
+
8
+ allow :current_user,
9
+ to: [:index, :new],
10
+ except: :edit,
11
+ if: :admin?
12
+
13
+ def index
14
+ render nothing: true, status: :success
15
+ end
16
+
17
+ def new
18
+ render nothing: true, status: :success
19
+ end
20
+
21
+ def edit
22
+ render nothing: true, status: :success
23
+ end
24
+ end
25
+
26
+ describe ExceptParamController do
27
+ before do
28
+ Rails.application.routes.draw do
29
+ get '/index' => 'except_param#index'
30
+ get '/new' => 'except_param#new'
31
+ get '/edit' => 'except_param#edit'
32
+ end
33
+ end
34
+
35
+ context 'when authorized' do
36
+ before do
37
+ allow(subject).to receive(:current_user) { OpenStruct.new(admin?: true) }
38
+ end
39
+
40
+ it { expect{ get :edit }.not_to raise_error }
41
+ it { expect{ get :index }.not_to raise_error }
42
+ it { expect{ get :new }.not_to raise_error }
43
+ end
44
+
45
+ context 'when not authorized' do
46
+ before do
47
+ allow(subject).to receive(:current_user) { OpenStruct.new(admin?: false) }
48
+ end
49
+
50
+ it { expect{ get :edit }.not_to raise_error }
51
+ it { expect{ get :index }.to raise_error{ ActionBouncer::Unauthorized } }
52
+ it { expect{ get :new }.to raise_error{ ActionBouncer::Unauthorized } }
53
+ end
54
+ end
55
+
@@ -2709,3 +2709,645 @@ Processing by MultipleAllowancesController#index as HTML
2709
2709
  Rendered text template (0.0ms)
2710
2710
  Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2711
2711
   (0.1ms) rollback transaction
2712
+  (0.3ms) begin transaction
2713
+ Processing by ArrayParamsController#edit as HTML
2714
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2715
+  (0.1ms) rollback transaction
2716
+  (0.1ms) begin transaction
2717
+ Processing by ArrayParamsController#new as HTML
2718
+ Rendered text template (0.0ms)
2719
+ Completed 500 Internal Server Error in 9ms (Views: 8.7ms | ActiveRecord: 0.0ms)
2720
+  (0.1ms) rollback transaction
2721
+  (0.0ms) begin transaction
2722
+ Processing by ArrayParamsController#index as HTML
2723
+ Rendered text template (0.0ms)
2724
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2725
+  (0.1ms) rollback transaction
2726
+  (0.1ms) begin transaction
2727
+ Processing by SymbolParamsController#new as HTML
2728
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2729
+  (0.1ms) rollback transaction
2730
+  (0.1ms) begin transaction
2731
+ Processing by SymbolParamsController#index as HTML
2732
+ Rendered text template (0.0ms)
2733
+ Completed 500 Internal Server Error in 3ms (Views: 2.9ms | ActiveRecord: 0.0ms)
2734
+  (0.1ms) rollback transaction
2735
+  (0.1ms) begin transaction
2736
+ Processing by NoSetupController#index as HTML
2737
+ Rendered text template (0.0ms)
2738
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
2739
+  (0.1ms) rollback transaction
2740
+  (0.1ms) begin transaction
2741
+ Processing by MultipleAllowancesController#new as HTML
2742
+ Rendered text template (0.0ms)
2743
+ Completed 500 Internal Server Error in 3ms (Views: 2.3ms | ActiveRecord: 0.0ms)
2744
+  (0.1ms) rollback transaction
2745
+  (0.1ms) begin transaction
2746
+ Processing by MultipleAllowancesController#edit as HTML
2747
+ Rendered text template (0.0ms)
2748
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2749
+  (0.1ms) rollback transaction
2750
+  (0.1ms) begin transaction
2751
+ Processing by MultipleAllowancesController#index as HTML
2752
+ Rendered text template (0.0ms)
2753
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2754
+  (0.1ms) rollback transaction
2755
+  (0.1ms) begin transaction
2756
+ Processing by MultipleAllowancesController#new as HTML
2757
+ Rendered text template (0.0ms)
2758
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2759
+  (0.1ms) rollback transaction
2760
+  (0.1ms) begin transaction
2761
+ Processing by MultipleAllowancesController#index as HTML
2762
+ Rendered text template (0.0ms)
2763
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2764
+  (0.1ms) rollback transaction
2765
+  (0.1ms) begin transaction
2766
+ Processing by MultipleAllowancesController#edit as HTML
2767
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2768
+  (0.1ms) rollback transaction
2769
+  (0.1ms) begin transaction
2770
+ Processing by AllParamController#index as HTML
2771
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2772
+  (0.1ms) rollback transaction
2773
+  (0.1ms) begin transaction
2774
+ Processing by AllParamController#new as HTML
2775
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
2776
+  (0.1ms) rollback transaction
2777
+  (0.1ms) begin transaction
2778
+ Processing by AllParamController#edit as HTML
2779
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2780
+  (0.1ms) rollback transaction
2781
+  (0.1ms) begin transaction
2782
+ Processing by AllParamController#index as HTML
2783
+ Rendered text template (0.0ms)
2784
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
2785
+  (0.1ms) rollback transaction
2786
+  (0.1ms) begin transaction
2787
+ Processing by AllParamController#edit as HTML
2788
+ Rendered text template (0.0ms)
2789
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2790
+  (0.1ms) rollback transaction
2791
+  (0.1ms) begin transaction
2792
+ Processing by AllParamController#new as HTML
2793
+ Rendered text template (0.0ms)
2794
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2795
+  (0.1ms) rollback transaction
2796
+  (0.3ms) begin transaction
2797
+ Processing by ArrayParamsController#edit as HTML
2798
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2799
+  (0.1ms) rollback transaction
2800
+  (0.1ms) begin transaction
2801
+ Processing by ArrayParamsController#index as HTML
2802
+ Rendered text template (0.0ms)
2803
+ Completed 500 Internal Server Error in 10ms (Views: 9.3ms | ActiveRecord: 0.0ms)
2804
+  (0.1ms) rollback transaction
2805
+  (0.1ms) begin transaction
2806
+ Processing by ArrayParamsController#new as HTML
2807
+ Rendered text template (0.0ms)
2808
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2809
+  (0.1ms) rollback transaction
2810
+  (0.1ms) begin transaction
2811
+ Processing by AllParamController#edit as HTML
2812
+ Rendered text template (0.0ms)
2813
+ Completed 500 Internal Server Error in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms)
2814
+  (0.1ms) rollback transaction
2815
+  (0.1ms) begin transaction
2816
+ Processing by AllParamController#index as HTML
2817
+ Rendered text template (0.0ms)
2818
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2819
+  (0.1ms) rollback transaction
2820
+  (0.1ms) begin transaction
2821
+ Processing by AllParamController#new as HTML
2822
+ Rendered text template (0.0ms)
2823
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2824
+  (0.1ms) rollback transaction
2825
+  (0.2ms) begin transaction
2826
+ Processing by AllParamController#index as HTML
2827
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2828
+  (0.1ms) rollback transaction
2829
+  (0.1ms) begin transaction
2830
+ Processing by AllParamController#edit as HTML
2831
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2832
+  (0.1ms) rollback transaction
2833
+  (0.1ms) begin transaction
2834
+ Processing by AllParamController#new as HTML
2835
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2836
+  (0.1ms) rollback transaction
2837
+  (0.0ms) begin transaction
2838
+ Processing by SymbolParamsController#new as HTML
2839
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2840
+  (0.1ms) rollback transaction
2841
+  (0.1ms) begin transaction
2842
+ Processing by SymbolParamsController#index as HTML
2843
+ Rendered text template (0.0ms)
2844
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
2845
+  (0.1ms) rollback transaction
2846
+  (0.1ms) begin transaction
2847
+ Processing by MultipleAllowancesController#edit as HTML
2848
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2849
+  (0.1ms) rollback transaction
2850
+  (0.0ms) begin transaction
2851
+ Processing by MultipleAllowancesController#index as HTML
2852
+ Rendered text template (0.0ms)
2853
+ Completed 500 Internal Server Error in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
2854
+  (0.1ms) rollback transaction
2855
+  (0.1ms) begin transaction
2856
+ Processing by MultipleAllowancesController#new as HTML
2857
+ Rendered text template (0.0ms)
2858
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2859
+  (0.1ms) rollback transaction
2860
+  (0.1ms) begin transaction
2861
+ Processing by MultipleAllowancesController#new as HTML
2862
+ Rendered text template (0.0ms)
2863
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2864
+  (0.1ms) rollback transaction
2865
+  (0.1ms) begin transaction
2866
+ Processing by MultipleAllowancesController#index as HTML
2867
+ Rendered text template (0.0ms)
2868
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2869
+  (0.1ms) rollback transaction
2870
+  (0.1ms) begin transaction
2871
+ Processing by MultipleAllowancesController#edit as HTML
2872
+ Rendered text template (0.0ms)
2873
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2874
+  (0.1ms) rollback transaction
2875
+  (0.1ms) begin transaction
2876
+ Processing by NoSetupController#index as HTML
2877
+ Rendered text template (0.0ms)
2878
+ Completed 500 Internal Server Error in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
2879
+  (0.1ms) rollback transaction
2880
+  (0.3ms) begin transaction
2881
+ Processing by ArrayParamsController#index as HTML
2882
+ Rendered text template (0.0ms)
2883
+ Completed 500 Internal Server Error in 9ms (Views: 8.5ms | ActiveRecord: 0.0ms)
2884
+  (0.1ms) rollback transaction
2885
+  (0.1ms) begin transaction
2886
+ Processing by ArrayParamsController#edit as HTML
2887
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2888
+  (0.1ms) rollback transaction
2889
+  (0.1ms) begin transaction
2890
+ Processing by ArrayParamsController#new as HTML
2891
+ Rendered text template (0.0ms)
2892
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2893
+  (0.1ms) rollback transaction
2894
+  (0.1ms) begin transaction
2895
+ Processing by MultipleAllowancesController#edit as HTML
2896
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
2897
+  (0.1ms) rollback transaction
2898
+  (0.1ms) begin transaction
2899
+ Processing by MultipleAllowancesController#new as HTML
2900
+ Rendered text template (0.0ms)
2901
+ Completed 500 Internal Server Error in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
2902
+  (0.1ms) rollback transaction
2903
+  (0.1ms) begin transaction
2904
+ Processing by MultipleAllowancesController#edit as HTML
2905
+ Rendered text template (0.0ms)
2906
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2907
+  (0.1ms) rollback transaction
2908
+  (0.1ms) begin transaction
2909
+ Processing by MultipleAllowancesController#index as HTML
2910
+ Rendered text template (0.0ms)
2911
+ Completed 500 Internal Server Error in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
2912
+  (0.1ms) rollback transaction
2913
+  (0.1ms) begin transaction
2914
+ Processing by MultipleAllowancesController#new as HTML
2915
+ Rendered text template (0.0ms)
2916
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2917
+  (0.1ms) rollback transaction
2918
+  (0.1ms) begin transaction
2919
+ Processing by MultipleAllowancesController#index as HTML
2920
+ Rendered text template (0.0ms)
2921
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2922
+  (0.1ms) rollback transaction
2923
+  (0.1ms) begin transaction
2924
+ Processing by SymbolParamsController#new as HTML
2925
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2926
+  (0.1ms) rollback transaction
2927
+  (0.1ms) begin transaction
2928
+ Processing by SymbolParamsController#index as HTML
2929
+ Rendered text template (0.0ms)
2930
+ Completed 500 Internal Server Error in 3ms (Views: 3.3ms | ActiveRecord: 0.0ms)
2931
+  (0.1ms) rollback transaction
2932
+  (0.2ms) begin transaction
2933
+ Processing by AllParamController#new as HTML
2934
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2935
+  (0.1ms) rollback transaction
2936
+  (0.1ms) begin transaction
2937
+ Processing by AllParamController#index as HTML
2938
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2939
+  (0.1ms) rollback transaction
2940
+  (0.1ms) begin transaction
2941
+ Processing by AllParamController#edit as HTML
2942
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2943
+  (0.1ms) rollback transaction
2944
+  (0.1ms) begin transaction
2945
+ Processing by AllParamController#new as HTML
2946
+ Rendered text template (0.0ms)
2947
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
2948
+  (0.1ms) rollback transaction
2949
+  (0.1ms) begin transaction
2950
+ Processing by AllParamController#index as HTML
2951
+ Rendered text template (0.0ms)
2952
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2953
+  (0.1ms) rollback transaction
2954
+  (0.1ms) begin transaction
2955
+ Processing by AllParamController#edit as HTML
2956
+ Rendered text template (0.0ms)
2957
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2958
+  (0.1ms) rollback transaction
2959
+  (0.1ms) begin transaction
2960
+ Processing by NoSetupController#index as HTML
2961
+ Rendered text template (0.0ms)
2962
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
2963
+  (0.1ms) rollback transaction
2964
+  (0.3ms) begin transaction
2965
+ Processing by MultipleAllowancesController#index as HTML
2966
+ Rendered text template (0.0ms)
2967
+ Completed 500 Internal Server Error in 9ms (Views: 8.5ms | ActiveRecord: 0.0ms)
2968
+  (0.1ms) rollback transaction
2969
+  (0.1ms) begin transaction
2970
+ Processing by MultipleAllowancesController#new as HTML
2971
+ Rendered text template (0.0ms)
2972
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2973
+  (0.1ms) rollback transaction
2974
+  (0.1ms) begin transaction
2975
+ Processing by MultipleAllowancesController#edit as HTML
2976
+ Rendered text template (0.0ms)
2977
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2978
+  (0.1ms) rollback transaction
2979
+  (0.1ms) begin transaction
2980
+ Processing by MultipleAllowancesController#index as HTML
2981
+ Rendered text template (0.0ms)
2982
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2983
+  (0.1ms) rollback transaction
2984
+  (0.1ms) begin transaction
2985
+ Processing by MultipleAllowancesController#new as HTML
2986
+ Rendered text template (0.0ms)
2987
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
2988
+  (0.1ms) rollback transaction
2989
+  (0.1ms) begin transaction
2990
+ Processing by MultipleAllowancesController#edit as HTML
2991
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
2992
+  (0.1ms) rollback transaction
2993
+  (0.1ms) begin transaction
2994
+ Processing by ArrayParamsController#new as HTML
2995
+ Rendered text template (0.0ms)
2996
+ Completed 500 Internal Server Error in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
2997
+  (0.1ms) rollback transaction
2998
+  (0.1ms) begin transaction
2999
+ Processing by ArrayParamsController#edit as HTML
3000
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3001
+  (0.1ms) rollback transaction
3002
+  (0.1ms) begin transaction
3003
+ Processing by ArrayParamsController#index as HTML
3004
+ Rendered text template (0.0ms)
3005
+ Completed 500 Internal Server Error in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
3006
+  (0.1ms) rollback transaction
3007
+  (0.1ms) begin transaction
3008
+ Processing by SymbolParamsController#index as HTML
3009
+ Rendered text template (0.0ms)
3010
+ Completed 500 Internal Server Error in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
3011
+  (0.1ms) rollback transaction
3012
+  (0.1ms) begin transaction
3013
+ Processing by SymbolParamsController#new as HTML
3014
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3015
+  (0.1ms) rollback transaction
3016
+  (0.1ms) begin transaction
3017
+ Processing by NoSetupController#index as HTML
3018
+ Rendered text template (0.0ms)
3019
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
3020
+  (0.2ms) rollback transaction
3021
+  (0.1ms) begin transaction
3022
+ Processing by AllParamController#index as HTML
3023
+ Rendered text template (0.0ms)
3024
+ Completed 500 Internal Server Error in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
3025
+  (0.1ms) rollback transaction
3026
+  (0.1ms) begin transaction
3027
+ Processing by AllParamController#edit as HTML
3028
+ Rendered text template (0.0ms)
3029
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3030
+  (0.1ms) rollback transaction
3031
+  (0.1ms) begin transaction
3032
+ Processing by AllParamController#new as HTML
3033
+ Rendered text template (0.0ms)
3034
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3035
+  (0.1ms) rollback transaction
3036
+  (0.1ms) begin transaction
3037
+ Processing by AllParamController#index as HTML
3038
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3039
+  (0.1ms) rollback transaction
3040
+  (0.1ms) begin transaction
3041
+ Processing by AllParamController#edit as HTML
3042
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3043
+  (0.1ms) rollback transaction
3044
+  (0.1ms) begin transaction
3045
+ Processing by AllParamController#new as HTML
3046
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3047
+  (0.1ms) rollback transaction
3048
+  (0.3ms) begin transaction
3049
+ Processing by SymbolParamsController#new as HTML
3050
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3051
+  (0.1ms) rollback transaction
3052
+  (0.0ms) begin transaction
3053
+ Processing by SymbolParamsController#index as HTML
3054
+ Rendered text template (0.0ms)
3055
+ Completed 500 Internal Server Error in 9ms (Views: 9.1ms | ActiveRecord: 0.0ms)
3056
+  (0.1ms) rollback transaction
3057
+  (0.1ms) begin transaction
3058
+ Processing by MultipleAllowancesController#edit as HTML
3059
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3060
+  (0.1ms) rollback transaction
3061
+  (0.1ms) begin transaction
3062
+ Processing by MultipleAllowancesController#index as HTML
3063
+ Rendered text template (0.0ms)
3064
+ Completed 500 Internal Server Error in 3ms (Views: 2.6ms | ActiveRecord: 0.0ms)
3065
+  (0.1ms) rollback transaction
3066
+  (0.0ms) begin transaction
3067
+ Processing by MultipleAllowancesController#edit as HTML
3068
+ Rendered text template (0.0ms)
3069
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3070
+  (0.1ms) rollback transaction
3071
+  (0.1ms) begin transaction
3072
+ Processing by MultipleAllowancesController#new as HTML
3073
+ Rendered text template (0.0ms)
3074
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3075
+  (0.1ms) rollback transaction
3076
+  (0.1ms) begin transaction
3077
+ Processing by MultipleAllowancesController#index as HTML
3078
+ Rendered text template (0.0ms)
3079
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3080
+  (0.1ms) rollback transaction
3081
+  (0.1ms) begin transaction
3082
+ Processing by MultipleAllowancesController#new as HTML
3083
+ Rendered text template (0.0ms)
3084
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3085
+  (0.1ms) rollback transaction
3086
+  (0.1ms) begin transaction
3087
+ Processing by NoSetupController#index as HTML
3088
+ Rendered text template (0.0ms)
3089
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
3090
+  (0.1ms) rollback transaction
3091
+  (0.1ms) begin transaction
3092
+ Processing by AllParamController#new as HTML
3093
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3094
+  (0.1ms) rollback transaction
3095
+  (0.1ms) begin transaction
3096
+ Processing by AllParamController#edit as HTML
3097
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3098
+  (0.1ms) rollback transaction
3099
+  (0.1ms) begin transaction
3100
+ Processing by AllParamController#index as HTML
3101
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3102
+  (0.1ms) rollback transaction
3103
+  (0.1ms) begin transaction
3104
+ Processing by AllParamController#index as HTML
3105
+ Rendered text template (0.0ms)
3106
+ Completed 500 Internal Server Error in 3ms (Views: 2.3ms | ActiveRecord: 0.0ms)
3107
+  (0.1ms) rollback transaction
3108
+  (0.1ms) begin transaction
3109
+ Processing by AllParamController#new as HTML
3110
+ Rendered text template (0.0ms)
3111
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3112
+  (0.1ms) rollback transaction
3113
+  (0.1ms) begin transaction
3114
+ Processing by AllParamController#edit as HTML
3115
+ Rendered text template (0.0ms)
3116
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3117
+  (0.1ms) rollback transaction
3118
+  (0.1ms) begin transaction
3119
+ Processing by ArrayParamsController#new as HTML
3120
+ Rendered text template (0.0ms)
3121
+ Completed 500 Internal Server Error in 3ms (Views: 2.5ms | ActiveRecord: 0.0ms)
3122
+  (0.2ms) rollback transaction
3123
+  (0.1ms) begin transaction
3124
+ Processing by ArrayParamsController#edit as HTML
3125
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3126
+  (0.1ms) rollback transaction
3127
+  (0.1ms) begin transaction
3128
+ Processing by ArrayParamsController#index as HTML
3129
+ Rendered text template (0.0ms)
3130
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3131
+  (0.1ms) rollback transaction
3132
+  (0.3ms) begin transaction
3133
+ Processing by NoSetupController#index as HTML
3134
+ Rendered text template (0.0ms)
3135
+ Completed 500 Internal Server Error in 8ms (Views: 8.2ms | ActiveRecord: 0.0ms)
3136
+  (0.1ms) rollback transaction
3137
+  (0.1ms) begin transaction
3138
+ Processing by ArrayParamsController#index as HTML
3139
+ Rendered text template (0.0ms)
3140
+ Completed 500 Internal Server Error in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
3141
+  (0.1ms) rollback transaction
3142
+  (0.1ms) begin transaction
3143
+ Processing by ArrayParamsController#new as HTML
3144
+ Rendered text template (0.1ms)
3145
+ Completed 500 Internal Server Error in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
3146
+  (0.1ms) rollback transaction
3147
+  (0.1ms) begin transaction
3148
+ Processing by ArrayParamsController#edit as HTML
3149
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3150
+  (0.1ms) rollback transaction
3151
+  (0.1ms) begin transaction
3152
+ Processing by MultipleAllowancesController#edit as HTML
3153
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3154
+  (0.1ms) rollback transaction
3155
+  (0.1ms) begin transaction
3156
+ Processing by MultipleAllowancesController#new as HTML
3157
+ Rendered text template (0.0ms)
3158
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
3159
+  (0.1ms) rollback transaction
3160
+  (0.1ms) begin transaction
3161
+ Processing by MultipleAllowancesController#index as HTML
3162
+ Rendered text template (0.0ms)
3163
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3164
+  (0.1ms) rollback transaction
3165
+  (0.1ms) begin transaction
3166
+ Processing by MultipleAllowancesController#index as HTML
3167
+ Rendered text template (0.0ms)
3168
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3169
+  (0.1ms) rollback transaction
3170
+  (0.1ms) begin transaction
3171
+ Processing by MultipleAllowancesController#edit as HTML
3172
+ Rendered text template (0.0ms)
3173
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3174
+  (0.1ms) rollback transaction
3175
+  (0.1ms) begin transaction
3176
+ Processing by MultipleAllowancesController#new as HTML
3177
+ Rendered text template (0.0ms)
3178
+ Completed 500 Internal Server Error in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
3179
+  (0.1ms) rollback transaction
3180
+  (0.1ms) begin transaction
3181
+ Processing by AllParamController#index as HTML
3182
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3183
+  (0.1ms) rollback transaction
3184
+  (0.1ms) begin transaction
3185
+ Processing by AllParamController#new as HTML
3186
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3187
+  (0.1ms) rollback transaction
3188
+  (0.1ms) begin transaction
3189
+ Processing by AllParamController#edit as HTML
3190
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3191
+  (0.1ms) rollback transaction
3192
+  (0.1ms) begin transaction
3193
+ Processing by AllParamController#index as HTML
3194
+ Rendered text template (0.1ms)
3195
+ Completed 500 Internal Server Error in 3ms (Views: 2.8ms | ActiveRecord: 0.0ms)
3196
+  (0.1ms) rollback transaction
3197
+  (0.1ms) begin transaction
3198
+ Processing by AllParamController#new as HTML
3199
+ Rendered text template (0.0ms)
3200
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3201
+  (0.1ms) rollback transaction
3202
+  (0.1ms) begin transaction
3203
+ Processing by AllParamController#edit as HTML
3204
+ Rendered text template (0.1ms)
3205
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3206
+  (0.1ms) rollback transaction
3207
+  (0.0ms) begin transaction
3208
+ Processing by SymbolParamsController#index as HTML
3209
+ Rendered text template (0.0ms)
3210
+ Completed 500 Internal Server Error in 3ms (Views: 2.3ms | ActiveRecord: 0.0ms)
3211
+  (0.1ms) rollback transaction
3212
+  (0.0ms) begin transaction
3213
+ Processing by SymbolParamsController#new as HTML
3214
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3215
+  (0.1ms) rollback transaction
3216
+  (0.3ms) begin transaction
3217
+ Processing by AllParamController#index as HTML
3218
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3219
+  (0.1ms) rollback transaction
3220
+  (0.1ms) begin transaction
3221
+ Processing by AllParamController#new as HTML
3222
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3223
+  (0.1ms) rollback transaction
3224
+  (0.1ms) begin transaction
3225
+ Processing by AllParamController#edit as HTML
3226
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3227
+  (0.1ms) rollback transaction
3228
+  (0.1ms) begin transaction
3229
+ Processing by AllParamController#edit as HTML
3230
+ Rendered text template (0.0ms)
3231
+ Completed 500 Internal Server Error in 7ms (Views: 6.7ms | ActiveRecord: 0.0ms)
3232
+  (0.1ms) rollback transaction
3233
+  (0.0ms) begin transaction
3234
+ Processing by AllParamController#new as HTML
3235
+ Rendered text template (0.0ms)
3236
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3237
+  (0.1ms) rollback transaction
3238
+  (0.1ms) begin transaction
3239
+ Processing by AllParamController#index as HTML
3240
+ Rendered text template (0.0ms)
3241
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3242
+  (0.1ms) rollback transaction
3243
+  (0.2ms) begin transaction
3244
+ Processing by ArrayParamsController#index as HTML
3245
+ Rendered text template (0.0ms)
3246
+ Completed 500 Internal Server Error in 3ms (Views: 2.8ms | ActiveRecord: 0.0ms)
3247
+  (0.1ms) rollback transaction
3248
+  (0.1ms) begin transaction
3249
+ Processing by ArrayParamsController#edit as HTML
3250
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3251
+  (0.1ms) rollback transaction
3252
+  (0.1ms) begin transaction
3253
+ Processing by ArrayParamsController#new as HTML
3254
+ Rendered text template (0.0ms)
3255
+ Completed 500 Internal Server Error in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
3256
+  (0.1ms) rollback transaction
3257
+  (0.1ms) begin transaction
3258
+ Processing by MultipleAllowancesController#edit as HTML
3259
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3260
+  (0.1ms) rollback transaction
3261
+  (0.1ms) begin transaction
3262
+ Processing by MultipleAllowancesController#index as HTML
3263
+ Rendered text template (0.0ms)
3264
+ Completed 500 Internal Server Error in 4ms (Views: 3.2ms | ActiveRecord: 0.0ms)
3265
+  (0.1ms) rollback transaction
3266
+  (0.1ms) begin transaction
3267
+ Processing by MultipleAllowancesController#new as HTML
3268
+ Rendered text template (0.0ms)
3269
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3270
+  (0.1ms) rollback transaction
3271
+  (0.1ms) begin transaction
3272
+ Processing by MultipleAllowancesController#edit as HTML
3273
+ Rendered text template (0.0ms)
3274
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3275
+  (0.1ms) rollback transaction
3276
+  (0.1ms) begin transaction
3277
+ Processing by MultipleAllowancesController#index as HTML
3278
+ Rendered text template (0.0ms)
3279
+ Completed 500 Internal Server Error in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
3280
+  (0.1ms) rollback transaction
3281
+  (0.1ms) begin transaction
3282
+ Processing by MultipleAllowancesController#new as HTML
3283
+ Rendered text template (0.0ms)
3284
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3285
+  (0.1ms) rollback transaction
3286
+  (0.1ms) begin transaction
3287
+ Processing by NoSetupController#index as HTML
3288
+ Rendered text template (0.0ms)
3289
+ Completed 500 Internal Server Error in 3ms (Views: 2.5ms | ActiveRecord: 0.0ms)
3290
+  (0.1ms) rollback transaction
3291
+  (0.1ms) begin transaction
3292
+ Processing by SymbolParamsController#new as HTML
3293
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3294
+  (0.1ms) rollback transaction
3295
+  (0.0ms) begin transaction
3296
+ Processing by SymbolParamsController#index as HTML
3297
+ Rendered text template (0.0ms)
3298
+ Completed 500 Internal Server Error in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
3299
+  (0.1ms) rollback transaction
3300
+  (0.3ms) begin transaction
3301
+ Processing by AllParamController#index as HTML
3302
+ Rendered text template (0.0ms)
3303
+ Completed 500 Internal Server Error in 10ms (Views: 9.2ms | ActiveRecord: 0.0ms)
3304
+  (0.1ms) rollback transaction
3305
+  (0.1ms) begin transaction
3306
+ Processing by AllParamController#edit as HTML
3307
+ Rendered text template (0.0ms)
3308
+ Completed 500 Internal Server Error in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3309
+  (0.1ms) rollback transaction
3310
+  (0.2ms) begin transaction
3311
+ Processing by AllParamController#new as HTML
3312
+ Rendered text template (0.0ms)
3313
+ Completed 500 Internal Server Error in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
3314
+  (0.1ms) rollback transaction
3315
+  (0.1ms) begin transaction
3316
+ Processing by AllParamController#new as HTML
3317
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3318
+  (0.1ms) rollback transaction
3319
+  (0.1ms) begin transaction
3320
+ Processing by AllParamController#edit as HTML
3321
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3322
+  (0.1ms) rollback transaction
3323
+  (0.1ms) begin transaction
3324
+ Processing by AllParamController#index as HTML
3325
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3326
+  (0.1ms) rollback transaction
3327
+  (0.3ms) begin transaction
3328
+ Processing by AllParamController#edit as HTML
3329
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3330
+  (0.1ms) rollback transaction
3331
+  (0.1ms) begin transaction
3332
+ Processing by AllParamController#index as HTML
3333
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3334
+  (0.1ms) rollback transaction
3335
+  (0.1ms) begin transaction
3336
+ Processing by AllParamController#new as HTML
3337
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
3338
+  (0.1ms) rollback transaction
3339
+  (0.1ms) begin transaction
3340
+ Processing by AllParamController#new as HTML
3341
+ Rendered text template (0.0ms)
3342
+ Completed 500 Internal Server Error in 8ms (Views: 7.1ms | ActiveRecord: 0.0ms)
3343
+  (0.1ms) rollback transaction
3344
+  (0.1ms) begin transaction
3345
+ Processing by AllParamController#index as HTML
3346
+ Rendered text template (0.0ms)
3347
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3348
+  (0.1ms) rollback transaction
3349
+  (0.1ms) begin transaction
3350
+ Processing by AllParamController#edit as HTML
3351
+ Rendered text template (0.0ms)
3352
+ Completed 500 Internal Server Error in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
3353
+  (0.1ms) rollback transaction
@@ -1,6 +1,9 @@
1
1
  # Configure Rails Environment
2
2
  ENV["RAILS_ENV"] = "test"
3
3
 
4
+ require "codeclimate-test-reporter"
5
+ CodeClimate::TestReporter.start
6
+
4
7
  require File.expand_path("../../spec/dummy/config/environment.rb", __FILE__)
5
8
  require "action_controller"
6
9
  require "rspec/rails"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_bouncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oswaldo Ferreira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,9 +66,9 @@ files:
66
66
  - lib/action_bouncer/allowance.rb
67
67
  - lib/action_bouncer/authorization.rb
68
68
  - lib/action_bouncer/version.rb
69
- - lib/tasks/action_bouncer_tasks.rake
70
69
  - spec/controllers/all_param_controller_spec.rb
71
70
  - spec/controllers/array_params_controller_spec.rb
71
+ - spec/controllers/except_param_controller_spec.rb
72
72
  - spec/controllers/multiple_allowances_controller_spec.rb
73
73
  - spec/controllers/no_setup_controller_spec.rb
74
74
  - spec/controllers/symbol_params_controller_spec.rb
@@ -138,6 +138,7 @@ summary: Dead simple rails authorization
138
138
  test_files:
139
139
  - spec/controllers/all_param_controller_spec.rb
140
140
  - spec/controllers/array_params_controller_spec.rb
141
+ - spec/controllers/except_param_controller_spec.rb
141
142
  - spec/controllers/multiple_allowances_controller_spec.rb
142
143
  - spec/controllers/no_setup_controller_spec.rb
143
144
  - spec/controllers/symbol_params_controller_spec.rb
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :action_bouncer do
3
- # # Task goes here
4
- # end