Custom Content Type Permissions

Steps:

  1. Create a hook
    def hook_for_available_user_roles_list(args)
    args[:roles_list][:post_type] << {:key=>"delete_category", :label=>"Delete Category", :description=>"Permits delete category", color: 'color' }
    end
  2. Create an initializer my_custom_role.rb
    Rails.application.config.to_prepare do
    CamaleonCms::Admin::CategoriesController.class_eval do
    before_action :check_destroy, only: [:destroy]
    def check_destroy
    authorize! :delete_category, @post_type
    end
    end
    end
  3. Restart server

Created at: 24 Oct 09:11 | Updated at: 24 Oct 09:11