diff --git a/app/assets/stylesheets/application.bootstrap.scss b/app/assets/stylesheets/application.bootstrap.scss index 9254303d881..57e48faba32 100644 --- a/app/assets/stylesheets/application.bootstrap.scss +++ b/app/assets/stylesheets/application.bootstrap.scss @@ -284,6 +284,21 @@ input.search-bar { } } +.custom-select { + .select-brand-control { + border-color: var(--brand-color) !important; + box-shadow: 0 0 0 1px var(--brand-color) !important; + } + + .select-brand-option { + background-color: whitesmoke; + color: var(--brand-color) !important; + &:active { + background-color: var(--brand-color-light) !important; + } + } +} + //Brand :root { --brand-color: ''; diff --git a/app/controllers/api/v1/admin/role_permissions_controller.rb b/app/controllers/api/v1/admin/role_permissions_controller.rb index b694807ca1e..f1cf0f30ca2 100644 --- a/app/controllers/api/v1/admin/role_permissions_controller.rb +++ b/app/controllers/api/v1/admin/role_permissions_controller.rb @@ -50,7 +50,7 @@ def update private def role_params - params.require(:role).permit(:role_id, :name, :value) + params.require(:role).permit(:role_id, :name, :value, value: []) end def create_default_room diff --git a/app/controllers/api/v1/recordings_controller.rb b/app/controllers/api/v1/recordings_controller.rb index 09262909c0b..f241f552338 100644 --- a/app/controllers/api/v1/recordings_controller.rb +++ b/app/controllers/api/v1/recordings_controller.rb @@ -66,9 +66,13 @@ def destroy def update_visibility new_visibility = params[:visibility].to_s - new_visibility_params = visibility_params_of(new_visibility) + allowed_visibilities = JSON.parse(RolePermission.joins(:permission) + .find_by(role_id: current_user.role_id, permission: { name: 'AccessToVisibilities' }) + .value) + + return render_error status: :forbidden unless allowed_visibilities.include?(new_visibility) - return render_error status: :bad_request if new_visibility_params.nil? + new_visibility_params = visibility_params_of(new_visibility) bbb_api = BigBlueButtonApi.new(provider: current_provider) diff --git a/app/javascript/components/admin/roles/forms/EditRoleForm.jsx b/app/javascript/components/admin/roles/forms/EditRoleForm.jsx index f2ee3793d50..b80e15dcdbf 100644 --- a/app/javascript/components/admin/roles/forms/EditRoleForm.jsx +++ b/app/javascript/components/admin/roles/forms/EditRoleForm.jsx @@ -18,6 +18,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Button, Stack } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; +import Select from 'react-select'; import Form from '../../../shared_components/forms/Form'; import FormControl from '../../../shared_components/forms/FormControl'; import useUpdateRole from '../../../../hooks/mutations/admin/roles/useUpdateRole'; @@ -31,7 +32,6 @@ import { useAuth } from '../../../../contexts/auth/AuthProvider'; import RolePermissionRowPlaceHolder from '../RolePermissionRowPlaceHolder'; import useEditRoleNameForm from '../../../../hooks/forms/admin/roles/useEditRoleNameForm'; import useEditRoleLimitForm from '../../../../hooks/forms/admin/roles/useEditRoleLimitForm'; -import Select from "react-select"; export default function EditRoleForm({ role }) { const { t } = useTranslation(); @@ -45,6 +45,14 @@ export default function EditRoleForm({ role }) { const { methods: methodsName, fields: fieldsName } = useEditRoleNameForm({ defaultValues: { name: role?.name } }); + const visibilityOptions = [ + { value: 'Published', label: 'Published' }, + { value: 'Unpublished', label: 'Unpublished' }, + { value: 'Protected', label: 'Protected' }, + { value: 'Public', label: 'Public' }, + { value: 'Public/Protected', label: 'Public/Protected' }, + ]; + const { methods: methodsLimit, fields: fieldsLimit, @@ -145,16 +153,19 @@ export default function EditRoleForm({ role }) {