Skip to content

Commit

Permalink
Rename show_on_type_of_referrals to referral_authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
dhernandez-quoin committed Nov 15, 2023
1 parent d5b189a commit 9f3867e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v2/roles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def role_params
@role_params ||= params.require(:data).permit(
:id, :unique_id, :name, :description, :disabled,
:group_permission, :referral, :transfer, :is_manager, :reporting_location_level,
:show_on_type_of_referral, permissions: {}, form_section_read_write: {}, module_unique_ids: []
:referral_authorization, permissions: {}, form_section_read_write: {}, module_unique_ids: []
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const FIELD_NAMES = {
isManager: "is_manager",
reportingLocationLevel: "reporting_location_level",
disabled: "disabled",
showOnTypeOfReferral: "show_on_type_of_referral"
referralAuthorization: "referral_authorization"
};
export const ACTION_BUTTONS_NAME = "ActionButtons";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export default (groupPermissions, i18n, adminLevelMap) => {
tooltip: i18n.t("permissions.resource.referral.actions.refer.explanation")
}),
FieldRecord({
display_name: i18n.t("permissions.resource.show_on_type_of_referral.label"),
name: FIELD_NAMES.showOnTypeOfReferral,
display_name: i18n.t("permissions.resource.referral_authorization.label"),
name: FIELD_NAMES.referralAuthorization,
type: TICK_FIELD,
tooltip: i18n.t("permissions.resource.show_on_type_of_referral.explanation")
tooltip: i18n.t("permissions.resource.referral_authorization.explanation")
}),
FieldRecord({
display_name: i18n.t("permissions.resource.module.label"),
Expand Down
2 changes: 1 addition & 1 deletion app/models/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Role < ApplicationRecord
'disabled' => { 'type' => 'boolean' }, 'module_unique_ids' => { 'type' => 'array' },
'permissions' => { 'type' => 'object' }, 'form_section_read_write' => { 'type' => 'object' },
'reporting_location_level' => { 'type' => %w[integer null] },
'show_on_type_of_referral' => { 'type' => 'boolean' }
'referral_authorization' => { 'type' => 'boolean' }
}.freeze

has_many :form_permissions
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v2/roles/_role.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ json.unique_id role.unique_id
json.name role.name
json.description role.description
json.group_permission role.group_permission
json.show_on_type_of_referral role.show_on_type_of_referral
json.referral_authorization role.referral_authorization
json.referral role.referral
json.transfer role.transfer
json.disabled role.disabled
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3076,7 +3076,7 @@ en:
explanation: If you disable this Role, you will no longer be able to assign
it to User accounts.
label: Disabled
show_on_type_of_referral:
referral_authorization:
explanation: This means the role will appear as an option for the "Type of Referral"
dropdown when the user performs an internal referral. If the user chooses this role as the type of referral,
the referral recipient will only be able to access the forms which the selected role can access.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

# Copyright (c) 2014 - 2023 UNICEF. All rights reserved.

class AddReferralAuthorizationToRole < ActiveRecord::Migration[5.2]
def change
add_column :roles, :referral_authorization, :boolean, null: false, default: false
end
end

This file was deleted.

3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_09_21_124122) do
ActiveRecord::Schema.define(version: 2023_11_10_000000) do

# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
Expand Down Expand Up @@ -501,6 +501,7 @@
t.boolean "disabled", default: false, null: false
t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.boolean "referral_authorization", default: false, null: false
t.index ["permissions"], name: "index_roles_on_permissions", using: :gin
t.index ["unique_id"], name: "index_roles_on_unique_id", unique: true
end
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/v2/roles_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
name: 'CP Administrator 00',
description: 'Administrator_description',
group_permission: 'all',
show_on_type_of_referral: false,
referral_authorization: true,
referral: false,
transfer: false,
disabled: false,
Expand Down Expand Up @@ -485,7 +485,7 @@
name: 'CP Administrator 00',
description: 'Administrator_description',
group_permission: 'all',
show_on_type_of_referral: false,
referral_authorization: false,
referral: false,
transfer: false,
disabled: false,
Expand Down

0 comments on commit 9f3867e

Please sign in to comment.