credentials 2.4.2 → 2.4.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.rb +28 -0
- data/lib/credentials/extensions/action_controller.rb +10 -1
- data/spec/controllers/test_controller_spec.rb +1 -0
- metadata +2 -2
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.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.4.
|
8
|
+
s.version = "2.4.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{2010-01-
|
12
|
+
s.date = %q{2010-01-30}
|
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 = [
|
data/lib/credentials.rb
CHANGED
@@ -11,3 +11,31 @@ Object.send :include, Credentials::Extensions::Object
|
|
11
11
|
if defined?(ActionController)
|
12
12
|
ActionController::Base.send :include, Credentials::Extensions::ActionController
|
13
13
|
end
|
14
|
+
|
15
|
+
unless defined?(ActiveSupport)
|
16
|
+
class String
|
17
|
+
if Module.method(:const_get).arity == 1
|
18
|
+
def constantize
|
19
|
+
names = split('::')
|
20
|
+
names.shift if names.empty? || names.first.empty?
|
21
|
+
|
22
|
+
constant = Object
|
23
|
+
names.each do |name|
|
24
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
25
|
+
end
|
26
|
+
constant
|
27
|
+
end
|
28
|
+
else
|
29
|
+
def constantize
|
30
|
+
names = split('::')
|
31
|
+
names.shift if names.empty? || names.first.empty?
|
32
|
+
|
33
|
+
constant = Object
|
34
|
+
names.each do |name|
|
35
|
+
constant = constant.const_get(name, false) || constant.const_missing(name)
|
36
|
+
end
|
37
|
+
constant
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -83,7 +83,11 @@ module Credentials
|
|
83
83
|
|
84
84
|
raise Credentials::Errors::NotLoggedInError unless current_user
|
85
85
|
evaluated = args.map do |arg|
|
86
|
-
|
86
|
+
if arg.is_a?(Symbol) && respond_to?(arg) && !action_named?(arg)
|
87
|
+
send(arg)
|
88
|
+
else
|
89
|
+
arg
|
90
|
+
end
|
87
91
|
end
|
88
92
|
|
89
93
|
opts = returning({}) do |hash|
|
@@ -99,6 +103,11 @@ module Credentials
|
|
99
103
|
end
|
100
104
|
end
|
101
105
|
|
106
|
+
def action_named?(method)
|
107
|
+
method_name = (RUBY_VERSION.to_f >= 1.9) ? method.to_sym : method.to_s
|
108
|
+
public_methods.include?(method_name)
|
109
|
+
end
|
110
|
+
|
102
111
|
def self.included(receiver) #:nodoc:
|
103
112
|
receiver.extend Credentials::Extensions::Configuration
|
104
113
|
receiver.extend ClassMethods
|
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.4.
|
4
|
+
version: 2.4.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: 2010-01-
|
12
|
+
date: 2010-01-30 00:00:00 +13:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|