Skip to content

Commit 22930ed

Browse files
committed
update before actions in scratch controller
1 parent f34f8cb commit 22930ed

3 files changed

Lines changed: 2 additions & 8 deletions

File tree

app/controllers/api/scratch/assets_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Scratch
55
class AssetsController < ScratchController
66
include ActiveStorage::SetCurrent
77

8+
before_action :authorize_user, except: %i[show]
89
prepend_before_action :load_project_from_header, only: %i[show create]
910
authorize_resource :project_from_header
1011

app/controllers/api/scratch/projects_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Scratch
55
class ProjectsController < ScratchController
66
include RemixSelection
77

8+
before_action :authorize_user, except: %i[show]
89
before_action :load_project, except: %i[create]
910
authorize_resource :project, except: %i[create]
1011

app/controllers/api/scratch/scratch_controller.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
module Api
44
module Scratch
55
class ScratchController < ApiController
6-
before_action :authorize_user
7-
before_action :only_allow_schools_to_use_scratch
8-
9-
def only_allow_schools_to_use_scratch
10-
return true if current_user.schools.any?
11-
12-
raise ActiveRecord::RecordNotFound, 'Not Found'
13-
end
146
end
157
end
168
end

0 commit comments

Comments
 (0)