X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FDelegation.php;h=0003ae08be74125bf4ff4f36e8f5e5147c14d624;hb=50e43c530e019bce5defda2a4503a9a817d8772f;hp=bc3c72e8d008c8b9d248fe9ed4868219930a5dcb;hpb=621b4216d94badbe7a4797c42e704ce63e8df3c4;p=friendica.git diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index bc3c72e8d0..0003ae08be 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -1,6 +1,6 @@ getLocalUserId()) { return; } - $uid = local_user(); + $uid = DI::userSession()->getLocalUserId(); $orig_record = User::getById(DI::app()->getLoggedInUserId()); - if (Session::get('submanage')) { - $user = User::getById(Session::get('submanage')); + if (DI::userSession()->getSubManagedUserId()) { + $user = User::getById(DI::userSession()->getSubManagedUserId()); if (DBA::isResult($user)) { $uid = intval($user['uid']); $orig_record = $user; @@ -97,28 +96,29 @@ class Delegation extends BaseModule return; } - Session::clear(); + DI::session()->clear(); DI::auth()->setForUser(DI::app(), $user, true, true); if ($limited_id) { - Session::set('submanage', $original_id); + DI::userSession()->setSubManagedUserId($original_id); } $ret = []; Hook::callAll('home_init', $ret); - DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname()); - // NOTREACHED + DI::sysmsg()->addNotice($this->t('You are now logged in as %s', $user['username'])); + + DI::baseUrl()->redirect('network'); } protected function content(array $request = []): string { - if (!local_user()) { + if (!DI::userSession()->getLocalUserId()) { throw new ForbiddenException(DI::l10n()->t('Permission denied.')); } - $identities = User::identities(DI::session()->get('submanage', local_user())); + $identities = User::identities(DI::userSession()->getSubManagedUserId() ?: DI::userSession()->getLocalUserId()); //getting additinal information for each identity foreach ($identities as $key => $identity) {