petergate 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/petergate.rb +7 -1
- data/lib/petergate/version.rb +1 -1
- data/petergate.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02fcc936703a7764d3e360c97fd577d2bb9c2ff2
|
4
|
+
data.tar.gz: 0d71fa88703d732bd82a790ae16eae8e1c6890ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906c4d8507b98f3bc0e8b512bf6e878f07e4757c63795091408775e4fdc480caf6c31fd4b8210d26ec6584ff37f9735432cb0a7b0b5bfe8cfbad9f752cecbe1b
|
7
|
+
data.tar.gz: 5f0622280f7d006c159f5fda9881de0f6ef4bea4d69d8bdd25ad7f3a0e391704a9ffedefcc6e83b9ca2b9957b618225391ca55b2640175c104dac0ffe71f14f9
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Usage
|
|
53
53
|
Setup permissions in your controllers the same as you would for a before filter like so:
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
access all: [:show, :index], user:
|
56
|
+
access all: [:show, :index], user: ALLREST
|
57
57
|
```
|
58
58
|
|
59
59
|
Inside your views you can use logged_in?(:admin, :customer, :etc) to show or hide content.
|
@@ -68,7 +68,8 @@ If you need to access available roles within your project you can by calling:
|
|
68
68
|
User::ROLES
|
69
69
|
# or from an instance
|
70
70
|
User.first.available_roles
|
71
|
-
# ROLES is a CONSTANT and will still work from within the User model instance methods
|
71
|
+
# ROLES is a CONSTANT and will still work from within the User model instance methods
|
72
|
+
# like in this default setter:
|
72
73
|
|
73
74
|
def roles=(v)
|
74
75
|
self[:roles] = v.map(&:to_sym).to_a.select{|r| r.size > 0 && ROLES.include?(r)}
|
data/lib/petergate.rb
CHANGED
@@ -4,6 +4,12 @@ require "petergate/railtie"
|
|
4
4
|
module Petergate
|
5
5
|
module ControllerMethods
|
6
6
|
module ClassMethods
|
7
|
+
def const_missing(const_name)
|
8
|
+
super unless const_name == :AllRest
|
9
|
+
warn "`AllRest` has been deprecated. Use `ALLREST` instead."
|
10
|
+
ALLREST
|
11
|
+
end
|
12
|
+
|
7
13
|
def access(rules = {}, &block)
|
8
14
|
if block
|
9
15
|
b_rules = block.call
|
@@ -27,7 +33,7 @@ module Petergate
|
|
27
33
|
end
|
28
34
|
|
29
35
|
# Look into using Controller.action_methods instead
|
30
|
-
|
36
|
+
ALLREST = [:show, :index, :new, :edit, :update, :create, :destroy]
|
31
37
|
|
32
38
|
def self.included(base)
|
33
39
|
base.extend(ClassMethods)
|
data/lib/petergate/version.rb
CHANGED
data/petergate.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petergate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Sloan
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: 4.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: 4.0.0
|
55
55
|
description: If you like the straight forward and effective nature of Strong Parameters
|
56
56
|
and suspect that CanCan might be overkill for your project then you'll love Petergate's
|
57
57
|
easy to use and read action and content based authorizations.
|