Fork of with Debian packaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

73 lines
2.6 KiB

# frozen_string_literal: true
# BigBlueButton open source conferencing system -
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <>.
require 'i18n/language/mapping'
module UsersHelper
include I18n::Language::Mapping
def recaptcha_enabled?
def disabled_roles(user)
current_user_role = current_user.role
# Admins are able to remove the admin role from other admins
# For all other roles they can only add/remove roles with a higher priority
disallowed_roles = if == "admin"
Role.editable_roles(@user_domain).where("priority < #{current_user_role.priority}")
Role.editable_roles(@user_domain).where("priority <= #{current_user_role.priority}")
[] + disallowed_roles
# Returns language selection options for user edit
def language_options
locales = I18n.available_locales
language_opts = [["<<<< #{t('language_default')} >>>>", "default"]]
locales.each do |locale|
language_mapping = I18n::Language::Mapping.language_mapping_list[locale.to_s.gsub("_", "-")]
language_opts.push([language_mapping["nativeName"], locale.to_s])
# Returns a list of roles that the user can have
def role_options
Role.editable_roles(@user_domain).where("priority >= ?", current_user.role.priority).by_priority
# Parses markdown for rendering.
def markdown(text)
markdown =,
no_intra_emphasis: true,
fenced_code_blocks: true,
disable_indented_code_blocks: true,
autolink: true,
tables: true,
underline: true,
highlight: true)