From 3dae1ce143d006cc75940b746a8eb74982e6e861 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 11 Mar 2023 12:10:57 -0600 Subject: AƱade test de scoping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/authenticated_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/controllers/authenticated_controller.rb') diff --git a/app/controllers/authenticated_controller.rb b/app/controllers/authenticated_controller.rb index de02cab..56159ab 100644 --- a/app/controllers/authenticated_controller.rb +++ b/app/controllers/authenticated_controller.rb @@ -13,6 +13,12 @@ class AuthenticatedController < ApplicationController @current_user_account ||= UserAccount.find_by(email:) end + def current_user_role + return if decoded_token.nil? + + decoded_token[0]['aud'] + end + def authentication_token @authentication_token ||= request.headers[:authorization]&.sub(/^Bearer /, '') end -- cgit v1.2.3