caboose-cms 0.7.36 → 0.7.38
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95c98700fe9e21bf2a9fb5cf9547ffaebc869d5e
|
4
|
+
data.tar.gz: ae7208e3ecf4a964735463781af60da3f571f8ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6707d9d5bec9203435e4456f019a1741c95a82de9fae6f03c3c9d40c003f7c754e1e8a1f0703d3772106d0de6e448d50898eda43c5bf910efcdc6379119ba17
|
7
|
+
data.tar.gz: c1cc6916af5c0d24738074a7cd0cac7479a778393620b3f5a7344a4a8fb37927792a5c9dc4c44752a8f7a94e7e3eb511049c901f78adf45caa298bd8178e851e
|
@@ -178,7 +178,17 @@ module Caboose
|
|
178
178
|
@page = Page.find(params[:id])
|
179
179
|
render :layout => 'caboose/admin'
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
|
+
# PUT /admin/pages/:id/update-child-permissions
|
183
|
+
def admin_update_child_permissions
|
184
|
+
return unless user_is_allowed('pages', 'edit')
|
185
|
+
page = Page.find(params[:id])
|
186
|
+
if page
|
187
|
+
Page.update_child_perms(page.id)
|
188
|
+
end
|
189
|
+
render :json => { :success => true }
|
190
|
+
end
|
191
|
+
|
182
192
|
# GET /admin/pages/:id/content
|
183
193
|
def admin_edit_content
|
184
194
|
return unless user_is_allowed('pages', 'edit')
|
data/app/models/caboose/page.rb
CHANGED
@@ -126,14 +126,15 @@ class Caboose::Page < ActiveRecord::Base
|
|
126
126
|
def self.update_child_perms(page_id)
|
127
127
|
page = self.find(page_id)
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
viewer_ids = Caboose::PagePermission.where(:page_id => page_id, :action => 'view' ).all.collect{ |pp| pp.role_id }
|
130
|
+
editor_ids = Caboose::PagePermission.where(:page_id => page_id, :action => 'edit' ).all.collect{ |pp| pp.role_id }
|
131
|
+
approver_ids = Caboose::PagePermission.where(:page_id => page_id, :action => 'approve').all.collect{ |pp| pp.role_id }
|
132
|
+
|
133
133
|
self.update_child_perms_helper(page, viewer_ids, editor_ids, approver_ids)
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.update_child_perms_helper(page, viewer_ids, editor_ids, approver_ids)
|
137
|
+
|
137
138
|
self.update_authorized_for_action(page.id, 'view' , viewer_ids)
|
138
139
|
self.update_authorized_for_action(page.id, 'edit' , editor_ids)
|
139
140
|
self.update_authorized_for_action(page.id, 'approve' , approver_ids)
|
@@ -16,6 +16,9 @@
|
|
16
16
|
</tr>
|
17
17
|
<% end %>
|
18
18
|
</table>
|
19
|
+
|
20
|
+
<div id='message'></div>
|
21
|
+
<p><input type='button' value='Copy Permissions to Child Pages' onclick='update_child_permissions(<%= @page.id %>);' /></p>
|
19
22
|
|
20
23
|
<%= render :partial => 'caboose/pages/admin_footer' %>
|
21
24
|
|
@@ -42,5 +45,27 @@ function toggle_page_permission(role_id, checked, action)
|
|
42
45
|
});
|
43
46
|
}
|
44
47
|
|
48
|
+
function update_child_permissions(page_id, confirm)
|
49
|
+
{
|
50
|
+
if (!confirm)
|
51
|
+
{
|
52
|
+
var p = $('<p/>').addClass('note warning')
|
53
|
+
.append("Are you sure you want to copy the permissions to child pages?<br /><br />")
|
54
|
+
.append($('<input/>').attr('type', 'button').val('Yes').click(function(e) { update_child_permissions(page_id, true); })).append(' ')
|
55
|
+
.append($('<input/>').attr('type', 'button').val('No').click(function(e) { $('#message').empty(); }));
|
56
|
+
$('#message').empty().append(p);
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
$('#message').empty().append("<p class='loading'>Setting child permissions...</p>");
|
60
|
+
$.ajax({
|
61
|
+
url: '/admin/pages/' + page_id + '/update-child-permissions',
|
62
|
+
type: 'put',
|
63
|
+
success: function(resp) {
|
64
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
65
|
+
if (resp.success) $('#message').html("<p class='note success'>The permissions have been set successfully.</p>");
|
66
|
+
}
|
67
|
+
});
|
68
|
+
}
|
69
|
+
|
45
70
|
</script>
|
46
71
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -284,8 +284,9 @@ Caboose::Engine.routes.draw do
|
|
284
284
|
put "/admin/pages/:id/layout" => "pages#admin_update_layout"
|
285
285
|
put "/admin/pages/:id/viewers" => "pages#admin_update_viewers"
|
286
286
|
put "/admin/pages/:id/editors" => "pages#admin_update_editors"
|
287
|
-
get "/admin/pages/:id" => "pages#admin_edit_general"
|
288
|
-
put "/admin/pages/:id"
|
287
|
+
get "/admin/pages/:id" => "pages#admin_edit_general"
|
288
|
+
put "/admin/pages/:id/update-child-permissions" => "pages#admin_update_child_permissions"
|
289
|
+
put "/admin/pages/:id" => "pages#admin_update"
|
289
290
|
get "/admin/pages" => "pages#admin_index"
|
290
291
|
post "/admin/pages" => "pages#admin_create"
|
291
292
|
delete "/admin/pages/:id" => "pages#admin_delete"
|
data/lib/caboose/version.rb
CHANGED