petergate 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f236f8cbe7b18b49b4714c5ba2dcc69a16c86cee
4
- data.tar.gz: 0d9f8edc3828180ced8b268494cf19ee16cccb93
3
+ metadata.gz: aec1bde4df29afecb38a53b0c956fe239f8889e3
4
+ data.tar.gz: a7582407ab840880df7a812f2b7d7762a3d58bd6
5
5
  SHA512:
6
- metadata.gz: 1cce83ecc382e6f45da64df162528c74d9008661a9868fa06b2238928fc8c6e771e9d18da663912b1e4693dc0533cd34e2c530b05e56c31102bb46317eb24ea9
7
- data.tar.gz: 9234a9af5dd5a36b7312b2e8da311a03e3bba35568c069fe2507ca9aaef3f612f60706230bf087f278651bd525e2bb995381331fea23c7cb14ba9db3cc482745
6
+ metadata.gz: 820ba53bae0f59f4d9d09428408f6ff2c09a50bb57cef671c4cab230289567c4d8da3ec137494e2f5607c2bd98daa95c6dfaa183c01a37dfb383ddfb65d479d6
7
+ data.tar.gz: acd4474ee4e1864464a27d0587b98d1ce386464997f4d2d88090af9b3fbb036022187aea0c79d06bac99daa452c694ffc431caed5f2556e4ca5045a86ecd2132
data/README.md CHANGED
@@ -6,27 +6,27 @@ Simple User Authorizations.
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- $ gem 'petergate'
9
+ gem 'petergate'
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ bundle
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install petergate
17
+ gem install petergate
18
18
  Make sure you already have a User model setup. Works great with [devise](https://github.com/plataformatec/devise).
19
19
 
20
20
  Run generator to install it.
21
21
 
22
- $ rails g petergate:install
23
- $ rake db:migrate
22
+ rails g petergate:install
23
+ rake db:migrate
24
24
 
25
25
  This will add:
26
26
  ```ruby
27
27
  petergate(roles: [:admin])
28
28
  ```
29
- to your gem file.
29
+ to your User model.
30
30
 
31
31
  ## Usage
32
32
 
@@ -36,15 +36,15 @@ Setup permissions in your controllers the same as you would for a before filter
36
36
  access all: [:show, :index], user: AllRest
37
37
  ```
38
38
 
39
- Inside your views you can use logged?(:admin, :customer) to show or hide content.
39
+ Inside your views you can use logged_in?(:admin, :customer) to show or hide content.
40
40
 
41
41
  ```erb
42
- <%= link_to "destroy", destroy_listing_path(listing) if logged_in?(:admin) %>
42
+ <%= link_to "destroy", destroy_listing_path(listing) if logged_in?(:admin, :customer) %>
43
43
  ```
44
44
 
45
45
  ## Contributing
46
46
 
47
- 1. Fork it ( https://github.com/[my-github-username]/petergate/fork )
47
+ 1. Fork it ( https://github.com/isaacsloan/petergate/fork )
48
48
  2. Create your feature branch (`git checkout -b my-new-feature`)
49
49
  3. Commit your changes (`git commit -am 'Add some feature'`)
50
50
  4. Push to the branch (`git push origin my-new-feature`)
data/lib/petergate.rb CHANGED
@@ -29,6 +29,7 @@ module PeterGate
29
29
 
30
30
  def self.included(base)
31
31
  base.extend(ClassMethods)
32
+ base.helper_method :logged_in?
32
33
  base.before_filter do
33
34
  unless logged_in?(:admin)
34
35
  message= check_access
@@ -67,6 +68,7 @@ module PeterGate
67
68
  def logged_in?(*roles)
68
69
  current_user && (roles & current_user.roles).any?
69
70
  end
71
+
70
72
  end
71
73
 
72
74
  module UserMethods
@@ -1,3 +1,3 @@
1
1
  module Petergate
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
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: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan