mirror of
https://github.com/friendica/friendica
synced 2025-04-22 00:30:10 +00:00
Move "submanage" Session value into own methods
This commit is contained in:
parent
cafb23f8f0
commit
44a9683008
8 changed files with 37 additions and 11 deletions
|
@ -63,7 +63,7 @@ abstract class BaseAdmin extends BaseModule
|
|||
throw new HTTPException\ForbiddenException(DI::l10n()->t('You don\'t have access to administration pages.'));
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
if (DI::userSession()->getSubManagedUserId()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Submanaged account can\'t access the administration pages. Please log back in as the main account.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ class Delegation extends BaseModule
|
|||
$uid = DI::userSession()->getLocalUserId();
|
||||
$orig_record = User::getById(DI::app()->getLoggedInUserId());
|
||||
|
||||
if (DI::session()->get('submanage')) {
|
||||
$user = User::getById(DI::session()->get('submanage'));
|
||||
if (DI::userSession()->getSubManagedUserId()) {
|
||||
$user = User::getById(DI::userSession()->getSubManagedUserId());
|
||||
if (DBA::isResult($user)) {
|
||||
$uid = intval($user['uid']);
|
||||
$orig_record = $user;
|
||||
|
@ -101,7 +101,7 @@ class Delegation extends BaseModule
|
|||
DI::auth()->setForUser(DI::app(), $user, true, true);
|
||||
|
||||
if ($limited_id) {
|
||||
DI::session()->set('submanage', $original_id);
|
||||
DI::userSession()->setSubManagedUserId($original_id);
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
|
@ -118,7 +118,7 @@ class Delegation extends BaseModule
|
|||
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||
}
|
||||
|
||||
$identities = User::identities(DI::session()->get('submanage', DI::userSession()->getLocalUserId()));
|
||||
$identities = User::identities(DI::userSession()->getSubManagedUserId() ?: DI::userSession()->getLocalUserId());
|
||||
|
||||
//getting additinal information for each identity
|
||||
foreach ($identities as $key => $identity) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class Delegation extends BaseSettings
|
|||
$user_id = $args->get(3);
|
||||
|
||||
if ($action === 'add' && $user_id) {
|
||||
if (DI::session()->get('submanage')) {
|
||||
if (DI::userSession()->getSubManagedUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class Delegation extends BaseSettings
|
|||
}
|
||||
|
||||
if ($action === 'remove' && $user_id) {
|
||||
if (DI::session()->get('submanage')) {
|
||||
if (DI::userSession()->getSubManagedUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue