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 +4 -4
- data/CHANGELOG.md +2 -1
- data/lib/cancanright/controller_additions.rb +6 -1
- data/lib/cancanright/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a261ce39702526b5bb58b8b96428edf91b2c732
|
4
|
+
data.tar.gz: ade885f190312b5f12f6890446ed969516ba9cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 505fd9b8af39135f0c7161efb4b9484bcc03c7a2ba0e62b2e9724876637427207297544564a33fa3ab7b96b5363c2fdce580fd9e3fc1243b541d90c5e5b5c8f5
|
7
|
+
data.tar.gz: 37da1724b4d8e363407dcdcc65233e04a61ed8fdd442533f9ac98ddb0fb961a5d1785c9316e5844b9a93e7651fa5d683154254bebf4b63f77a404309bb844fed
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
## [
|
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
|
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
|
|
data/lib/cancanright/version.rb
CHANGED