From f013e2b52977725d3b989d3e27b632d318679464 Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Mon, 28 Jun 2021 21:47:04 -0400 Subject: [PATCH] GRN2-385: Recording permission tied to role cleanup (#2812) * Code cleanup * String change --- app/controllers/admins_controller.rb | 2 -- app/controllers/concerns/recorder.rb | 9 --------- app/controllers/rooms_controller.rb | 2 -- app/helpers/application_helper.rb | 10 ++++++++++ config/locales/en.yml | 2 +- db/schema.rb | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index 0cf463a6..ce752999 100644 --- a/app/controllers/admins_controller.rb +++ b/app/controllers/admins_controller.rb @@ -31,8 +31,6 @@ class AdminsController < ApplicationController before_action :find_deleted_user, only: manage_deleted_users before_action :verify_admin_of_user, only: [manage_users, manage_deleted_users] - helper_method :perm_to_record_meeting - # GET /admins def index # Initializa the data manipulation variables diff --git a/app/controllers/concerns/recorder.rb b/app/controllers/concerns/recorder.rb index 6093733e..0365fb2d 100644 --- a/app/controllers/concerns/recorder.rb +++ b/app/controllers/concerns/recorder.rb @@ -123,15 +123,6 @@ module Recorder end end - def perm_to_record_meeting - # define perm without init config of room setting - if recording_consent_required? - @settings.get_value("Room Configuration Recording") != "disabled" && current_user&.role&.get_permission("can_launch_recording") - else - current_user&.role&.get_permission("can_launch_recording") - end - end - private # Gets the email of the room owner to which the recording belongs to diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 0472b99c..118dae9c 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -35,8 +35,6 @@ class RoomsController < ApplicationController before_action :verify_user_not_admin, only: [:show] skip_before_action :verify_authenticity_token, only: [:join] - helper_method :perm_to_record_meeting - # POST / def create # Return to root if user is not signed in diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b0f8625d..2c3121e9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -137,4 +137,14 @@ module ApplicationHelper return "" if date.nil? # Handle invalid dates local_time(date, :default) end + + # Returns true if the user is allowed to record meetings + def perm_to_record_meeting + if recording_consent_required? + @settings.get_value("Room Configuration Recording") != "disabled" && + current_user&.role&.get_permission("can_launch_recording") + else + current_user&.role&.get_permission("can_launch_recording") + end + end end diff --git a/config/locales/en.yml b/config/locales/en.yml index f1469a72..b16e5035 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -145,7 +145,7 @@ en: roles: appear_in_share_list: Include users with this role in the dropdown for sharing rooms can_create_rooms: Can create rooms - can_launch_recording: Allow users with this role to launch recordings + can_launch_recording: Allow users with this role to record their meetings delete: Delete the role invalid_create: There was a problem creating a new role. Please check the role values and try again invalid_order: There was a problem updating the priority of the role. Please check the values and try again diff --git a/db/schema.rb b/db/schema.rb index 28a7d1ce..bfd4abc3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_01_08_032132) do +ActiveRecord::Schema.define(version: 2021_03_19_160827) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false