noodall-ui 0.1.0 → 0.1.1

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.
@@ -11,8 +11,6 @@ module Noodall
11
11
 
12
12
  #Check view permissions
13
13
  enforce_view_permission(@node) if anybody_signed_in?
14
- #Set cache control to private if this page has restricted permisions
15
- response.cache_control[:public] = false if @node.viewable_groups.any?
16
14
 
17
15
  @page_title = @node.title
18
16
  @page_description = @node.description
@@ -61,5 +59,16 @@ module Noodall
61
59
  flash[:error] = "You do not have permission to do that"
62
60
  redirect_to root_url
63
61
  end
62
+
63
+ def can_view?(node)
64
+ if node.viewable_groups.empty?
65
+ # No groups then can view
66
+ true
67
+ else
68
+ #Set cache control to private if this page has restricted permisions
69
+ response.cache_control[:public] = false
70
+ !current_user.nil? and current_user.can_view?(node)
71
+ end
72
+ end
64
73
  end
65
74
  end
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-ui
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England