add cancan for authorization

This commit is contained in:
Alex Turchyn committed 2023-09-17 00:45:57 +03:00
1 parent f89c50d096
commit 2f1843151d
58 files changed
+341 -184

No files matched your search

+2 -6
View File
@@ -2,10 +2,10 @@
module Api
class TemplatesController < ApiBaseController
before_action :load_template, only: %i[show update]
load_and_authorize_resource :template
def index
render json: current_account.templates
render json: @templates
end
def show
@@ -28,9 +28,5 @@ module Api
fields: [[:uuid, :submitter_uuid, :name, :type, :required,
{ options: [], areas: [%i[x y w h cell_w attachment_uuid page]] }]])
end
def load_template
@template = current_account.templates.find(params[:id])
end
end
end