Skip to content

Commit

Permalink
sec(Users) eliminate prefview and parentab in favor of is_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Nov 5, 2021
1 parent fb873bf commit e9f1f4c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 35 deletions.
6 changes: 3 additions & 3 deletions Smarty/templates/Header.tpl
Expand Up @@ -295,7 +295,7 @@
{/if}
<li class="slds-global-actions__item">
<div class="slds-dropdown-trigger slds-dropdown-trigger_hover">
<button class="slds-button slds-global-actions__avatar slds-global-actions__item-action" title="{$USER}" aria-haspopup="true" onclick="window.location.assign('index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}&modechk=prefview')">
<button class="slds-button slds-global-actions__avatar slds-global-actions__item-action" title="{$USER}" aria-haspopup="true" onclick="window.location.assign('index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}')">
<span class="slds-avatar slds-avatar_circle slds-avatar_medium">
{if $CURRENT_USER_IMAGE}
<img alt="{$USER}" src="{$CURRENT_USER_IMAGE}" />
Expand All @@ -307,13 +307,13 @@
<div class="slds-dropdown slds-dropdown_right">
<ul class="slds-dropdown__list" role="menu" aria-label="Show More">
<li class="slds-dropdown__item" role="presentation">
<a href="index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}&modechk=prefview" role="menuitem" tabindex="0">
<a href="index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}" role="menuitem" tabindex="0">
<span class="slds-truncate" title="{$USER}"><strong>{$USER}</strong></span>
</a>
</li>
<li class="slds-has-divider_top-space" role="separator"></li>
<li class="slds-dropdown__item" role="presentation">
<a href="index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}&modechk=prefview" role="menuitem" tabindex="0">
<a href="index.php?module=Users&action=DetailView&record={$CURRENT_USER_ID}" role="menuitem" tabindex="0">
<span class="slds-truncate" title="{$APP.LBL_MY_PREFERENCES}">{$APP.LBL_MY_PREFERENCES}</span>
</a>
</li>
Expand Down
11 changes: 6 additions & 5 deletions Smarty/templates/UserDetailView.tpl
Expand Up @@ -31,9 +31,6 @@
<input type="hidden" name="isDuplicate" value=false style="margin:0px">
<input type="hidden" name="action" style="margin:0px">
<input type="hidden" name="changepassword" style="margin:0px">
{if $PARENTTAB neq 'Settings'}
<input type="hidden" name="modechk" value="prefview" style="margin:0px">
{/if}
<input type="hidden" name="old_password" style="margin:0px">
<input type="hidden" name="new_password" style="margin:0px">
<input type="hidden" name="return_module" value="Users" style="margin:0px">
Expand All @@ -53,9 +50,13 @@
<tr>
<td width=50 rowspan="2" class="cblds-p_none"><img src="{'ico-users.gif'|@vtiger_imageurl:$THEME}" align="absmiddle"></td>
<td>
{if $PARENTTAB eq 'Settings'}
{if $IS_ADMIN eq 'true'}
<span class="heading2">
<b><a href="index.php?module=Settings&action=index">{'LBL_SETTINGS'|@getTranslatedString} </a> &gt; <a href="index.php?module=Users&action=index"> {$MOD.LBL_USERS} </a>&gt;"{$USERNAME}" </b></span>
<b>
<a href="index.php?module=Settings&action=index">{'LBL_SETTINGS'|@getTranslatedString} </a> &gt;
<a href="index.php?module=Users&action=index"> {$MOD.LBL_USERS} </a>&gt;"{$USERNAME}"
</b>
</span>
{else}
<span class="heading2">
<b>{$APP.LBL_MY_PREFERENCES}</b>
Expand Down
4 changes: 2 additions & 2 deletions Smarty/templates/UserEditView.tpl
Expand Up @@ -138,7 +138,7 @@ function check_duplicate() {ldelim}
<td rowspan="2" width="50"><img src="{'ico-users.gif'|@vtiger_imageurl:$THEME}" align="absmiddle"></td>
<td>
<span class="lvtHeaderText">
{if $PARENTTAB neq ''}
{if $IS_ADMIN}
<b><a href="index.php?module=Settings&action=index">{'LBL_SETTINGS'|@getTranslatedString} </a> &gt; <a href="index.php?module=Users&action=index">{$MOD.LBL_USERS}</a> &gt;
{if $MODE eq 'edit'}
{$UMOD.LBL_EDITING} "{$USERNAME}"
Expand All @@ -149,7 +149,7 @@ function check_duplicate() {ldelim}
{$APP.LBL_DUPLICATING} "{$USERNAME}"
{/if}
{/if}
</b></span>
</b></span>
{else}
<span class="lvtHeaderText"><b>{$APP.LBL_MY_PREFERENCES}</b></span>
{/if}
Expand Down
2 changes: 0 additions & 2 deletions modules/Mobile/views/ListModuleRecords.php
Expand Up @@ -51,7 +51,6 @@ public function process(crmtogo_API_Request $request) {
$response = $wsResponse;
} else {
$wsResponseResult = $wsResponse->getResult();
$CATEGORY = getParentTabFromModule($wsResponseResult['module']);
if ($request->get('compact') !='true') {
$customView = new CustomView($wsResponseResult['module']);
$id1=$request->get('viewName');
Expand Down Expand Up @@ -155,7 +154,6 @@ public function process(crmtogo_API_Request $request) {
$viewer->assign('PAGELIMIT', $config['NavigationLimit']);
$viewer->assign('_MODULE', $this->cachedModule($wsResponseResult['module']));
$viewer->assign('_MODE', $request->get('mode'));
$viewer->assign('_CATEGORY', $CATEGORY);
$viewer->assign('_CUSTOMVIEW_OPTION', $customview_html);
$viewer->assign('_SEARCH', $request->get('search'));
$viewer->assign('LANGUAGE', $current_language);
Expand Down
2 changes: 1 addition & 1 deletion modules/Users/ChangePassword.js
Expand Up @@ -126,7 +126,7 @@ function changepassword(is_admin, userid) {
document.getElementById('show-err_msg').style.display = 'block';
document.getElementById('err_msg').innerHTML = alert_arr['Old password is incorrect'];
} else {
window.location.href = `index.php?module=Users&action=DetailView&record=${userid}&modechk=prefview`;
window.location.href = `index.php?module=Users&action=DetailView&record=${userid}`;
}
});
}
Expand Down
11 changes: 0 additions & 11 deletions modules/Users/DetailView.php
Expand Up @@ -55,17 +55,6 @@
$smarty->assign('IMAGE_PATH', $image_path);
$smarty->assign('ID', $focus->id);

if (!empty($_REQUEST['modechk'])) {
if ($_REQUEST['modechk'] == 'prefview') {
$parenttab = '';
} else {
$parenttab = 'Settings';
}
} else {
$parenttab = 'Settings';
}

$smarty->assign('PARENTTAB', $parenttab);
$smarty->assign('CHANGE_PW_BUTTON', '');
if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id)
&& isset($default_user_name)
Expand Down
12 changes: 1 addition & 11 deletions modules/Users/EditView.php
Expand Up @@ -124,16 +124,6 @@ function showLicense() {
));
$smarty->assign('DUPLICATE', (isset($_REQUEST['isDuplicate']) ? vtlib_purify($_REQUEST['isDuplicate']) : ''));
$smarty->assign('USER_MODE', $mode);
if (!empty($_REQUEST['modechk'])) {
if ($_REQUEST['modechk'] == 'prefview') {
$parenttab = '';
} else {
$parenttab = 'Settings';
}
} else {
$parenttab = 'Settings';
}
$smarty->assign('PARENTTAB', $parenttab);
coreBOS_Session::set('Users_FORM_TOKEN', rand(5, 2000) * rand(2, 7));
$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']);
$smarty->assign('Application_Textarea_Style', GlobalVariable::getVariable('Application_Textarea_Style', 'height:140px;', $currentModule, $current_user->id));
Expand All @@ -156,6 +146,6 @@ function showLicense() {
}
}
$smarty->assign('LDAP_BUTTON', $LdapBtnText);

$smarty->assign('IS_ADMIN', is_admin($current_user));
$smarty->display('UserEditView.tpl');
?>

0 comments on commit e9f1f4c

Please sign in to comment.