mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Authorize before adding apps to folders
This commit is contained in:
parent
10ac265022
commit
bfd5af856f
1 changed files with 6 additions and 0 deletions
|
|
@ -4,6 +4,12 @@ class FolderAppsController < ApplicationController
|
|||
app_id = params[:app_id]
|
||||
folder_id = params[:folder_id]
|
||||
|
||||
@app = App.find app_id
|
||||
|
||||
unless AppPolicy.new(@current_user, @app).update?
|
||||
render json: { message: 'Could not add app to folder due to insufficient permissions' }, status: 500
|
||||
end
|
||||
|
||||
folder_app = FolderApp.new(app_id: app_id, folder_id: folder_id)
|
||||
|
||||
if folder_app.save
|
||||
|
|
|
|||
Loading…
Reference in a new issue