credentials 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +8 -0
- data/VERSION +1 -1
- data/credentials.gemspec +2 -2
- data/lib/credentials/extensions/action_controller.rb +8 -1
- metadata +2 -2
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/credentials.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{credentials}
|
8
|
-
s.version = "2.2.
|
8
|
+
s.version = "2.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Powell"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-27}
|
13
13
|
s.description = %q{A generic actor/resource permission framework based on rules, not objects.}
|
14
14
|
s.email = %q{fauxparse@gmail.com.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -41,6 +41,11 @@ module Credentials
|
|
41
41
|
# @current_post ||= Post.find params[:id]
|
42
42
|
# end
|
43
43
|
# end
|
44
|
+
#
|
45
|
+
# Note that for this to work, the +current_post+ method
|
46
|
+
# must be declared +protected+. The reason for this is that
|
47
|
+
# otherwise Credentials would also try to evaluate the
|
48
|
+
# +edit+ method as an argument.
|
44
49
|
def requires_permission_to(*args)
|
45
50
|
options = (args.last.is_a?(Hash) ? args.pop : {}).with_indifferent_access
|
46
51
|
%w(only except).each do |key|
|
@@ -77,7 +82,9 @@ module Credentials
|
|
77
82
|
next if options[:except] && options[:except].include?(current_action)
|
78
83
|
|
79
84
|
raise Credentials::Errors::NotLoggedInError unless current_user
|
80
|
-
evaluated = args.map
|
85
|
+
evaluated = args.map do |arg|
|
86
|
+
(arg.is_a?(Symbol) && respond_to?(arg) && !public_methods.include?(arg.to_s)) ? send(arg) : arg
|
87
|
+
end
|
81
88
|
|
82
89
|
unless current_user.can?(*evaluated)
|
83
90
|
raise Credentials::Errors::AccessDeniedError
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Powell
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-27 00:00:00 +13:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|