caboose-cms 0.9.119 → 0.9.120

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: 2a304232d57c41a14e954584d564f0b37af0555e
4
- data.tar.gz: 1433765ace9cbf72fbae46a4d96b1538d575fb1d
3
+ metadata.gz: cb5683a980021f404392a2f015b989295670fa6e
4
+ data.tar.gz: 346da7005b08035b52ec6e16e3a399d30513d38b
5
5
  SHA512:
6
- metadata.gz: 23300deba3dbfe3d503e62a11ee1e1eb5a03010d05c591a81a248cb8cef800c7ec979c862923d7585774db327dade2c9235e4dc2303a470de123da3e80afb4e2
7
- data.tar.gz: 9612c59ad4efc7fc6d3885562d8921296378837d4f06b102a4f0307d66c96ea27defe90eb485395fe6f56948951cf8ea73bb794151ed3eeaf3f3c865f2834e9f
6
+ metadata.gz: fabbf562e74acb49526d3d1e2e1244b588e37978c8a55c0236ef6baf6538b8fce103fe1d537fe37309435e2c40de874e9f81ff5949fa5a9c1ec8f945540b2b85
7
+ data.tar.gz: 5daf70440e4f8dd445b0035b420112ea65fcea692d64cb4d4a8d4e19f3aca566a0e0338ba78edb78c99297863e18ea10672a19aaefa7a952c517c323e8c000f3
@@ -1,10 +1,11 @@
1
1
 
2
2
  class Caboose::Permission < ActiveRecord::Base
3
3
  self.table_name = "permissions"
4
- #has_and_belongs_to_many :roles
4
+
5
+ belongs_to :site
5
6
  has_many :role_permissions
6
- has_many :roles, :through => :role_permissions
7
- attr_accessible :action, :resource
7
+ has_many :roles, :through => :role_permissions
8
+ attr_accessible :action, :resource, :site_id
8
9
 
9
10
  def self.allow(role_id, resource, action)
10
11
  role = Role.find(role_id)
@@ -13,4 +14,4 @@ class Caboose::Permission < ActiveRecord::Base
13
14
  role.permissions.push(perm)
14
15
  role.save
15
16
  end
16
- end
17
+ end
@@ -558,7 +558,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
558
558
  ],
559
559
  Caboose::Permission => [
560
560
  [ :resource , :string ],
561
- [ :action , :string ]
561
+ [ :action , :string ],
562
+ [ :site_id , :integer ]
562
563
  ],
563
564
  Caboose::Post => [
564
565
  [ :site_id , :integer ],
@@ -28,7 +28,8 @@
28
28
  <h3>Permissions</h3>
29
29
  <div id='permissions'>
30
30
  <table class='data'>
31
- <% Caboose::Permission.reorder("resource, action").all.each do |p| %>
31
+ <% where = @site.is_master ? "(id is not null)" : "(site_id is null OR site_id = #{@site.id})" %>
32
+ <% Caboose::Permission.where(where).reorder("resource, action").all.each do |p| %>
32
33
  <% has_permission = Caboose::RolePermission.where(:role_id => @role.id, :permission_id => p.id).exists? %>
33
34
  <tr>
34
35
  <td><input type='checkbox' name='perm<%= p.id %>' <%= raw has_permission ? "checked='true'" : '' %> onclick="toggle_permission(<%= p.id %>, <%= @role.id %>, $(this).prop('checked'));" /></td>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.119'
2
+ VERSION = '0.9.120'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.119
4
+ version: 0.9.120
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg