* [FIX] Fixed issue when displaying username on session bar when it isn't available. Closes #1048. Thanks to @vmario89 for the feedback.

Signed-off-by: nuxsmin <nuxsmin@syspass.org>
This commit is contained in:
nuxsmin
2018-10-01 23:33:09 +02:00
parent 2581dfd44d
commit cb92560425
9 changed files with 32 additions and 33 deletions

View File

@@ -116,10 +116,10 @@ abstract class ControllerBase
{
$this->view->assign('timeStart', $this->router->request()->server()->get('REQUEST_TIME_FLOAT'));
$this->view->assign('queryTimeStart', microtime());
$this->view->assign('userId', $this->userData->getId());
$this->view->assign('userGroupId', $this->userData->getUserGroupId());
$this->view->assign('userIsAdminApp', $this->userData->getIsAdminApp());
$this->view->assign('userIsAdminAcc', $this->userData->getIsAdminAcc());
$this->view->assign('ctx_userId', $this->userData->getId());
$this->view->assign('ctx_userGroupId', $this->userData->getUserGroupId());
$this->view->assign('ctx_userIsAdminApp', $this->userData->getIsAdminApp());
$this->view->assign('ctx_userIsAdminAcc', $this->userData->getIsAdminAcc());
$this->view->assign('themeUri', $this->view->getTheme()->getThemeUri());
$this->view->assign('isDemo', $this->configData->isDemoEnabled());
$this->view->assign('icons', $this->theme->getIcons());

View File

@@ -239,11 +239,10 @@ final class LayoutHelper extends HelperBase
$userType = $icons->getIconAccAdmin();
}
$this->view->assign('context_userType', $userType);
$this->view->assign('context_userId', $userData->getId());
$this->view->assign('context_userLogin', mb_strtoupper($userData->getLogin()));
$this->view->assign('context_userName', $userData->getName() ?: mb_strtoupper($this->view->userLogin));
$this->view->assign('context_userGroup', $userData->getUserGroupName());
$this->view->assign('ctx_userType', $userType);
$this->view->assign('ctx_userLogin', mb_strtoupper($userData->getLogin()));
$this->view->assign('ctx_userName', $userData->getName() ?: mb_strtoupper($userData->getLogin()));
$this->view->assign('ctx_userGroup', $userData->getUserGroupName());
$this->view->assign('showPassIcon', !($this->configData->isLdapEnabled() && $userData->getIsLdap()));
$this->view->assign('notifications', 0);
}

View File

@@ -56,7 +56,7 @@
<li id="btnUserPass" class="btn-action mdl-menu__item"
data-onclick="appMgmt/show"
data-action-route="user/editPass"
data-item-id="<?php echo $context_userId; ?>"
data-item-id="<?php echo $ctx_userId; ?>"
data-sk="<?php echo $sk; ?>">
<i class="material-icons">lock</i>
<?php echo __('Cambiar Clave de Usuario'); ?>
@@ -120,7 +120,7 @@
title="<?php echo __('Cambiar Clave de Usuario'); ?>"
data-onclick="appMgmt/show"
data-action-route="user/editPass"
data-item-id="<?php echo $context_userId; ?>"
data-item-id="<?php echo $ctx_userId; ?>"
data-sk="<?php echo $sk; ?>">
<i class="btn-action material-icons">security</i>
<?php echo __('Cambiar Clave de Usuario'); ?>
@@ -132,14 +132,14 @@
data-onclick="user/showSettings"
data-action-route="userSettingsManager/index">
<i class="btn-action material-icons">account_circle</i>
<span id="user-name"><?php echo $context_userName; ?></span>
<span id="user-name"><?php echo $ctx_userName; ?></span>
<span for="user-name"
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $context_userGroup); ?></span>
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $ctx_userGroup); ?></span>
<?php /** @var \SP\Html\Assets\IconInterface $userType */
if ($context_userType !== null): ?>
<i id="user-type" class="material-icons"><?php echo $context_userType->getIcon(); ?></i>
if ($ctx_userType !== null): ?>
<i id="user-type" class="material-icons"><?php echo $ctx_userType->getIcon(); ?></i>
<span for="user-type"
class="mdl-tooltip mdl-tooltip--top"><?php echo $context_userType->getTitle(); ?></span>
class="mdl-tooltip mdl-tooltip--top"><?php echo $ctx_userType->getTitle(); ?></span>
<?php endif; ?>
</a>

View File

@@ -1,18 +1,18 @@
<footer>
<div id="footer-left" class="footer-parts">
<?php if ($loadApp === true && isset($context_userName)): ?>
<?php if ($loadApp === true && isset($ctx_userName)): ?>
<div id="session">
<span id="user-info">
<?php if ($context_userType !== null): ?>
<i id="user-type-footer" class="material-icons"><?php echo $context_userType->getIcon(); ?></i>
<?php if ($ctx_userType !== null): ?>
<i id="user-type-footer" class="material-icons"><?php echo $ctx_userType->getIcon(); ?></i>
<span for="user-type-footer"
class="mdl-tooltip mdl-tooltip--top"><?php echo $context_userType->getTitle(); ?></span>
class="mdl-tooltip mdl-tooltip--top"><?php echo $ctx_userType->getTitle(); ?></span>
<?php else: ?>
<i class="material-icons">face</i>
<?php endif; ?>
<span id="user-name-footer"><?php echo $context_userName; ?></span>
<span id="user-name-footer"><?php echo $ctx_userName; ?></span>
<span for="user-name-footer"
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $context_userGroup); ?></span>
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $ctx_userGroup); ?></span>
</span>
</div>
<?php endif; ?>

