Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple roles to be selected for users #1856

Merged
merged 2 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/js/app/editor/Components/Password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
type="password"
:name="name"
:value="value"
:required="required == 1"
:required="required"
:readonly="readonly"
:data-errormessage="errormessage"
:pattern="pattern"
Expand Down Expand Up @@ -48,7 +48,7 @@ export default {
id: String,
hidden: Boolean,
strength: Boolean,
required: Number,
required: Boolean,
readonly: Boolean,
errormessage: String | Boolean, //string if errormessage is set, and false otherwise
pattern: String | Boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Backend/UserEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function save(?User $user, ValidatorInterface $validator): Response

$displayName = $user->getDisplayName();
$locale = Json::findScalar($this->getFromRequest('locale'));
$roles = (array) Json::findScalar($this->getFromRequest('roles'));
$roles = Json::findArray($this->getFromRequest('roles'));
$status = Json::findScalar($this->getFromRequest('ustatus', UserStatus::ENABLED));

if (empty($user->getUsername())) {
Expand Down
4 changes: 3 additions & 1 deletion templates/_partials/fields/select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
{% set options = select_options(field) %}
{% endif %}

{% set multiple = field.definition.get('multiple')|default ? 'true' : 'false' %}
{% if multiple is not defined %}
{% set multiple = field.definition.get('multiple')|default ? 'true' : 'false' %}
{% endif %}

{% block field %}
<editor-select
Expand Down
5 changes: 3 additions & 2 deletions templates/users/edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
'name' : 'locale',
'value' : userEdit.locale,
'options' : localeOptions,
'required': true,
'required': 'true',
} %}

{% set roleOptions = [] %}
Expand All @@ -95,7 +95,8 @@
'name' : 'roles',
'value' : userEdit.roles,
'options' : roleOptions,
'required': true,
'required': 'true',
'multiple': 'true',
} %}

{% set statusOptions = [] %}
Expand Down