Skip to content

Add EAS version configuration per user via perms system#74

Merged
TDannhauer merged 1 commit intoFRAMEWORK_6_0from
fix/refactor_auth_handling
Mar 31, 2026
Merged

Add EAS version configuration per user via perms system#74
TDannhauer merged 1 commit intoFRAMEWORK_6_0from
fix/refactor_auth_handling

Conversation

@TDannhauer
Copy link
Copy Markdown
Contributor

Add EAS version configuration per user via perms system

Refactor authentication method to ensure username is set correctly. Added logging for fallback username when registry auth is empty.
@TDannhauer TDannhauer requested a review from ralflang March 31, 2026 09:12
Copy link
Copy Markdown
Member

@ralflang ralflang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally good. The globals topics are all not blocking but can be refactored later. On the delegation to parent constructor you need to decide, I am not the expert on ActiveSync.

}
}

return parent::authenticate($username, $password, $domain);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets your user's username and password as parameters in the base driver. The third parameter domain is never used.

Where does your new code populate this?

I think it is risky not to do it.

    public function authenticate($username, $password, $domain = null)
    {
        $this->_authUser = $username;
        $this->_authPass = $password;

        return true;
    }

$authUsername = (string)$get['User'];
}
}
if ($authUsername === null && !empty($GLOBALS['registry']->getAuth())) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed in combination with #75 - The registry is now injected as a dependency and you can use it without accessing the global.

}
}
if ($authUsername === null && !empty($GLOBALS['registry']->getAuth())) {
$authUsername = (string)$GLOBALS['registry']->getAuth();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flattens a null or false ("Not authenticated") to an empty string. (which might be what you want)

if ($authUsername === null && !empty($GLOBALS['registry']->getAuth())) {
$authUsername = (string)$GLOBALS['registry']->getAuth();
}
if ($authUsername === null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you never get here.

return;
}

$mode = !empty($GLOBALS['conf']['activesync']['version_mode'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a LegacyMergedConfig object in the constructor

if ($mode === 'device') {
$allowed = $this->_getDeviceScopedVersionPermission($server, $username);
} else {
$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be constructor injected

@TDannhauer TDannhauer merged commit 87d48bf into FRAMEWORK_6_0 Mar 31, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants