From 8f04e87b466e79fa2086d69d9c49f5af89b68cb9 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 10 Mar 2023 19:21:00 -0600 Subject: AƱade CompaniesController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/master_controller.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/controllers/master_controller.rb (limited to 'app/controllers/master_controller.rb') diff --git a/app/controllers/master_controller.rb b/app/controllers/master_controller.rb new file mode 100644 index 0000000..b2075d5 --- /dev/null +++ b/app/controllers/master_controller.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# The father class of all controllers that require the master role to fulfill requests. +class MasterController < AuthenticatedController + before_action :assert_master_role + + private + + def assert_master_role + return if current_user_account.role == 'master' + + render json: { error_message: 'No cuenta con los permisos necesarios' }, status: :forbidden + end +end -- cgit v1.2.3