cancanright 0.0.2 → 0.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: bc6e987158f607191888c0343660d613a471ebc7
4
- data.tar.gz: 5cf9019701f15fe921dd7aa34bbc3266e804872b
3
+ metadata.gz: 1a261ce39702526b5bb58b8b96428edf91b2c732
4
+ data.tar.gz: ade885f190312b5f12f6890446ed969516ba9cef
5
5
  SHA512:
6
- metadata.gz: 3d73bc964d0070b7dffecabd72653582ee2d504968f181c2ef9f6ea9a7c5d36cb2f40434bf93f6f3de3dde3c6aaada0508f5e407576df62b9a60bfdced6cd4f2
7
- data.tar.gz: dbc6b4df83f83cb30ff32f7d1773f83c15d0cde5ef2ae8c2853313ea36aff9452cc0fbb140346802547e3faf7bc5bcdb69c2823f9b24140140fce76981265d7c
6
+ metadata.gz: 505fd9b8af39135f0c7161efb4b9484bcc03c7a2ba0e62b2e9724876637427207297544564a33fa3ab7b96b5363c2fdce580fd9e3fc1243b541d90c5e5b5c8f5
7
+ data.tar.gz: 37da1724b4d8e363407dcdcc65233e04a61ed8fdd442533f9ac98ddb0fb961a5d1785c9316e5844b9a93e7651fa5d683154254bebf4b63f77a404309bb844fed
@@ -3,9 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
5
5
 
6
- ## [Unreleased]
6
+ ## [0.0.3] - 2018-01-02
7
7
  ### Fixed
8
8
  - Fix when rights_from is a symbol
9
+ - Rules are now subtractive
9
10
 
10
11
  ## [0.0.1] - 2016-12-09
11
12
  ### Added
@@ -4,10 +4,15 @@ module CanCanRight
4
4
  controller = (self.rights_from || params[:controller]).to_s
5
5
  action = params[:action].to_s
6
6
 
7
- return if can?(:access, controller) || can?(:access, controller + '#' + action)
7
+ return if can_access_controller_action?(controller, action)
8
8
 
9
9
  fail CanCan::AccessDenied, "You are not authorized to access this page."
10
10
  end
11
+
12
+ def can_access_controller_action?(controller, action)
13
+ (can?(:access, controller) && !Model::Right.where(subject: controller + '#' + action).exists?) ||
14
+ can?(:access, controller + '#' + action)
15
+ end
11
16
  end
12
17
  end
13
18
 
@@ -1,3 +1,3 @@
1
1
  module CanCanRight
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancanright
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Colegate