Add authorization
This commit is contained in:
parent
1d151fb59a
commit
8421368e77
|
@ -31,9 +31,13 @@ class Admin::WebResourcesController < OrbitAdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
if can_edit_or_delete?(@link)
|
||||||
@tags =@module_app.tags
|
@tags =@module_app.tags
|
||||||
@categories = @module_app.categories.enabled
|
@categories = @module_app.categories.enabled
|
||||||
@statuses = []
|
@statuses = []
|
||||||
|
else
|
||||||
|
render_401
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
<a href="<%= link.url %>" target="_blank"><%= link.title %></a>
|
<a href="<%= link.url %>" target="_blank"><%= link.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?(link) %>
|
||||||
<li><a href="/admin/web_resources/<%=link.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
<li><a href="/admin/web_resources/<%=link.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
||||||
<li><a href="#" class="delete text-error" rel="/admin/web_resources/<%=link.id.to_s%>"><%= t(:delete_) %></a></li>
|
<li><a href="#" class="delete text-error" rel="/admin/web_resources/<%=link.id.to_s%>"><%= t(:delete_) %></a></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -13,7 +13,7 @@ module WebResource
|
||||||
data_count 1..10
|
data_count 1..10
|
||||||
side_bar do
|
side_bar do
|
||||||
head_label_i18n 'web_resource',:icon_class=>"icons-link"
|
head_label_i18n 'web_resource',:icon_class=>"icons-link"
|
||||||
available_for [:admin,:manager,:sub_manager]
|
available_for "users"
|
||||||
active_for_controllers (['admin/web_resources'])
|
active_for_controllers (['admin/web_resources'])
|
||||||
head_link_path "admin_web_resources_path"
|
head_link_path "admin_web_resources_path"
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ module WebResource
|
||||||
:link_path=>"admin_web_resources_path" ,
|
:link_path=>"admin_web_resources_path" ,
|
||||||
:priority=>1,
|
:priority=>1,
|
||||||
:active_for_action=>{'admin/web_resources'=>'index'},
|
:active_for_action=>{'admin/web_resources'=>'index'},
|
||||||
:available_for => [:all]
|
:available_for => 'users'
|
||||||
|
|
||||||
context_link 'new_',
|
context_link 'new_',
|
||||||
:link_path=>"new_admin_web_resource_path" ,
|
:link_path=>"new_admin_web_resource_path" ,
|
||||||
:priority=>2,
|
:priority=>2,
|
||||||
:active_for_action=>{'admin/web_resources'=>'new'},
|
:active_for_action=>{'admin/web_resources'=>'new'},
|
||||||
:available_for => [:sub_manager]
|
:available_for => 'sub_managers'
|
||||||
|
|
||||||
context_link 'categories',
|
context_link 'categories',
|
||||||
:link_path=>"admin_module_app_categories_path" ,
|
:link_path=>"admin_module_app_categories_path" ,
|
||||||
|
@ -35,14 +35,14 @@ module WebResource
|
||||||
:priority=>3,
|
:priority=>3,
|
||||||
:active_for_action=>{'admin/web_resources.'=>'categories'},
|
:active_for_action=>{'admin/web_resources.'=>'categories'},
|
||||||
:active_for_category => 'WebResource',
|
:active_for_category => 'WebResource',
|
||||||
:available_for => [:manager]
|
: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=>'web_resource').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'web_resource').id}",
|
||||||
:priority=>4,
|
:priority=>4,
|
||||||
:active_for_action=>{'admin/web_resources'=>'tags'},
|
:active_for_action=>{'admin/web_resources'=>'tags'},
|
||||||
:active_for_tag => 'WebResource',
|
:active_for_tag => 'WebResource',
|
||||||
:available_for => [:manager]
|
:available_for => 'managers'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue