padrino-cancancan 0.1.0

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: 31eab3c665b95b7721f5487a1ecc0c1cfe4d1b5c
4
+ data.tar.gz: 809f276c5b126ecbbff9bfa4f2fbe6bb9d3808ed
5
+ SHA512:
6
+ metadata.gz: f96abca54794b97ac6694080c00142452b5d16db8233c3daefb7a4a30ae65247b1ca1b827182d4f89a1892a6999dd31a767c0067c05164ce8a6abf9bc10cf8ae
7
+ data.tar.gz: f50d4b320e599ec4de1619694950dc6cd8802ca201cae63b31a8e01c8dfc584cee6ddc5bef83ae51963931b5401aaa66d98b8a6af7c56fffe323e4907808de1b
@@ -0,0 +1,13 @@
1
+ require 'cancancan'
2
+ require 'padrino-cancancan/helpers'
3
+
4
+ module Padrino
5
+ module CanCan
6
+ class << self
7
+ def registered(app)
8
+ app.helpers Padrino::CanCan::Helpers
9
+ end
10
+ alias :included :registered
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ module Padrino
2
+ module CanCan
3
+ module Helpers
4
+ def current_ability
5
+ @ability ||= Ability.new(current_account)
6
+ end
7
+
8
+ def can? *args
9
+ current_ability.can? *args
10
+ end
11
+
12
+ def cannot? *args
13
+ current_ability.cannot? *args
14
+ end
15
+
16
+ def authorize! *args
17
+ current_ability.authorize! *args
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: padrino-cancancan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sanad Liaquat
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-22 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: This gem lets you use the CanCanCan gem (https://github.com/CanCanCommunity/cancancan)
28
+ with Padrino framework. Note that CanCanCan is a continuation of CanCan (https://github.com/ryanb/cancan),
29
+ the authorization gem for Ruby on Rails.
30
+ email:
31
+ - sanadhussain@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/padrino-cancancan.rb
37
+ - lib/padrino-cancancan/helpers.rb
38
+ homepage: https://github.com/sliaquat/padrino-cancancan
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.1.9
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Use cancancan authorization gem with Padrino
62
+ test_files: []