action_permission 1.0.1 → 1.0.3

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: ed9979494907e04aeaa65a5e7512e1eab1b4a2b0
4
- data.tar.gz: 6e57506a7aaa20833b6f76cf56fe1eaa35a73b3b
3
+ metadata.gz: f4a1921690f8780609e6180e16512cce4f7ee1c9
4
+ data.tar.gz: f899b79c0f1248ca282216473c89d7c4bedbdda0
5
5
  SHA512:
6
- metadata.gz: 8af6fe719487ddc81abdd1346ffafd9a4f291124d29e756e6abc70555839a16f5698e9360ac5dca13f2d6decd486300e4df11d2c8ddb7b256175840baabe08bb
7
- data.tar.gz: 78390c60745981427dee34acc884c8b4479cdbec7e1f69de1ed62827a9470fe95848c1b64a924d55202843374de3ffa2667ccf7e516fec01cdded8ecdae16686
6
+ metadata.gz: 351b6f4eb2c6153cd14861acd63a1cf37dbc767a72099ab832ca6555fadbb2b289f46bc3242ff46b5ab64c730c7de4c124f7255e785db802c04c84b18c4f03e2
7
+ data.tar.gz: 41791422675e26923919b22ceb9a8245f36f21ba41ca7c5768385b5beef84de231ff881986d87acdf429464487ef695eb79f05368c6bcddb91121fe9b860cce8
data/README.md CHANGED
@@ -55,7 +55,8 @@ end
55
55
 
56
56
  - the `params` method can be used to define attributes allowed to be modified by that user level in addition to their allowed actions, which can be further refined for each level using `except` and `only options`.
57
57
  - the `@membership` attribute is set on initialization of the permission object. See setup for details in 'Setup'
58
-
58
+ - passing a `do` block into `#allow` will allow for more control over each roles permission to those actions.
59
+ - the value passed into the block is the return value of the current controller's `#current_resource` method.
59
60
 
60
61
  ## Setup
61
62
 
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "rails", "~> 4"
20
+ spec.add_dependency "rails", "~> 4.0.0"
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec", "~> 2"
@@ -1,4 +1,5 @@
1
1
  require "action_permission/version"
2
2
  require "action_permission/dispatch"
3
3
  require "action_permission/base"
4
- require "action_permission/controller"
4
+ require "action_permission/controller"
5
+ require "action_permission/railtie"
@@ -7,15 +7,5 @@ module ActionPermission
7
7
  else
8
8
  config.generators.scaffold_controller = :action_permission_controller
9
9
  end
10
-
11
- # initializer 'activeservice.autoload', :before => :set_autoload_paths do |app|
12
- # app.config.autoload_paths << (app.config.root + '/app/permissions')
13
- # end
14
-
15
- # initializer "strong_parameters.config", :before => "action_controller.set_configs" do |app|
16
- # ActionController::Parameters.action_on_unpermitted_parameters = app.config.action_controller.delete(:action_on_unpermitted_parameters) do
17
- # (Rails.env.test? || Rails.env.development?) ? :log : false
18
- # end
19
- # end
20
10
  end
21
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionPermission
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -1,16 +1,13 @@
1
1
  Description:
2
2
  Stubs out a scaffolded controller and its views. Different from rails
3
- scaffold_controller, it uses strong_parameters to whitelist permissible
4
- attributes in a private method.
5
- Pass the model name, either CamelCased or under_scored. The controller
6
- name is retrieved as a pluralized version of the model name.
7
-
8
- With ActionPermission, it replaces the default strong_parameters
9
- call with a call to allowed_params_for that loads the permission file
10
- to determined whitelisted parameters
3
+ scaffold_controller, it uses strong_parameters via action_permission
4
+ to whitelist permissible attributes in a private method.
5
+ Pass the model name, either CamelCased or under_scored, the parameters
6
+ and optionally the controller instance (otherwise, the controller
7
+ name is retrieved as a pluralized version of the model name)
11
8
 
12
9
  To create a controller within a module, specify the model name as a
13
10
  path like 'parent_module/controller_name'.
14
11
 
15
12
  This generates a controller class in app/controllers and invokes helper,
16
- template engine and test framework generators.
13
+ template engine and test framework generators.
@@ -6,12 +6,6 @@ module Rails
6
6
  class ActionPermissionControllerGenerator < ScaffoldControllerGenerator
7
7
  argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
8
8
  source_root File.expand_path("../templates", __FILE__)
9
-
10
- if ::Rails::VERSION::STRING < '3.1'
11
- def module_namespacing
12
- yield if block_given?
13
- end
14
- end
15
9
  end
16
10
  end
17
- end
11
+ end
data/tags ADDED
@@ -0,0 +1,66 @@
1
+ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
+ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
+ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
+ !_TAG_PROGRAM_NAME Exuberant Ctags //
5
+ !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
+ !_TAG_PROGRAM_VERSION 5.8 //
7
+ ActionPermission lib/action_permission/base.rb /^module ActionPermission$/;" m
8
+ ActionPermission lib/action_permission/controller.rb /^module ActionPermission$/;" m
9
+ ActionPermission lib/action_permission/dispatch.rb /^module ActionPermission$/;" m
10
+ ActionPermission lib/action_permission/railtie.rb /^module ActionPermission$/;" m
11
+ ActionPermission lib/action_permission/version.rb /^module ActionPermission$/;" m
12
+ ActionPermission lib/generators/action_permission/install/install_generator.rb /^module ActionPermission$/;" m
13
+ ActionPermission lib/generators/action_permission/permission/permission_generator.rb /^module ActionPermission$/;" m
14
+ ActionPermissionControllerGenerator lib/generators/rails/action_permission_controller_generator.rb /^ class ActionPermissionControllerGenerator < ScaffoldControllerGenerator$/;" c class:Rails.Generators
15
+ ApplicationPermission lib/generators/action_permission/install/templates/application.rb /^class ApplicationPermission < ActionPermission::Base$/;" c
16
+ Base lib/action_permission/base.rb /^ class Base$/;" c class:ActionPermission
17
+ ClassMethods lib/action_permission/controller.rb /^ module ClassMethods$/;" m class:ActionPermission.Controller
18
+ Controller lib/action_permission/controller.rb /^ module Controller$/;" m class:ActionPermission
19
+ Dispatch lib/action_permission/dispatch.rb /^ class Dispatch$/;" c class:ActionPermission
20
+ Generators lib/generators/action_permission/install/install_generator.rb /^ module Generators$/;" m class:ActionPermission
21
+ Generators lib/generators/action_permission/permission/permission_generator.rb /^ module Generators$/;" m class:ActionPermission
22
+ Generators lib/generators/rails/action_permission_controller_generator.rb /^ module Generators$/;" m class:Rails
23
+ InstallGenerator lib/generators/action_permission/install/install_generator.rb /^ class InstallGenerator < Rails::Generators::Base$/;" c class:ActionPermission.Generators
24
+ PermissionGenerator lib/generators/action_permission/permission/permission_generator.rb /^ class PermissionGenerator < Rails::Generators::NamedBase$/;" c class:ActionPermission.Generators
25
+ Rails lib/generators/rails/action_permission_controller_generator.rb /^module Rails$/;" m
26
+ Railtie lib/action_permission/railtie.rb /^ class Railtie < ::Rails::Railtie$/;" c class:ActionPermission
27
+ add_controller_setup lib/generators/action_permission/install/install_generator.rb /^ def add_controller_setup$/;" f class:ActionPermission.Generators.InstallGenerator
28
+ admin lib/generators/action_permission/permission/templates/permission.rb /^ def admin$/;" f
29
+ allow lib/action_permission/base.rb /^ def allow(actions, &block)$/;" f class:ActionPermission
30
+ allow? lib/action_permission/base.rb /^ def allow?(action, resource = nil)$/;" f class:ActionPermission
31
+ allow? lib/action_permission/dispatch.rb /^ def allow?(controller, action, resource = nil)$/;" f class:ActionPermission.Dispatch
32
+ allow_param? lib/action_permission/dispatch.rb /^ def allow_param?(resource, attribute)$/;" f class:ActionPermission.Dispatch
33
+ allow_params lib/action_permission/base.rb /^ def allow_params options=nil$/;" f class:ActionPermission
34
+ allow_params_with_options lib/action_permission/base.rb /^ def allow_params_with_options options$/;" f class:ActionPermission
35
+ allow_rest_actions lib/action_permission/base.rb /^ def allow_rest_actions(&block)$/;" f class:ActionPermission
36
+ allowed_params_for lib/action_permission/dispatch.rb /^ def allowed_params_for(resource, params, controller=nil)$/;" f class:ActionPermission.Dispatch
37
+ authorize_with lib/action_permission/controller.rb /^ def authorize_with authorizer$/;" f class:ActionPermission.Controller.ClassMethods
38
+ authorized? lib/action_permission/controller.rb /^ def authorized?$/;" f class:ActionPermission.Controller
39
+ check_permission lib/generators/action_permission/install/install_generator.rb /^ def check_permission$/;" f class:ActionPermission.Generators.InstallGenerator.add_controller_setup
40
+ copy_application_file lib/generators/action_permission/install/install_generator.rb /^ def copy_application_file$/;" f class:ActionPermission.Generators.InstallGenerator
41
+ create lib/generators/rails/templates/controller.rb /^ def create$/;" f
42
+ create_permission_file lib/generators/action_permission/permission/permission_generator.rb /^ def create_permission_file$/;" f class:ActionPermission.Generators.PermissionGenerator
43
+ current_permission lib/action_permission/controller.rb /^ def current_permission$/;" f class:ActionPermission.Controller
44
+ current_resource lib/action_permission/controller.rb /^ def current_resource$/;" f class:ActionPermission.Controller
45
+ current_user lib/generators/action_permission/install/install_generator.rb /^ def current_user$/;" f class:ActionPermission.Generators.InstallGenerator.add_controller_setup
46
+ destroy lib/generators/rails/templates/controller.rb /^ def destroy$/;" f
47
+ edit lib/generators/rails/templates/controller.rb /^ def edit$/;" f
48
+ get_class_name lib/action_permission/dispatch.rb /^ def get_class_name(controller)$/;" f class:ActionPermission.Dispatch.set_controller
49
+ guest lib/generators/action_permission/permission/templates/permission.rb /^ def guest$/;" f
50
+ index lib/generators/rails/templates/controller.rb /^ def index$/;" f
51
+ initialize lib/action_permission/base.rb /^ def initialize(membership)$/;" f class:ActionPermission
52
+ initialize lib/action_permission/dispatch.rb /^ def initialize(membership)$/;" f class:ActionPermission.Dispatch
53
+ load lib/action_permission/base.rb /^ def load(membership)$/;" f class:ActionPermission
54
+ load_permission lib/action_permission/dispatch.rb /^ def load_permission(controller)$/;" f class:ActionPermission.Dispatch.set_controller
55
+ match_with lib/action_permission/base.rb /^ def match_with source,to$/;" f class:ActionPermission.Base
56
+ new lib/generators/rails/templates/controller.rb /^ def new$/;" f
57
+ params lib/action_permission/base.rb /^ def params$/;" f class:ActionPermission
58
+ params lib/generators/action_permission/permission/templates/permission.rb /^ def params$/;" f
59
+ permission_authorizer lib/action_permission/controller.rb /^ def permission_authorizer$/;" f class:ActionPermission.Controller.ClassMethods
60
+ permission_authorizer lib/action_permission/controller.rb /^ def permission_authorizer$/;" f class:ActionPermission.Controller
61
+ register_permission lib/action_permission/dispatch.rb /^ def register_permission(controller, klass)$/;" f class:ActionPermission.Dispatch.set_controller
62
+ set_controller lib/action_permission/dispatch.rb /^ def set_controller(resource, controller)$/;" f class:ActionPermission.Dispatch
63
+ set_resource lib/action_permission/dispatch.rb /^ def set_resource(resource)$/;" f class:ActionPermission.Dispatch.set_controller
64
+ show lib/generators/rails/templates/controller.rb /^ def show$/;" f
65
+ update lib/generators/rails/templates/controller.rb /^ def update$/;" f
66
+ user lib/generators/action_permission/permission/templates/permission.rb /^ def user$/;" f
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_permission
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Duffy
@@ -10,76 +10,76 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-17 00:00:00.000000000 Z
13
+ date: 2014-07-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '4'
21
+ version: 4.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '4'
28
+ version: 4.0.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: bundler
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '1.3'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '1.3'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rspec
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: '2'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '2'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: activerecord-nulldb-adapter
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  description:
@@ -91,8 +91,8 @@ executables: []
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
- - .gitignore
95
- - .rspec
94
+ - ".gitignore"
95
+ - ".rspec"
96
96
  - Gemfile
97
97
  - LICENSE.txt
98
98
  - README.md
@@ -117,6 +117,7 @@ files:
117
117
  - spec/controller_spec.rb
118
118
  - spec/dispatch_spec.rb
119
119
  - spec/spec_helper.rb
120
+ - tags
120
121
  homepage: https://github.com/mttdffy/action_permission
121
122
  licenses:
122
123
  - MIT
@@ -127,12 +128,12 @@ require_paths:
127
128
  - lib
128
129
  required_ruby_version: !ruby/object:Gem::Requirement
129
130
  requirements:
130
- - - '>='
131
+ - - ">="
131
132
  - !ruby/object:Gem::Version
132
133
  version: '0'
133
134
  required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - '>='
136
+ - - ">="
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  requirements: []