Make user actions available from contextual menu

This commit is contained in:
Frederic Guillot
2017-03-11 15:24:34 -05:00
parent 469112918d
commit a22b8f3dc7
45 changed files with 161 additions and 86 deletions

View File

@@ -6,7 +6,7 @@
<div class="form-actions">
<?php if (! empty($user['avatar_path'])): ?>
<?= $this->url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?>
<?= $this->url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?>
<?php endif ?>
</div>

View File

@@ -2,6 +2,10 @@
<h2><?= t('Two factor authentication') ?></h2>
</div>
<?php if ($this->app->isAjax()): ?>
<?= $this->app->flashMessage() ?>
<?php endif ?>
<?php if (! empty($secret) || ! empty($key_url)): ?>
<div class="panel">
<?php if (! empty($secret)): ?>
@@ -16,13 +20,13 @@
<?php endif ?>
<h3><?= t('Test your device') ?></h3>
<div class="panel">
<form method="post" action="<?= $this->url->href('TwoFactorController', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Code'), 'code') ?>
<?= $this->form->text('code', array(), array(), array('placeholder="123456"', 'autofocus'), 'form-numeric') ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button>
</div>
<?= $this->modal->submitButtons(array('submitLabel' => t('Check my code'))) ?>
</form>
</div>

View File

@@ -11,7 +11,7 @@
</p>
<?php if (! empty($user['api_access_token'])): ?>
<?= $this->url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?>
<?= $this->url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?>
<?php endif ?>
<?= $this->url->link(t('Generate a new token'), 'UserApiAccessController', 'generate', array('user_id' => $user['id']), true, 'btn btn-blue') ?>
<?= $this->url->link(t('Generate a new token'), 'UserApiAccessController', 'generate', array('user_id' => $user['id']), true, 'btn btn-blue js-modal-replace') ?>

View File

@@ -1,5 +1,5 @@
<div class="page-header">
<h2><?= t('Edit Authentication') ?></h2>
<h2><?= t('Authentication Parameters') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('UserCredentialController', 'saveAuthentication', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
@@ -14,11 +14,7 @@
<?= $this->form->checkbox('disable_login_form', t('Disallow login form'), 1, isset($values['disable_login_form']) && $values['disable_login_form'] == 1) ?>
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</div>
<?= $this->modal->submitButtons() ?>
<div class="alert alert-info">
<ul>

View File

@@ -8,7 +8,7 @@
<fieldset>
<?= $this->form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?>
<?= $this->form->password('current_password', $values, $errors) ?>
<?= $this->form->password('current_password', $values, $errors, array('autofocus')) ?>
<?= $this->form->label(t('New password for the user "%s"', $this->user->getFullname($user)), 'password') ?>
<?= $this->form->password('password', $values, $errors) ?>
@@ -17,9 +17,5 @@
<?= $this->form->password('confirmation', $values, $errors) ?>
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</div>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -4,6 +4,83 @@
<li>
<?= $this->url->icon('user', t('View profile'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php if ($user['is_active'] == 1 && $this->user->hasAccess('UserModificationController', 'show')): ?>
<li>
<?= $this->modal->medium('edit', t('Edit'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
</li>
<li>
<?= $this->modal->medium('smile-o', t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($user['is_ldap_user'] == 0 && $this->user->hasAccess('UserCredentialController', 'changePassword')): ?>
<li>
<?= $this->modal->medium('key', t('Change password'), 'UserCredentialController', 'changePassword', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->isCurrentUser($user['id']) && $this->user->hasAccess('TwoFactorController', 'index')): ?>
<li>
<?= $this->modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?>
</li>
<?php elseif ($this->user->hasAccess('TwoFactorController', 'disable') && $user['twofactor_activated'] == 1): ?>
<li>
<?= $this->modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'disable', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'share')): ?>
<li>
<?= $this->modal->medium('share-alt', t('Public access'), 'UserViewController', 'share', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'notifications')): ?>
<li>
<?= $this->modal->medium('bell-o', t('Notifications'), 'UserViewController', 'notifications', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'external')): ?>
<li>
<?= $this->modal->medium('user-circle-o', t('External accounts'), 'UserViewController', 'external', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'integrations')): ?>
<li>
<?= $this->modal->medium('rocket', t('Integrations'), 'UserViewController', 'integrations', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserApiAccessController', 'show')): ?>
<li>
<?= $this->modal->medium('cloud', t('API Access'), 'UserApiAccessController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->isAdmin()): ?>
<li>
<?= $this->url->icon('dashboard', t('User dashboard'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
<?php if ($this->user->hasAccess('UserViewController', 'timesheet')): ?>
<li>
<?= $this->modal->medium('clock-o',t('Time tracking'), 'UserViewController', 'timesheet', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'lastLogin')): ?>
<li>
<?= $this->modal->medium('id-badge', t('Last logins'), 'UserViewController', 'lastLogin', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'sessions')): ?>
<li>
<?= $this->modal->medium('database', t('Persistent connections'), 'UserViewController', 'sessions', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'passwordReset')): ?>
<li>
<?= $this->modal->medium('legal', t('Password reset history'), 'UserViewController', 'passwordReset', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php endif ?>
<?php if ($user['is_active'] == 1 && $this->user->hasAccess('UserStatusController', 'disable') && ! $this->user->isCurrentUser($user['id'])): ?>
<li>
<?= $this->modal->confirm('times', t('Disable'), 'UserStatusController', 'confirmDisable', array('user_id' => $user['id'])) ?>

View File

@@ -13,7 +13,7 @@
<?php if ($user['twofactor_activated'] == 1): ?>
<span title="<?= t('Two factor authentication enabled') ?>">
<i class="fa fa-key" aria-hidden="true"></i>
<i class="fa fa-shield" aria-hidden="true"></i>
</span>
<?php endif ?>

View File

@@ -8,7 +8,7 @@
<fieldset>
<legend><?= t('Profile') ?></legend>
<?= $this->form->label(t('Username'), 'username') ?>
<?= $this->form->text('username', $values, $errors, array('required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?>
<?= $this->form->text('username', $values, $errors, array('autofocus', 'required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?>
<?= $this->form->label(t('Name'), 'name') ?>
<?= $this->form->text('name', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_name') ? '' : 'readonly')) ?>
@@ -34,9 +34,5 @@
</fieldset>
<?php endif ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</div>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -18,9 +18,5 @@
<?= $this->form->checkboxes('notification_projects', $projects, $notifications) ?>
<?php endif ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</div>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -19,7 +19,7 @@
<td><?= $this->dt->datetime($session['expiration']) ?></td>
<td><?= $this->text->e($session['ip']) ?></td>
<td><?= $this->text->e($session['user_agent']) ?></td>
<td><?= $this->url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td>
<td><?= $this->url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true, 'js-modal-replace') ?></td>
</tr>
<?php endforeach ?>
</table>

View File

@@ -9,7 +9,7 @@
<li><strong><?= $this->url->icon('calendar', t('iCal feed'), 'ICalendarController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li>
</ul>
</div>
<?= $this->url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?>
<?= $this->url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red js-modal-replace') ?>
<?php else: ?>
<?= $this->url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?>
<?= $this->url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue js-modal-replace') ?>
<?php endif ?>

View File

@@ -49,7 +49,7 @@
<li <?= $this->app->checkMenuSelection('UserModificationController', 'show') ?>>
<?= $this->url->link(t('Edit profile'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AvatarFile') ?>>
<li <?= $this->app->checkMenuSelection('AvatarFileController') ?>>
<?= $this->url->link(t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>