upnxt_cancancan 1.10.1.patch3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90297753e4760febbe8ab813f803b540b41b7a73
4
+ data.tar.gz: 462818436ca61b1a5c2d94b2b3067dad2e677718
5
+ SHA512:
6
+ metadata.gz: fda69ceab0542bc81a07d7bdfd7d5945f1bd5a507b8ecd2e4d2072220b4adf4fb4bece82df269fc37d05212ab4f5bdf98c55ac40abea1193dc3b5f322525f3b9
7
+ data.tar.gz: 3edf63a6c4acffa32908f55a94909d4527629017a191034461499a320a8d9d07ca47432c645efa845de5055523a101e87e0a00efe8381546e31096b54bbdd497
@@ -0,0 +1,20 @@
1
+ Copyright 2015 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = UpnxtCanCanCan
2
+
3
+ Upnxt wrapper for CanCanCan.
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'UpnxtCanCanCan'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
@@ -0,0 +1,41 @@
1
+ module CanCan
2
+ #patch as described in https://github.com/CanCanCommunity/cancancan/pull/196
3
+ module ModelAdapters
4
+ class ActiveRecord4Adapter < AbstractAdapter
5
+ def self.override_condition_matching?(subject, name, value)
6
+ subject.class.defined_enums.include? name.to_s
7
+ end
8
+
9
+ def self.matches_condition?(subject, name, value)
10
+ # Get the mapping from enum strings to values.
11
+ enum = subject.class.send(name.to_s.pluralize)
12
+ # Get the value of the attribute as an integer.
13
+ attribute = enum[subject.send(name)]
14
+ # Check to see if the value matches the condition.
15
+ value.is_a?(Enumerable) ?
16
+ (value.include? attribute) :
17
+ attribute == value
18
+ end
19
+ end
20
+ end
21
+
22
+ # temp fix for https://github.com/CanCanCommunity/cancancan/issues/177
23
+ class Rule
24
+ def matches_conditions_hash?(subject, conditions = @conditions)
25
+ return true if conditions.empty?
26
+ adapter = model_adapter(subject)
27
+
28
+ if adapter.override_conditions_hash_matching?(subject, conditions)
29
+ return adapter.matches_conditions_hash?(subject, conditions)
30
+ end
31
+
32
+ conditions.all? do |name, value|
33
+ if adapter.override_condition_matching?(subject, name, value)
34
+ adapter.matches_condition?(subject, name, value)
35
+ else
36
+ condition_match?(subject.send(name), value)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ require "upnxt_cancancan/engine"
2
+
3
+ module UpnxtCanCanCan
4
+ end
5
+
@@ -0,0 +1,4 @@
1
+ module UpnxtCanCanCan
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module UpnxtCanCanCan
2
+ VERSION = "1.10.1.patch3"
3
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: upnxt_cancancan
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.10.1.patch3
5
+ platform: ruby
6
+ authors:
7
+ - bert bruynooghe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cancancan
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.10.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.10.1
27
+ description: Upnxt wrapper around CanCanCan that provides some patches.
28
+ email:
29
+ - bert.bruynooghe@up-nxt.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.rdoc
36
+ - Rakefile
37
+ - config/initializers/cancancan.rb
38
+ - lib/upnxt_cancancan.rb
39
+ - lib/upnxt_cancancan/engine.rb
40
+ - lib/upnxt_cancancan/version.rb
41
+ homepage: https://github.com/UP-nxt/upnxt_cancancan
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">"
57
+ - !ruby/object:Gem::Version
58
+ version: 1.3.1
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.2.0
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Upnxt wrapper around CanCanCan.
65
+ test_files: []