forked from External/greenlight
GRN2-xx: Switch the relation between users and roles to make queries cleaner and faster (#1299)
* First steps * Fixes in account creation flow * Fixed most testcases * more test fixes * Fixed more test cases * Passing tests and rubocop * Added rake task to remove rooms
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<%= form_for @user, url: update_user_path, method: :patch do |f| %>
|
||||
<%= form_for @user, url: update_user_path, method: :post do |f| %>
|
||||
<%= hidden_field_tag :setting, "account" %>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
@ -38,28 +38,21 @@
|
||||
<%= f.label t("settings.account.language"), class: "form-label" %>
|
||||
<%= f.select :language, language_options, {}, { class: "form-control custom-select" } %>
|
||||
|
||||
<% current_user_role = current_user.highest_priority_role %>
|
||||
<br>
|
||||
<br>
|
||||
<%= f.label t("settings.account.roles"), class: "form-label" %>
|
||||
<div id="role-tag-container" class="tags mb-1">
|
||||
<% @user.roles.by_priority.each do |role| %>
|
||||
<span id="<%= "user-role-tag_#{role.id}" %>" style="<%= "background-color: #{role_colour(role)};border-color: #{role_colour(role)};" %>" class="tag user-role-tag">
|
||||
<%= translated_role_name(role) %>
|
||||
<% if (current_user_role.get_permission("can_manage_users") || current_user_role.name == "super_admin") && (role.priority > current_user_role.priority || current_user_role.name == "admin") %>
|
||||
<a data-role-id="<%= role.id %>" class="tag-addon clear-role">
|
||||
<i data-role-id="<%= role.id %>" class="fas fa-times"></i>
|
||||
</a>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if current_user_role.get_permission("can_manage_users") || current_user_role.name == "super_admin" %>
|
||||
<% provider = Rails.configuration.loadbalanced_configuration ? current_user.provider : "greenlight" %>
|
||||
<%= f.select :roles, Role.editable_roles(@user_domain).map{|role| [translated_role_name(role), role.id, {'data-colour' => role_colour(role)}]}.unshift(["", nil, {'data-colour' => nil}]), {disabled: disabled_roles(@user)}, { class: "form-control custom-select", id: "role-select-dropdown" } %>
|
||||
<% end %>
|
||||
<%= f.hidden_field :role_ids, id: "user_role_ids", value: @user.roles.by_priority.pluck(:id).uniq %>
|
||||
<%= f.label t("settings.account.roles"), class: "form-label mt-5" %>
|
||||
|
||||
<% if current_user.role.get_permission("can_manage_users") %>
|
||||
<select id="role-dropdown" class="selectpicker show-tick" >
|
||||
<% role_options.each do |role| %>
|
||||
<option value="<%=role.id%>"><%= translated_role_name(role) %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
<%= f.hidden_field :role_id, id: "user_role_id", value: @user.role.id %>
|
||||
<% else %>
|
||||
<span style="<%= "background-color: #{role_colour(@user.role)};border-color: #{role_colour(@user.role)};" %>" class="tag custom-role-tag">
|
||||
<%= translated_role_name(@user.role) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<%= f.label t("settings.account.image"), class: "form-label mt-5" %>
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
|
Reference in New Issue
Block a user