Skip to content

Cleanup OC_User and OS_JSON#58751

Open
CarlSchwan wants to merge 2 commits intomasterfrom
carl/oc_user
Open

Cleanup OC_User and OS_JSON#58751
CarlSchwan wants to merge 2 commits intomasterfrom
carl/oc_user

Conversation

@CarlSchwan
Copy link
Member

  • Resolves: #

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

And deprecated OC_User::setPassword

Signed-off-by: Carl Schwan <carlschwan@kde.org>
And replace most usages in Server with the newer APIs

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan marked this pull request as ready for review March 10, 2026 17:31
@CarlSchwan CarlSchwan requested a review from a team as a code owner March 10, 2026 17:31
@CarlSchwan CarlSchwan requested review from ArtificialOwl, artonge, salmart-dev and sorbaugh and removed request for a team March 10, 2026 17:31
protected static function setUserId(?string $uid): void {
$userSession = Server::get(IUserSession::class);
$userManager = Server::get(IUserManager::class);
if ($user = $userManager->get($uid)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ($user = $userManager->get($uid)) {
$user = $userManager->get($uid);
if ($user !== null) {

// simply skip updating the token when is it missing
}
}
if ($user = $userManager->get($uid)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ($user = $userManager->get($uid)) {
$user = $userManager->get($uid);
if ($user !== null) {

$password = $backend->getCurrentUserSecret();
}
$user = $userSession->getUser();
if ($user && $user->getUID() === $uid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ($user && $user->getUID() === $uid) {
if ($user !== null && $user->getUID() === $uid) {

* @suppress PhanDeprecatedFunction
* @deprecated 34.0.0 This is internal, not to be used by apps
*/
public static function useBackend($backend = 'database') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unsure whether we can already remove useBackend and clearBackends. Does it respect our deprecation policy?

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.

3 participants