__('Event published notification'), 'notification_daily' => __('Daily notifications'), 'notification_weekly' => __('Weekly notifications'), 'notification_monthly' => __('Monthly notifications'), ]; $notificationsHtml = ''; foreach ($notificationTypes as $notificationType => $description) { $isEnabled = !empty($user['User'][$notificationType]); $boolean = sprintf( '%s', $isEnabled ? 'label label-success label-padding' : 'label label-important label-padding', $isEnabled ? __('Yes') : __('No')); $notificationsHtml .= ''; } $notificationsHtml .= '
' . $description . '' . $boolean . '
'; $isTotp = isset($user['User']['totp']) ? true : false; $boolean = sprintf( '%s', $isTotp ? 'label label-success label-padding' : 'label label-important label-padding', $isTotp ? __('Yes') : __('No')); $totpHtml = $boolean; $totpHtml .= (!$isTotp && !$admin_view ? $this->Html->link(__('Generate'), array('action' => 'totp_new')) : ''); $totpHtml .= ($isTotp && !$admin_view ? $this->Html->link(__('View paper tokens'), array('action' => 'hotp', $user['User']['id'])): ''); if ($isAdmin && $isTotp) { $totpHtml .= sprintf( '%s', h($baseurl), h($user['User']['id']), __($isTotp && !$admin_view ? ' Delete' : 'Delete') ); } $table_data = [ array('key' => __('ID'), 'value' => $user['User']['id']), array( 'key' => __('Email'), 'html' => h($user['User']['email']) . ($admin_view ? sprintf( ' ', $baseurl, h($user['User']['id']), __('Send email to user') ) : ''), ), array( 'key' => __('Organisation'), 'html' => $this->OrgImg->getNameWithImg($user), ), array( 'key' => __('Role'), 'html' => $this->Html->link($user['Role']['name'], array('controller' => 'roles', 'action' => 'view', $user['Role']['id'])), ), // array('key' => __('TOTP'), 'boolean' => isset($user['User']['totp']) ? true : false), array( 'key' => __('TOTP'), 'html' => $totpHtml ), array( 'key' => __('Email notifications'), 'html' => $notificationsHtml, ), array('key' => __('Contact alert enabled'), 'boolean' => $user['User']['contactalert']) ]; if (!$admin_view && !$user['Role']['perm_auth']) { $table_data[] = array( 'key' => __('Auth key'), 'html' => sprintf('%s', __('Request API access')), ); } if (empty(Configure::read('Security.advanced_authkeys')) && $user['Role']['perm_auth']) { $authkey_data = sprintf( '**************************************** %s', h($user['User']['authkey']), __('Reveal hidden value'), sprintf( ' (%s)', $this->Form->postLink(__('reset'), array('action' => 'resetauthkey', $user['User']['id'])) ) ); $table_data[] = array( 'key' => __('Auth key'), 'html' => $authkey_data ); } if (Configure::read('Plugin.CustomAuth_enable') && !empty($user['User']['external_auth_key'])) { $header = Configure::read('Plugin.CustomAuth_header') ?: 'AUTHORIZATION'; $table_data[] = array( 'key' => __('Customauth header'), 'html' => sprintf( '%s: %s', h($header), h($user['User']['external_auth_key']) ) ); } $table_data[] = array( 'key' => __('Invited By'), 'html' => empty($invitedBy['User']['email']) ? 'N/A' : sprintf('%s', $baseurl, h($invitedBy['User']['id']), h($invitedBy['User']['email'])), ); $org_admin_data = array(); if ($admin_view) { foreach ($user['User']['orgAdmins'] as $orgAdminId => $orgAdminEmail) { $org_admin_data[] = sprintf( '%s ', $baseurl, h($orgAdminId), h($orgAdminEmail), $baseurl, h($orgAdminId), __('Send email to user') ); } $table_data[] = array('key' => __('Org admin'), 'html' => implode('
', $org_admin_data)); } $table_data[] = array('key' => __('NIDS Start SID'), 'value' => $user['User']['nids_sid']); if ($admin_view) { $table_data[] = array('key' => __('Terms accepted'), 'boolean' => $user['User']['termsaccepted']); $table_data[] = array('key' => __('Must change password'), 'boolean' => $user['User']['change_pw']); } if (!empty($user['User']['gpgkey'])) { $table_data[] = array( 'key' => __('PGP key'), 'element' => 'genericElements/key', 'element_params' => array('key' => $user['User']['gpgkey']), ); $table_data[] = array( 'key' => __('PGP key fingerprint'), 'value_class' => 'quickSelect', 'value' => $user['User']['fingerprint'] ? chunk_split($user['User']['fingerprint'], 4, ' ') : 'N/A' ); $table_data[] = array( 'key' => __('PGP key status'), 'value_class' => (empty($user['User']['pgp_status']) || $user['User']['pgp_status'] !== 'OK') ? 'red': '', 'value' => !empty($user['User']['pgp_status']) ? $user['User']['pgp_status'] : 'N/A' ); } else { $table_data[] = array( 'key' => __('PGP key'), 'boolean' => false, ); } if (Configure::read('SMIME.enabled')) { $table_data[] = array( 'key' => __('S/MIME Public certificate'), 'element' => 'genericElements/key', 'element_params' => array('key' => $user['User']['certif_public']), ); } $table_data[] = array( 'key' => __('Created'), 'html' => $user['User']['date_created'] ? $this->Time->time($user['User']['date_created']) : __('N/A') ); $table_data[] = array( 'key' => __('Last password change'), 'html' => $user['User']['last_pw_change'] ? $this->Time->time($user['User']['last_pw_change']) : __('N/A') ); if ($admin_view) { $table_data[] = array( 'key' => __('News read at'), 'html' => $user['User']['newsread'] ? $this->Time->time($user['User']['newsread']) : __('N/A') ); $table_data[] = array( 'key' => __('Disabled'), 'class' => empty($user['User']['disabled']) ? '' : 'background-red', 'boolean' => $user['User']['disabled'] ); } echo $this->element('genericElements/assetLoader', array( 'css' => array('vis', 'distribution-graph'), 'js' => array('vis', 'jquery-ui.min', 'network-distribution-graph') )); echo sprintf( '
%s
%s%s%s
%s%s%s
', sprintf( '

%s

%s', __('User %s', h($user['User']['email'])), $this->element('genericElements/viewMetaTable', array('table_data' => $table_data)) ), sprintf( '
%s', sprintf( '%s/users/view/%s.json', $baseurl, h($user['User']['id']) ), __('Download user profile for data portability') ), sprintf( ' %s', sprintf( '%s/logs/index', $baseurl ), __('Review user logs') ), sprintf( ' %s', sprintf( '%s/users/view_login_history/%s', $baseurl, h($user['User']['id']) ), __('Review user logins') ), $me['Role']['perm_auth'] ? $this->element('/genericElements/accordion', array('title' => __('Auth keys'), 'url' => '/auth_keys/index/' . h($user['User']['id']))) : '', $me['Role']['perm_site_admin'] ? $this->element( '/genericElements/accordion', [ 'title' => __('Benchmarks'), 'url' => '/benchmarks/index/scope:user/average:1/aggregate:1/key:' . h($user['User']['id']) ] ) : '', $this->element('/genericElements/accordion', array('title' => 'Events', 'url' => '/events/index/searchemail:' . urlencode(h($user['User']['email'])))) ); $current_menu = [ 'admin_view' => ['menuList' => 'admin', 'menuItem' => 'viewUser'], 'view' => ['menuList' => 'globalActions', 'menuItem' => 'view'] ]; echo $this->element('/genericElements/SideMenu/side_menu', $current_menu[$admin_view ? 'admin_view' : 'view']);