mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-04 07:34:09 +01:00
* [DEV] Minor improvements
This commit is contained in:
@@ -152,7 +152,7 @@ class AccountController extends ControllerBase implements ActionsInterface
|
||||
if (!Acl::checkUserAccess($this->getAction())) {
|
||||
$this->showError(self::ERR_PAGE_NO_PERMISSION);
|
||||
return false;
|
||||
} elseif (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) {
|
||||
} elseif (!UserPass::checkUserUpdateMPass($this->UserData->getUserId())) {
|
||||
$this->showError(self::ERR_UPDATE_MPASS);
|
||||
return false;
|
||||
} elseif ($this->id > 0) {
|
||||
@@ -207,7 +207,7 @@ class AccountController extends ControllerBase implements ActionsInterface
|
||||
$this->view->assign('otherGroups', Group::getItem()->getItemsForSelect());
|
||||
$this->view->assign('otherGroupsJson', Json::getJson($this->view->otherGroups));
|
||||
$this->view->assign('tagsJson', Json::getJson(Tag::getItem()->getItemsForSelect()));
|
||||
$this->view->assign('allowPrivate', Session::getUserProfile()->isAccPrivate());
|
||||
$this->view->assign('allowPrivate', $this->UserProfileData->isAccPrivate());
|
||||
|
||||
$this->view->assign('disabled', $this->view->isView ? 'disabled' : '');
|
||||
$this->view->assign('readonly', $this->view->isView ? 'readonly' : '');
|
||||
@@ -216,7 +216,7 @@ class AccountController extends ControllerBase implements ActionsInterface
|
||||
$AccountAcl->setModified($this->isGotData() ? $this->view->isModified : false);
|
||||
$AccountAcl->getAcl($this->getAccount(), $this->getAction());
|
||||
$this->view->assign('AccountAcl', $AccountAcl);
|
||||
$this->view->assign('showViewPass', Session::getUserProfile()->isAccViewPass());
|
||||
$this->view->assign('showViewPass', $this->UserProfileData->isAccViewPass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,8 +100,8 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
|
||||
*/
|
||||
private function setVars()
|
||||
{
|
||||
$this->view->assign('isAdmin', Session::getUserData()->isUserIsAdminApp() || Session::getUserData()->isUserIsAdminAcc());
|
||||
$this->view->assign('showGlobalSearch', Config::getConfig()->isGlobalSearch());
|
||||
$this->view->assign('isAdmin', $this->UserData->isUserIsAdminApp() || $this->UserData->isUserIsAdminAcc());
|
||||
$this->view->assign('showGlobalSearch', Config::getConfig()->isGlobalSearch() && $this->UserProfileData->isAccGlobalSearch());
|
||||
|
||||
// Obtener el filtro de búsqueda desde la sesión
|
||||
$filters = Session::getSearchFilters();
|
||||
|
||||
@@ -78,14 +78,14 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
|
||||
$this->view->assign('tabs', []);
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
$this->view->assign('isDemoMode', Checks::demoIsEnabled() && !Session::getUserData()->isUserIsAdminApp());
|
||||
$this->view->assign('isDisabled', (Checks::demoIsEnabled() && !Session::getUserData()->isUserIsAdminApp()) ? 'DISABLED' : '');
|
||||
$this->view->assign('isDemoMode', Checks::demoIsEnabled() && !$this->UserData->isUserIsAdminApp());
|
||||
$this->view->assign('isDisabled', (Checks::demoIsEnabled() && !$this->UserData->isUserIsAdminApp()) ? 'disabled' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener la pestaña de configuración
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getGeneralTab()
|
||||
{
|
||||
@@ -161,7 +161,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de encriptación
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getEncryptionTab()
|
||||
{
|
||||
@@ -185,7 +185,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de copia de seguridad
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getBackupTab()
|
||||
{
|
||||
@@ -230,7 +230,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de Importación
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getImportTab()
|
||||
{
|
||||
@@ -252,7 +252,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de información
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getInfoTab()
|
||||
{
|
||||
@@ -275,7 +275,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de Wiki
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getWikiTab()
|
||||
{
|
||||
@@ -307,7 +307,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de LDAP
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getLdapTab()
|
||||
{
|
||||
@@ -340,7 +340,7 @@ class ConfigController extends ControllerBase implements ActionsInterface
|
||||
/**
|
||||
* Obtener la pestaña de Correo
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function getMailTab()
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ use SP\Core\Exceptions\SPException;
|
||||
use SP\Core\DiFactory;
|
||||
use SP\Core\Template;
|
||||
use SP\Core\UI\ThemeIconsBase;
|
||||
use SP\DataModel\ProfileData;
|
||||
use SP\DataModel\UserData;
|
||||
use SP\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
@@ -79,6 +81,14 @@ abstract class ControllerBase
|
||||
* @var JsonResponse
|
||||
*/
|
||||
protected $Json;
|
||||
/**
|
||||
* @var UserData
|
||||
*/
|
||||
protected $UserData;
|
||||
/**
|
||||
* @var ProfileData
|
||||
*/
|
||||
protected $UserProfileData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -243,8 +253,11 @@ abstract class ControllerBase
|
||||
{
|
||||
global $timeStart;
|
||||
|
||||
$this->UserData = Session::getUserData();
|
||||
$this->UserProfileData = Session::getUserProfile();
|
||||
|
||||
$this->view->assign('timeStart', $timeStart);
|
||||
$this->view->assign('icons', $this->icons);
|
||||
$this->view->assign('SessionUserData', Session::getUserData());
|
||||
$this->view->assign('SessionUserData', $this->UserData);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class EventlogController extends ControllerBase implements ActionsInterface
|
||||
$GridActionSearch->setOnSubmitFunction('eventlog/search');
|
||||
|
||||
$this->view->assign('rowClass', 'row_even');
|
||||
$this->view->assign('isDemoMode', Checks::demoIsEnabled() || !Session::getUserData()->isUserIsAdminApp());
|
||||
$this->view->assign('isDemoMode', Checks::demoIsEnabled() || !$this->UserData->isUserIsAdminApp());
|
||||
$this->view->assign('limitStart', isset($this->view->limitStart) ? (int)$this->view->limitStart : 0);
|
||||
$this->view->assign('events', Log::getEvents($this->view->limitStart, self::MAX_ROWS));
|
||||
|
||||
|
||||
@@ -171,12 +171,12 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
{
|
||||
$this->view->addTemplate('sessionbar');
|
||||
|
||||
$this->view->assign('adminApp', Session::getUserData()->isUserIsAdminApp() ? '<span title="' . _('Admin Aplicación') . '">(A+)</span>' : '');
|
||||
$this->view->assign('userId', Session::getUserData()->getUserId());
|
||||
$this->view->assign('userLogin', strtoupper(Session::getUserData()->getUserLogin()));
|
||||
$this->view->assign('userName', Session::getUserData()->getUserName() ?: strtoupper($this->view->userLogin));
|
||||
$this->view->assign('userGroup', Session::getUserData()->getUsergroupName());
|
||||
$this->view->assign('showPassIcon', !Session::getUserData()->isUserIsLdap());
|
||||
$this->view->assign('adminApp', $this->UserData->isUserIsAdminApp() ? '<span title="' . _('Admin Aplicación') . '">(A+)</span>' : '');
|
||||
$this->view->assign('userId', $this->UserData->getUserId());
|
||||
$this->view->assign('userLogin', strtoupper($this->UserData->getUserLogin()));
|
||||
$this->view->assign('userName', $this->UserData->getUserName() ?: strtoupper($this->view->userLogin));
|
||||
$this->view->assign('userGroup', $this->UserData->getUsergroupName());
|
||||
$this->view->assign('showPassIcon', !$this->UserData->isUserIsLdap());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,7 +70,7 @@ class UserPreferencesController extends ControllerBase implements ActionsInterfa
|
||||
|
||||
$this->view->assign('tabs', array());
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
$this->userId = Session::getUserData()->getUserId();
|
||||
$this->userId = $this->UserData->getUserId();
|
||||
$this->userPrefs = UserPreferences::getItem()->getById($this->userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,20 +140,27 @@ class Acl implements ActionsInterface
|
||||
case self::ACTION_CFG_IMPORT:
|
||||
return $curUserProfile->isConfigImport();
|
||||
case self::ACTION_MGM_CATEGORIES:
|
||||
case self::ACTION_MGM_CATEGORIES_SEARCH:
|
||||
return $curUserProfile->isMgmCategories();
|
||||
case self::ACTION_MGM_CUSTOMERS:
|
||||
case self::ACTION_MGM_CUSTOMERS_SEARCH:
|
||||
return $curUserProfile->isMgmCustomers();
|
||||
case self::ACTION_MGM_CUSTOMFIELDS:
|
||||
case self::ACTION_MGM_CUSTOMFIELDS_SEARCH:
|
||||
return $curUserProfile->isMgmCustomFields();
|
||||
case self::ACTION_MGM_PUBLICLINKS:
|
||||
case self::ACTION_MGM_PUBLICLINKS_SEARCH:
|
||||
return $curUserProfile->isMgmPublicLinks();
|
||||
case self::ACTION_MGM_PUBLICLINKS_NEW:
|
||||
return ($curUserProfile->isMgmPublicLinks() || $curUserProfile->isAccPublicLinks());
|
||||
case self::ACTION_MGM_ACCOUNTS:
|
||||
case self::ACTION_MGM_ACCOUNTS_SEARCH:
|
||||
return $curUserProfile->isMgmAccounts();
|
||||
case self::ACTION_MGM_FILES:
|
||||
case self::ACTION_MGM_FILES_SEARCH:
|
||||
return $curUserProfile->isMgmFiles();
|
||||
case self::ACTION_MGM_TAGS:
|
||||
case self::ACTION_MGM_TAGS_SEARCH:
|
||||
return $curUserProfile->isMgmTags();
|
||||
case self::ACTION_CFG_ENCRYPTION:
|
||||
return $curUserProfile->isConfigEncryption();
|
||||
@@ -162,14 +169,18 @@ class Acl implements ActionsInterface
|
||||
case self::ACTION_USR:
|
||||
return ($curUserProfile->isMgmUsers() || $curUserProfile->isMgmGroups() || $curUserProfile->isMgmProfiles());
|
||||
case self::ACTION_USR_USERS:
|
||||
case self::ACTION_USR_USERS_SEARCH:
|
||||
return $curUserProfile->isMgmUsers();
|
||||
case self::ACTION_USR_USERS_EDITPASS:
|
||||
return ($userId === $curUserId || $curUserProfile->isMgmUsers());
|
||||
case self::ACTION_USR_GROUPS:
|
||||
case self::ACTION_USR_GROUPS_SEARCH:
|
||||
return $curUserProfile->isMgmGroups();
|
||||
case self::ACTION_USR_PROFILES:
|
||||
case self::ACTION_USR_PROFILES_SEARCH:
|
||||
return $curUserProfile->isMgmProfiles();
|
||||
case self::ACTION_MGM_APITOKENS:
|
||||
case self::ACTION_MGM_APITOKENS_SEARCH:
|
||||
return $curUserProfile->isMgmApiTokens();
|
||||
case self::ACTION_EVL:
|
||||
return $curUserProfile->isEvl();
|
||||
|
||||
@@ -78,6 +78,10 @@ class ProfileData extends ProfileBaseData
|
||||
* @var bool
|
||||
*/
|
||||
protected $accPublicLinks = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $accGlobalSearch = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -594,4 +598,20 @@ class ProfileData extends ProfileBaseData
|
||||
{
|
||||
$this->mgmFiles = $mgmFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAccGlobalSearch()
|
||||
{
|
||||
return $this->accGlobalSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $accGlobalSearch
|
||||
*/
|
||||
public function setAccGlobalSearch($accGlobalSearch)
|
||||
{
|
||||
$this->accGlobalSearch = $accGlobalSearch;
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ class ProfileForm extends FormBase implements FormInterface
|
||||
$this->ProfileData->setAccPublicLinks(Request::analyze('profile_accpublinks', 0, false, 1));
|
||||
$this->ProfileData->setAccPrivate(Request::analyze('profile_accprivate', 0, false, 1));
|
||||
$this->ProfileData->setAccPermission(Request::analyze('profile_accpermissions', 0, false, 1));
|
||||
$this->ProfileData->setAccGlobalSearch(Request::analyze('profile_accglobalsearch', 0, false, 1));
|
||||
$this->ProfileData->setConfigGeneral(Request::analyze('profile_config', 0, false, 1));
|
||||
$this->ProfileData->setConfigEncryption(Request::analyze('profile_configmpw', 0, false, 1));
|
||||
$this->ProfileData->setConfigBackup(Request::analyze('profile_configback', 0, false, 1));
|
||||
|
||||
@@ -106,6 +106,13 @@
|
||||
<span class="mdl-switch__label"
|
||||
title="<?php echo _('Asignar permisos'); ?>"><?php echo _('Permisos'); ?></span>
|
||||
</label>
|
||||
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="profile_accglobalsearch">
|
||||
<input type="checkbox" id="profile_accglobalsearch"
|
||||
class="mdl-switch__input mdl-color-text--indigo-400"
|
||||
name="profile_accglobalsearch" <?php echo $profile->isAccGlobalSearch() ? 'CHECKED' : ''; ?> <?php echo $isDisabled; ?>/>
|
||||
<span class="mdl-switch__label"
|
||||
title="<?php echo _('Búsqueda global'); ?>"><?php echo _('Búsqueda global'); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user