Skip to content
Snippets Groups Projects
Commit 760563d7 authored by pabois's avatar pabois
Browse files

fix abilities

parent a8f5f440
No related branches found
No related tags found
No related merge requests found
......@@ -46,8 +46,9 @@ module Admin::ApplicationHelper
end
def duplicate_link(object)
return unless can?(:update, object)
link_to t('admin.duplicate'),
[:duplicate, :admin, object],
[:duplicate, :admin, object],
method: :post,
data: { confirm: t('please_confirm') },
class: button_classes('btn-light')
......@@ -96,7 +97,7 @@ module Admin::ApplicationHelper
text = indent text, depth
raw text
end
def indent(text, depth)
indentation = ' ' * depth
# Remove useless \r
......
......@@ -71,6 +71,7 @@ class Ability
def website_manager
managed_websites_ids = @user.websites_to_manage.pluck(:communication_website_id)
managed_pages_ids = Communication::Website::Page.where(communication_website_id: managed_websites_ids).pluck(:id)
managed_posts_ids = Communication::Website::Post.where(communication_website_id: managed_websites_ids).pluck(:id)
can :read, Communication::Website, university_id: @user.university_id, id: managed_websites_ids
can :analytics, Communication::Website, university_id: @user.university_id, id: managed_websites_ids
can :manage, Communication::Website::Page, university_id: @user.university_id, communication_website_id: managed_websites_ids
......@@ -81,6 +82,7 @@ class Ability
can :create, Communication::Website::Menu::Item, university_id: @user.university_id
can :manage, University::Organization, university_id: @user.university_id
can :manage, Communication::Block, university_id: @user.university_id, about_type: 'Communication::Website::Page', about_id: managed_pages_ids
can :manage, Communication::Block, university_id: @user.university_id, about_type: 'Communication::Website::Post', about_id: managed_posts_ids
can :create, Communication::Block
end
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment