Commit 5550f0cb authored by Alexis Ragot's avatar Alexis Ragot

fix user roles selection

parent 8c87e402
......@@ -137,7 +137,7 @@ class userAccount
{
$userAccountId = $this->addUserAccount($userAccount);
if (is_array($userAccount->roles)) {
if (is_array($userAccount->roles && !empty($userAccount->roles))) {
foreach ($userAccount->roles as $roleId) {
\laabs::callService("auth/roleMember/create", $roleId, $userAccountId);
}
......@@ -250,7 +250,7 @@ class userAccount
$this->sdoFactory->deleteChildren("auth/roleMember", $userAccount, "auth/account");
if (is_array($userAccount->roles)) {
if (is_array($userAccount->roles) && !empty($userAccount->roles)) {
foreach ($userAccount->roles as $roleId) {
if ($roleId == null) {
continue;
......
......@@ -39,7 +39,7 @@ class userAccountUpdate
/**
* @var string
* @pattern #^[A-Za-z][A-Za-z0-9_.@]*[A-Za-z]$#
* @pattern #^[A-Za-z_][A-Za-z0-9_]*$#
* @notempty
*/
public $accountName;
......
......@@ -106,6 +106,7 @@ class user
$view->setSource('allowUserModification', true);
$view->setSource('roles', $roles);
$view->setSource('user', $user);
$view->setSource('publicArchive', \laabs::configuration('presentation.maarchRM')['publicArchives']);
$userPositions = \laabs::callService("organization/organization/readUserpositions_accountId_",$user->accountId);
$view->setSource('userPositions', $userPositions);
......
<div id="user_RoleContain" data-publicarchive="[?merge publicArchive ?]" data-roles="[?merge user.roles ?]">
<form class="">
<div class="row">
<div class="col-md-12">
<br/>
<label>Role</label>
<?merge publicArchive.ifeq('') ?>
<div class="form-group">
<div class="list-group" id="listRoles">
<?merge roles ?>
<a class="list-group-item" data-id="[?merge .roleId ?]"><?merge .roleName ?></a>
</div>
<div class="col-md-12">
<br/>
<label>Role</label>
<?merge publicArchive.bool().not() ?>
<div class="form-group">
<div class="list-group" id="listRoles">
<?merge roles ?>
<a class="list-group-item" data-id="[?merge .roleId ?]"><?merge .roleName ?></a>
</div>
</div>
<?merge publicArchive.bool() ?>
<div class="form-group">
<select class="form-control" name="role" id="role" data-role="[?merge user.roles[0].roleId ?]">
<option value="">Select a role</option>
<?merge roles ?>
<option value="[?merge .roleId ?]"><?merge .roleName ?></option>
</select>
</div>
</div>
</div>
<span class="hide" id="remove_text">Remove</span>
</form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment