Skip to content

Commit

Permalink
Add check for current user on preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
jack7anderson7 committed Jul 23, 2024
1 parent 07e9b98 commit 2e8c534
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/UserPreferences/UserPreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ public function getPreference(
$name,
$category = 'global'
) {
global $sugar_config;
global $sugar_config, $current_user;

$user = $this->_userFocus;

if ($user->user_name !== $current_user->user_name){
$this->loadPreferences($category);
return $_SESSION[$user->user_name.'_PREFERENCES'][$category][$name];
}

// if the unique key in session doesn't match the app or prefereces are empty
if (!isset($_SESSION[$user->user_name.'_PREFERENCES'][$category]) || (!empty($_SESSION['unique_key']) && $_SESSION['unique_key'] != $sugar_config['unique_key'])) {
$this->loadPreferences($category);
Expand Down

0 comments on commit 2e8c534

Please sign in to comment.