Add authorization
This commit is contained in:
parent
28166f95a9
commit
16ae9aa31f
|
@ -28,8 +28,12 @@ class Admin::ArchiveFilesController < OrbitAdminController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@archive_file = ArchiveFile.find(params[:id])
|
@archive_file = ArchiveFile.find(params[:id])
|
||||||
|
if can_edit_or_delete?(@archive_file)
|
||||||
@tags = @module_app.tags
|
@tags = @module_app.tags
|
||||||
@categories = @module_app.categories
|
@categories = @module_app.categories
|
||||||
|
else
|
||||||
|
render_401
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -23,8 +23,10 @@
|
||||||
<a href="#" target="_blank"><%= archive.title %></a>
|
<a href="#" target="_blank"><%= archive.title %></a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(archive) %>
|
||||||
<li><a href="/<%= I18n.locale.to_s %>/admin/archive_files/<%= archive.id.to_s %>/edit"><%= t(:edit) %></a></li>
|
<li><a href="/<%= I18n.locale.to_s %>/admin/archive_files/<%= archive.id.to_s %>/edit"><%= t(:edit) %></a></li>
|
||||||
<li><a href="/admin/archive_files/<%= archive.id.to_s %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
<li><a href="/admin/archive_files/<%= archive.id.to_s %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -12,33 +12,37 @@ module Archive
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
side_bar do
|
side_bar do
|
||||||
head_label_i18n 'archive.archive', icon_class: "icons-archive"
|
head_label_i18n 'archive.archive', icon_class: "icons-archive"
|
||||||
available_for [:admin,:manager,:sub_manager]
|
available_for "users"
|
||||||
active_for_controllers (['admin/archive_files'])
|
active_for_controllers (['admin/archive_files'])
|
||||||
head_link_path "admin_archive_files_path"
|
head_link_path "admin_archive_files_path"
|
||||||
|
|
||||||
context_link 'all',
|
context_link 'all',
|
||||||
:link_path=>"admin_archive_files_path" ,
|
:link_path=>"admin_archive_files_path" ,
|
||||||
:priority=>1,
|
:priority=>1,
|
||||||
:active_for_action=>{'admin/archive_files'=>"index"}
|
:active_for_action=>{'admin/archive_files'=>"index"},
|
||||||
|
:available_for => 'users'
|
||||||
|
|
||||||
context_link 'new_',
|
context_link 'new_',
|
||||||
:link_path=>"new_admin_archive_file_path" ,
|
:link_path=>"new_admin_archive_file_path" ,
|
||||||
:priority=>2,
|
:priority=>2,
|
||||||
:active_for_action=>{'admin/archive_files'=>"new"}
|
:active_for_action=>{'admin/archive_files'=>"new"},
|
||||||
|
:available_for => 'sub_managers'
|
||||||
|
|
||||||
context_link 'categories',
|
context_link 'categories',
|
||||||
:link_path=>"admin_module_app_categories_path" ,
|
:link_path=>"admin_module_app_categories_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
|
||||||
:priority=>3,
|
:priority=>3,
|
||||||
:active_for_action=>{'admin/archive_files'=>'categories'},
|
:active_for_action=>{'admin/archive_files'=>'categories'},
|
||||||
:active_for_category => 'Archive'
|
:active_for_category => 'Archive',
|
||||||
|
:available_for => 'managers'
|
||||||
|
|
||||||
context_link 'tags',
|
context_link 'tags',
|
||||||
:link_path=>"admin_module_app_tags_path" ,
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
|
||||||
:priority=>4,
|
:priority=>4,
|
||||||
:active_for_action=>{'admin/archive_files'=>'tags'},
|
:active_for_action=>{'admin/archive_files'=>'tags'},
|
||||||
:active_for_tag => 'Archive'
|
:active_for_tag => 'Archive',
|
||||||
|
:available_for => 'managers'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue