the_role 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem 'haml', '~> 3.0'
7
+ gem 'sass'
data/README.md CHANGED
@@ -46,7 +46,6 @@ rails s
46
46
 
47
47
  ## How it works
48
48
 
49
-
50
49
  ``` ruby
51
50
  rails c
52
51
 
@@ -86,4 +85,18 @@ user.has_role? :any_crazy_name, :any_crazy_name
86
85
 
87
86
  ```
88
87
 
88
+ ## Extend TheRole's controllers with **login_require** method
89
+
90
+ **config/initialisers/the_role.rb**
91
+
92
+ ``` ruby
93
+ require 'authenticated_system'
94
+
95
+ Admin::RolesController.send :include, AuthenticatedSystem
96
+ Admin::RoleSectionController.send :include, AuthenticatedSystem
97
+
98
+ Admin::RolesController.send :before_filter, :login_require
99
+ Admin::RoleSectionController.send :before_filter, :login_require
100
+ ```
101
+
89
102
  Copyright (c) 2011 [Ilya N. Zykin Github.com/the-teacher], released under the MIT license
@@ -1,5 +1,6 @@
1
1
  class Admin::RoleSectionController < ApplicationController
2
- # before_filter :login_required
2
+ before_filter :the_role_require
3
+ before_filter :the_owner_require, :only=>[:destroy, :delete_policy]
3
4
  before_filter :find_role, :only=>[:destroy, :delete_policy]
4
5
 
5
6
  def destroy
@@ -2,10 +2,10 @@ require 'the_role'
2
2
 
3
3
  class Admin::RolesController < ApplicationController
4
4
  layout 'the_role'
5
- # before_filter :login_required
6
- # before_filter :role_require
5
+ before_filter :the_role_require
6
+ before_filter :the_owner_require, :only => [:show, :edit, :update, :destroy, :new_role_section, :new_role_policy]
7
7
  before_filter :find_role, :only => [:show, :edit, :update, :destroy, :new_role_section, :new_role_policy]
8
-
8
+
9
9
  def index
10
10
  @roles = Role.all(:order => "created_at ASC")
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module TheRole
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/the_role.rb CHANGED
@@ -14,6 +14,7 @@ module TheRole
14
14
 
15
15
  # TheRole.get(@role.the_role)
16
16
  def self.get str
17
+ str = str.is_a?(String) ? str : String.new
17
18
  hash = YAML::load(str)
18
19
  hash ? hash : Hash.new
19
20
  end
data/the_role.gemspec CHANGED
@@ -21,5 +21,6 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
23
  # s.add_runtime_dependency "rest-client"
24
- s.add_dependency "haml", "~> 3.0"
24
+ s.add_dependency 'haml', '~> 3.0'
25
+ s.add_dependency 'sass'
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_role
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-31 00:00:00.000000000Z
12
+ date: 2011-11-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
16
- requirement: &77267270 !ruby/object:Gem::Requirement
16
+ requirement: &73288540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,18 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *77267270
24
+ version_requirements: *73288540
25
+ - !ruby/object:Gem::Dependency
26
+ name: sass
27
+ requirement: &73288330 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *73288330
25
36
  description: TheRole - simple, but powerful role system for ROR applications
26
37
  email:
27
38
  - zykin-ilya@ya.ru