mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							22 lines
						
					
					
						
							594 B
						
					
					
				
			
		
		
	
	
							22 lines
						
					
					
						
							594 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
class TemplateSharingsTestingController < ApplicationController
 | 
						|
  load_and_authorize_resource :template, parent: true
 | 
						|
 | 
						|
  before_action do
 | 
						|
    authorize!(:manage, TemplateSharing.new(template: @template))
 | 
						|
  end
 | 
						|
 | 
						|
  def create
 | 
						|
    testing_account = Accounts.find_or_create_testing_user(true_user.account).account
 | 
						|
 | 
						|
    if params[:value] == '1'
 | 
						|
      TemplateSharing.create!(ability: :manage, account: testing_account, template: @template)
 | 
						|
    else
 | 
						|
      TemplateSharing.find_by(template: @template, account: testing_account)&.destroy!
 | 
						|
    end
 | 
						|
 | 
						|
    head :ok
 | 
						|
  end
 | 
						|
end
 |