From 5969eb8e3030c822333872f24daa23b9eac1f4f7 Mon Sep 17 00:00:00 2001 From: Dj Padzensky Date: Thu, 14 Jul 2016 13:20:56 -0700 Subject: Added tighter access controls to profile section --- app/Template/user_modification/show.php | 8 ++-- app/Template/user_view/sidebar.php | 68 ++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/app/Template/user_modification/show.php b/app/Template/user_modification/show.php index 396d550d..506c9161 100644 --- a/app/Template/user_modification/show.php +++ b/app/Template/user_modification/show.php @@ -11,16 +11,16 @@ form->text('username', $values, $errors, array('required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?> form->label(t('Name'), 'name') ?> - form->text('name', $values, $errors) ?> + form->text('name', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_name') ? '' : 'readonly')) ?> form->label(t('Email'), 'email') ?> - form->email('email', $values, $errors) ?> + form->email('email', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_email') ? '' : 'readonly')) ?> form->label(t('Timezone'), 'timezone') ?> - form->select('timezone', $timezones, $values, $errors) ?> + form->select('timezone', $timezones, $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_timezone') ? '' : 'disabled')) ?> form->label(t('Language'), 'language') ?> - form->select('language', $languages, $values, $errors) ?> + form->select('language', $languages, $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_language') ? '' : 'disabled')) ?> user->isAdmin()): ?> form->label(t('Role'), 'role') ?> diff --git a/app/Template/user_view/sidebar.php b/app/Template/user_view/sidebar.php index d200a7f5..3dc6b7bc 100644 --- a/app/Template/user_view/sidebar.php +++ b/app/Template/user_view/sidebar.php @@ -12,18 +12,26 @@ user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?> -
  • app->checkMenuSelection('UserViewController', 'timesheet') ?>> - url->link(t('Time tracking'), 'UserViewController', 'timesheet', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'lastLogin') ?>> - url->link(t('Last logins'), 'UserViewController', 'lastLogin', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'sessions') ?>> - url->link(t('Persistent connections'), 'UserViewController', 'sessions', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'passwordReset') ?>> - url->link(t('Password reset history'), 'UserViewController', 'passwordReset', array('user_id' => $user['id'])) ?> -
  • + user->hasAccess('UserViewController', 'timesheet')): ?> +
  • app->checkMenuSelection('UserViewController', 'timesheet') ?>> + url->link(t('Time tracking'), 'UserViewController', 'timesheet', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'lastLogin')): ?> +
  • app->checkMenuSelection('UserViewController', 'lastLogin') ?>> + url->link(t('Last logins'), 'UserViewController', 'lastLogin', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'sessions')): ?> +
  • app->checkMenuSelection('UserViewController', 'sessions') ?>> + url->link(t('Persistent connections'), 'UserViewController', 'sessions', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'passwordReset')): ?> +
  • app->checkMenuSelection('UserViewController', 'passwordReset') ?>> + url->link(t('Password reset history'), 'UserViewController', 'passwordReset', array('user_id' => $user['id'])) ?> +
  • + hook->render('template:user:sidebar:information', array('user' => $user)) ?> @@ -42,13 +50,13 @@ - + user->hasAccess('UserCredentialController', 'changePassword')): ?>
  • app->checkMenuSelection('UserCredentialController', 'changePassword') ?>> url->link(t('Change password'), 'UserCredentialController', 'changePassword', array('user_id' => $user['id'])) ?>
  • - user->isCurrentUser($user['id'])): ?> + user->isCurrentUser($user['id']) && $this->user->hasAccess('TwoFactorController', 'index')): ?>
  • app->checkMenuSelection('TwoFactorController', 'index') ?>> url->link(t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?>
  • @@ -58,18 +66,26 @@ -
  • app->checkMenuSelection('UserViewController', 'share') ?>> - url->link(t('Public access'), 'UserViewController', 'share', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'notifications') ?>> - url->link(t('Notifications'), 'UserViewController', 'notifications', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'external') ?>> - url->link(t('External accounts'), 'UserViewController', 'external', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('UserViewController', 'integrations') ?>> - url->link(t('Integrations'), 'UserViewController', 'integrations', array('user_id' => $user['id'])) ?> -
  • + user->hasAccess('UserViewController', 'share')): ?> +
  • app->checkMenuSelection('UserViewController', 'share') ?>> + url->link(t('Public access'), 'UserViewController', 'share', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'notifications')): ?> +
  • app->checkMenuSelection('UserViewController', 'notifications') ?>> + url->link(t('Notifications'), 'UserViewController', 'notifications', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'external')): ?> +
  • app->checkMenuSelection('UserViewController', 'external') ?>> + url->link(t('External accounts'), 'UserViewController', 'external', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'integrations')): ?> +
  • app->checkMenuSelection('UserViewController', 'integrations') ?>> + url->link(t('Integrations'), 'UserViewController', 'integrations', array('user_id' => $user['id'])) ?> +
  • + user->hasAccess('UserCredentialController', 'changeAuthentication')): ?> -- cgit v1.2.3