View File

@@ -18,7 +18,7 @@
<?php if (!$isView): ?>
<select id="other_users_view" name="other_users_view[]" multiple="multiple"
class="select-box-tags"
data-current-item-id="<?php echo $userId; ?>" <?php echo $disabled; ?>>
data-current-item-id="<?php echo $ctx_userId; ?>" <?php echo $disabled; ?>>
<option value=""><?php echo __('Seleccionar Usuarios'); ?></option>
<?php /** @var \SP\Mvc\View\Components\SelectItem[] $otherUsersView */
foreach ($otherUsersView as $otherUser): ?>
@@ -50,7 +50,7 @@
<?php if (!$isView): ?>
<select id="other_users_edit" name="other_users_edit[]" multiple="multiple"
class="select-box-tags"
data-current-item-id="<?php echo $userId; ?>" <?php echo $disabled; ?>>
data-current-item-id="<?php echo $ctx_userId; ?>" <?php echo $disabled; ?>>
<option value=""><?php echo __('Seleccionar Usuarios'); ?></option>
<?php /** @var \SP\Mvc\View\Components\SelectItem[] $otherUsersEdit */
foreach ($otherUsersEdit as $otherUser): ?>
@@ -88,7 +88,7 @@
<?php if (!$isView): ?>
<select id="other_usergroups_view" name="other_usergroups_view[]" multiple="multiple"
class="select-box-tags"
data-current-item-id="<?php echo $userGroupId; ?>" <?php echo $disabled; ?>>
data-current-item-id="<?php echo $ctx_userGroupId; ?>" <?php echo $disabled; ?>>
<option value=""><?php echo __('Seleccionar Grupos'); ?></option>
<?php /** @var \SP\Mvc\View\Components\SelectItem[] $otherUserGroupsView */
foreach ($otherUserGroupsView as $otherUserGroup): ?>
@@ -120,7 +120,7 @@
<?php if (!$isView): ?>
<select id="other_usergroups_edit" name="other_usergroups_edit[]" multiple="multiple"
class="select-box-tags"
data-current-item-id="<?php echo $userGroupId; ?>" <?php echo $disabled; ?>>
data-current-item-id="<?php echo $ctx_userGroupId; ?>" <?php echo $disabled; ?>>
<option value=""><?php echo __('Seleccionar Grupos'); ?></option>
<?php /** @var \SP\Mvc\View\Components\SelectItem[] $otherUserGroupsEdit */
foreach ($otherUserGroupsEdit as $otherUserGroup): ?>
@@ -152,7 +152,7 @@
</tr>
<?php endif; ?>
<?php if (isset($editAction) && ($userIsAdminApp || $userIsAdminAcc || $userId === $accountData->getUserId())): ?>
<?php if (isset($editAction) && ($ctx_userIsAdminApp || $ctx_userIsAdminAcc || $ctx_userId === $accountData->getUserId())): ?>
<tr>
<td class="descField"><?php echo __('Creador'); ?></td>
<td class="valField">
@@ -169,7 +169,7 @@
</tr>
<?php endif; ?>
<?php if ($userIsAdminApp || $userIsAdminAcc): ?>
<?php if ($ctx_userIsAdminApp || $ctx_userIsAdminAcc): ?>
<tr>
<td class="descField"><?php echo __('Grupo Principal'); ?></td>
<td class="valField">

View File

@@ -28,7 +28,7 @@
<?php echo $lastBackupTime; ?>
</td>
</tr>
<?php if ($userIsAdminApp): ?>
<?php if ($ctx_userIsAdminApp): ?>
<tr>
<td class="descField">
<?php echo __('Descargar Actual'); ?>
@@ -106,7 +106,7 @@
<?php echo $lastExportTime; ?>
</td>
</tr>
<?php if ($userIsAdminApp): ?>
<?php if ($ctx_userIsAdminApp): ?>
<tr>
<td class="descField">
<?php echo __('Descargar Actual'); ?>

View File

@@ -157,7 +157,7 @@
</div>
</div>
</li>
<?php if ($userIsAdminApp): ?>
<?php if ($ctx_userIsAdminApp): ?>
<li>
<button type="button"
class="btn-action mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored <?php echo $icons->getIconCheck()->getClassButton(); ?>"

View File

@@ -178,7 +178,7 @@
<tr>
<td>
<ul class="user-list-action mdl-list">
<?php if ($userIsAdminApp || $isDemo): ?>
<?php if ($ctx_userIsAdminApp || $isDemo): ?>
<li class="mdl-list__item mdl-list__item--two-line">
<div class="mdl-switch__box">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect"

View File

@@ -63,7 +63,7 @@
</td>
</tr>
<?php if (!$isView && $userIsAdminApp): ?>
<?php if (!$isView && $ctx_userIsAdminApp): ?>
<tr>
<td class="descField"><?php echo __('Usuario'); ?></td>
<td class="valField">