effective_pages 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddac8c5966ed3e1d03290f2faca0b85932cc36a3
4
- data.tar.gz: 5342d8e6be2b9269a0c419ef1c4ab5420f08d4ca
3
+ metadata.gz: 5e0857bc336aef11ee45b65b154b193c4678cd1b
4
+ data.tar.gz: 56fc281dce56d5538ff770985bea2ac49e62a5d7
5
5
  SHA512:
6
- metadata.gz: b029523505a15f7a50a3865aac1d40ec63fa334d4f7affb01aaeeff1e21e1afa3a85428bb0b5cecf475daaa65a84239ed23bac450bb01a54b42479a43f4e02ae
7
- data.tar.gz: 582121876ff42513540c06689f48489b7df190858bac4c32d72179ca7a2a8e51c200b426a860218482ce36ed9387de4299e328acb469b202dd28e0b768125223
6
+ metadata.gz: 328465e88b51fc487005c9513c2e226c190a5e603509da2b40a5536647f8e4b6bb21b3eb2bbc36c621c48a40cbc205cb67bc582bdc69ce82dd7b75da41bedb06
7
+ data.tar.gz: 9da42b2ff1d138482de523a5cc4c8f655d46df5946e78fc9e07ce648dc0c1778ca6c76469995603f1745ef28005332444c5039a56d076a31c5ec9d6531caa88b
data/README.md CHANGED
@@ -10,6 +10,8 @@ Use this gem to create a fully-functional CMS that provides full or restricted e
10
10
 
11
11
  Built ontop of effective_regions.
12
12
 
13
+ Rails 3.2.x and 4.x
14
+
13
15
 
14
16
  ## Getting Started
15
17
 
@@ -2,18 +2,14 @@ module Effective
2
2
  class PagesController < ApplicationController
3
3
  def show
4
4
  @pages = (Rails::VERSION::MAJOR > 3 ? Effective::Page.all : Effective::Page.scoped)
5
+ @pages = @pages.published if params[:edit].to_s != 'true'
5
6
 
6
- if defined?(EffectiveRoles) && (current_user.respond_to?(:roles) rescue false)
7
- @pages = @pages.for_role(current_user.roles)
8
- end
7
+ @page = @pages.find(params[:id])
9
8
 
10
- if params[:edit].to_s != 'true'
11
- @pages = @pages.published
9
+ if defined?(EffectiveRoles)
10
+ raise Effective::AccessDenied unless @page.roles_permit?(current_user)
12
11
  end
13
12
 
14
- @page = @pages.find(params[:id])
15
- raise ActiveRecord::RecordNotFound unless @page
16
-
17
13
  EffectivePages.authorized?(self, :show, @page)
18
14
 
19
15
  @page_title = @page.title
@@ -8,6 +8,8 @@ module Effective
8
8
  self.table_name = EffectivePages.menu_items_table_name.to_s
9
9
  attr_protected() if Rails::VERSION::MAJOR == 3
10
10
 
11
+ acts_as_role_restricted if defined?(EffectiveRoles)
12
+
11
13
  structure do
12
14
  title :string, :validates => [:presence]
13
15
 
@@ -40,8 +42,8 @@ module Effective
40
42
  # This will work with effective_roles one day...
41
43
  def visible_for?(user)
42
44
  can_view_page = (
43
- if menuable.kind_of?(Effective::Page) && defined?(EffectiveRoles) && menuable.is_role_restricted?
44
- (user.roles_match_with?(menuable) rescue false)
45
+ if menuable.kind_of?(Effective::Page) && defined?(EffectiveRoles)
46
+ menuable.roles_permit?(user)
45
47
  else
46
48
  true
47
49
  end
@@ -54,8 +56,8 @@ module Effective
54
56
  user.blank?
55
57
  elsif roles_mask == 0 # Am I logged in?
56
58
  user.present?
57
- elsif roles_mask > 0 && defined?(EffectiveRoles)
58
- user.present? && (user.roles_match_with?(roles_mask) rescue false)
59
+ elsif defined?(EffectiveRoles)
60
+ roles_permit?(user)
59
61
  else
60
62
  false
61
63
  end
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = "0.9.0"
2
+ VERSION = '0.9.1'.freeze
3
3
  end
@@ -20,7 +20,7 @@ EffectivePages.setup do |config|
20
20
  config.excluded_layouts = [:admin]
21
21
 
22
22
  # Use CanCan: can?(action, resource)
23
- # Use effective_roles: resource.roles_match_with?(current_user)
23
+ # Use effective_roles: resource.roles_permit?(current_user)
24
24
  config.authorization_method = Proc.new { |controller, action, resource| true }
25
25
 
26
26
  # Layout Settings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails