diff --git a/app/config/actions.xml b/app/config/actions.xml index 68953b07..831b11dd 100644 --- a/app/config/actions.xml +++ b/app/config/actions.xml @@ -659,13 +659,13 @@ 1000 CONFIG Configuración - config/index + configManager/index 1001 CONFIG_GENERAL Configuración General - config/general + configManager/general 1010 diff --git a/app/modules/web/Controllers/AccessManagerController.php b/app/modules/web/Controllers/AccessManagerController.php index 963605fc..94af8cf8 100644 --- a/app/modules/web/Controllers/AccessManagerController.php +++ b/app/modules/web/Controllers/AccessManagerController.php @@ -31,11 +31,11 @@ use SP\DataModel\ItemSearchData; use SP\Http\Request; use SP\Modules\Web\Controllers\Helpers\ItemsGridHelper; use SP\Modules\Web\Controllers\Helpers\TabsGridHelper; -use SP\Repositories\AuthToken\AuthTokenRepository; -use SP\Repositories\PublicLink\PublicLinkRepository; -use SP\Repositories\User\UserRepository; -use SP\Repositories\UserGroup\UserGroupRepository; -use SP\Repositories\UserProfile\UserProfileRepository; +use SP\Services\AuthToken\AuthTokenService; +use SP\Services\PublicLink\PublicLinkService; +use SP\Services\User\UserService; +use SP\Services\UserGroup\UserGroupService; +use SP\Services\UserProfile\UserProfileService; /** * Class AccessMgmtController @@ -110,50 +110,60 @@ class AccessManagerController extends ControllerBase /** * Returns users' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getUsersList() { - $service = new UserRepository(); + $service = new UserService(); return $this->itemsGridHelper->getUsersGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns users group data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getUsersGroupList() { - $service = new UserGroupRepository(); + $service = new UserGroupService(); return $this->itemsGridHelper->getUserGroupsGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns users profile data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getUsersProfileList() { - $service = new UserProfileRepository(); + $service = new UserProfileService(); return $this->itemsGridHelper->getUserProfilesGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns API tokens data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getApiTokensList() { - $service = new AuthTokenRepository(); + $service = new AuthTokenService(); return $this->itemsGridHelper->getApiTokensGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns public links data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getPublicLinksList() { - $service = new PublicLinkRepository(); + $service = new PublicLinkService(); return $this->itemsGridHelper->getPublicLinksGrid($service->search($this->itemSearchData))->updatePager(); } diff --git a/app/modules/web/Controllers/AccountController.php b/app/modules/web/Controllers/AccountController.php index 7fd978aa..a7d4b776 100644 --- a/app/modules/web/Controllers/AccountController.php +++ b/app/modules/web/Controllers/AccountController.php @@ -34,7 +34,6 @@ use SP\Core\SessionUtil; use SP\DataModel\AccountExtData; use SP\Forms\AccountForm; use SP\Http\JsonResponse; -use SP\Http\Request; use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; use SP\Modules\Web\Controllers\Helpers\Account\AccountHistoryHelper; use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper; @@ -43,7 +42,6 @@ use SP\Modules\Web\Controllers\Helpers\LayoutHelper; use SP\Modules\Web\Controllers\Traits\ItemTrait; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\CrudControllerInterface; -use SP\Services\Account\AccountFileService; use SP\Services\Account\AccountHistoryService; use SP\Services\Account\AccountService; use SP\Services\PublicLink\PublicLinkService; diff --git a/app/modules/web/Controllers/ConfigManagerController.php b/app/modules/web/Controllers/ConfigManagerController.php new file mode 100644 index 00000000..9caca3a7 --- /dev/null +++ b/app/modules/web/Controllers/ConfigManagerController.php @@ -0,0 +1,231 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Controller\ControllerBase; +use SP\Core\Acl\Acl; +use SP\Core\Acl\ActionsInterface; +use SP\Core\Language; +use SP\Http\Request; +use SP\Modules\Web\Controllers\Helpers\TabsHelper; +use SP\Mvc\View\Components\DataTab; +use SP\Mvc\View\Components\SelectItemAdapter; +use SP\Services\User\UserService; +use SP\Services\UserGroup\UserGroupService; +use SP\Services\UserProfile\UserProfileService; +use SP\Util\Checks; + +/** + * Class ConfigManagerController + * + * @package SP\Modules\Web\Controllers + */ +class ConfigManagerController extends ControllerBase +{ + /** + * @var TabsHelper + */ + protected $tabsHelper; + + /** + * @throws \SP\Core\Exceptions\InvalidArgumentException + * @throws \SP\Core\Dic\ContainerException + */ + public function indexAction() + { + $this->getTabs(); + } + + /** + * Returns a tabbed grid with items + * + * @throws \SP\Core\Exceptions\InvalidArgumentException + * @throws \SP\Core\Dic\ContainerException + */ + protected function getTabs() + { + $this->tabsHelper = new TabsHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + + if ($this->checkAccess(ActionsInterface::CONFIG_GENERAL)) { + $this->tabsHelper->addTab($this->getConfigGeneral()); + } + + if ($this->checkAccess(ActionsInterface::ACCOUNT_CONFIG)) { + $this->tabsHelper->addTab($this->getAccountConfig()); + } + + if ($this->checkAccess(ActionsInterface::WIKI_CONFIG)) { + $this->tabsHelper->addTab($this->getWikiConfig()); + } + + if ($this->checkAccess(ActionsInterface::LDAP_CONFIG)) { + $this->tabsHelper->addTab($this->getLdapConfig()); + } + + if ($this->checkAccess(ActionsInterface::MAIL_CONFIG)) { + $this->tabsHelper->addTab($this->getMailConfig()); + } + + if ($this->checkAccess(ActionsInterface::ENCRYPTION_CONFIG)) { +// $this->tabsHelper->addTab($this->getEncryptionConfig()); + } + + if ($this->checkAccess(ActionsInterface::BACKUP_CONFIG)) { +// $this->tabsHelper->addTab($this->getBackupConfig()); + } + + if ($this->checkAccess(ActionsInterface::IMPORT_CONFIG)) { +// $this->tabsHelper->addTab($this->getImportConfig()); + } + + + $this->eventDispatcher->notifyEvent('show.config', $this); + + $this->tabsHelper->renderTabs(Acl::getActionRoute(ActionsInterface::CONFIG), Request::analyze('tabIndex', 0)); + + $this->view(); + } + + /** + * @return DataTab + */ + protected function getConfigGeneral() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('general'); + + $userData = $this->session->getUserData(); + + $template->assign('langsAvailable', Language::getAvailableLanguages()); + $template->assign('themesAvailable', $this->theme->getThemesAvailable()); + $template->assign('isDemoMode', $this->configData->isDemoEnabled() && !$userData->getIsAdminApp()); + $template->assign('isDisabled', $this->configData->isDemoEnabled() && !$userData->getIsAdminApp() ? 'disabled' : ''); + $template->assign('configData', $this->configData); + + $template->assign('users', SelectItemAdapter::factory(UserService::getItemsBasic())->getItemsFromModel()); + $template->assign('userGroups', SelectItemAdapter::factory(UserGroupService::getItemsBasic())->getItemsFromModel()); + $template->assign('userProfiles', SelectItemAdapter::factory(UserProfileService::getItemsBasic())->getItemsFromModel()); + + return new DataTab(__('General'), $template); + } + + /** + * @return TabsHelper + */ + public function getTabsHelper() + { + return $this->tabsHelper; + } + + /** + * @return DataTab + */ + protected function getAccountConfig() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('accounts'); + + $template->assign('configData', $this->configData); + + return new DataTab(__('Cuentas'), $template); + } + + /** + * @return DataTab + */ + protected function getWikiConfig() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('wiki'); + + $template->assign('configData', $this->configData); + + return new DataTab(__('Wiki'), $template); + } + + /** + * @return DataTab + */ + protected function getLdapConfig() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('ldap'); + + $template->assign('ldapIsAvailable', Checks::ldapIsAvailable()); + $template->assign('configData', $this->configData); + $template->assign('userGroups', SelectItemAdapter::factory(UserGroupService::getItemsBasic())->getItemsFromModel()); + $template->assign('userProfiles', SelectItemAdapter::factory(UserProfileService::getItemsBasic())->getItemsFromModel()); + + return new DataTab(__('LDAP'), $template); + } + + /** + * @return DataTab + */ + protected function getMailConfig() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('mail'); + + $template->assign('mailSecurity', ['SSL', 'TLS']); + $template->assign('configData', $this->configData); + $template->assign('userGroups', SelectItemAdapter::factory(UserGroupService::getItemsBasic())->getItemsFromModel()); + $template->assign('userProfiles', SelectItemAdapter::factory(UserProfileService::getItemsBasic())->getItemsFromModel()); + + return new DataTab(__('Correo'), $template); + } + + /** + * @return DataTab + */ + protected function getEncryptionConfig() + { + $template = clone $this->view; + $template->setBase('config'); + $template->addTemplate('mail'); + + $template->assign('mailSecurity', ['SSL', 'TLS']); + $template->assign('configData', $this->configData); + + $this->view->assign('numAccounts', AccountUtil::getTotalNumAccounts()); + $this->view->assign('taskId', Task::genTaskId('masterpass')); + + $this->view->assign('lastUpdateMPass', isset($this->configDB['lastupdatempass']) ? $this->configDB['lastupdatempass'] : 0); + $this->view->assign('tempMasterPassTime', isset($this->configDB['tempmaster_passtime']) ? $this->configDB['tempmaster_passtime'] : 0); + $this->view->assign('tempMasterMaxTime', isset($this->configDB['tempmaster_maxtime']) ? $this->configDB['tempmaster_maxtime'] : 0); + $this->view->assign('tempMasterAttempts', isset($this->configDB['tempmaster_attempts']) ? sprintf('%d/%d', $this->configDB['tempmaster_attempts'], CryptMasterPass::MAX_ATTEMPTS) : 0); + $this->view->assign('tempMasterPass', SessionFactory::getTemporaryMasterPass()); + + $template->assign('userGroups', SelectItemAdapter::factory(UserGroupService::getItemsBasic())->getItemsFromModel()); + $template->assign('userProfiles', SelectItemAdapter::factory(UserProfileService::getItemsBasic())->getItemsFromModel()); + + return new DataTab(__('Encriptación'), $template); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php index a08c25ff..37abe44e 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php @@ -51,6 +51,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getViewAction() { @@ -76,6 +77,7 @@ class AccountActionsHelper extends HelperBase * @param AccountAcl $accountAcl * @param AccountActionsDto $accountActionsDto * @return DataGridAction[] + * @throws \ReflectionException */ public function getActionsForAccount(AccountAcl $accountAcl, AccountActionsDto $accountActionsDto) { @@ -183,6 +185,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getDeleteAction() { @@ -243,6 +246,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getViewPassAction() { @@ -265,6 +269,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getCopyPassAction() { @@ -290,6 +295,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getCopyAction() { @@ -311,6 +317,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getEditPassAction() { @@ -332,6 +339,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getEditAction() { @@ -353,6 +361,7 @@ class AccountActionsHelper extends HelperBase /** * @return DataGridAction + * @throws \ReflectionException */ public function getRequestAction() { diff --git a/app/modules/web/Controllers/Helpers/Account/AccountHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountHelper.php index 7c725290..1d56162e 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountHelper.php @@ -25,6 +25,7 @@ namespace SP\Modules\Web\Controllers\Helpers\Account; use SP\Account\AccountAcl; +use SP\Core\Acl\AccountPermissionException; use SP\Core\Acl\Acl; use SP\Core\Acl\ActionsInterface; use SP\Core\Acl\UnauthorizedPageException; @@ -44,7 +45,6 @@ use SP\Services\Tag\TagService; use SP\Services\User\UpdatedMasterPassException; use SP\Services\User\UserService; use SP\Services\UserGroup\UserGroupService; -use SP\Util\ErrorUtil; /** * Class AccountHelper @@ -111,10 +111,12 @@ class AccountHelper extends HelperBase * * @param AccountDetailsResponse $accountDetailsResponse * @param int $actionId - * @throws SPException * @throws UnauthorizedPageException * @throws UpdatedMasterPassException * @throws \SP\Core\Dic\ContainerException + * @throws AccountPermissionException + * @throws SPException + * @throws \ReflectionException */ public function setViewForAccount(AccountDetailsResponse $accountDetailsResponse, $actionId) { @@ -123,7 +125,7 @@ class AccountHelper extends HelperBase $this->accountAcl = new AccountAcl($actionId); $this->checkActionAccess(); - $this->checkAccess($accountDetailsResponse); + $accountAcl = $this->checkAccess($accountDetailsResponse); $accountData = $accountDetailsResponse->getAccountVData(); $selectUsers = SelectItemAdapter::factory(UserService::getItemsBasic()); @@ -141,7 +143,7 @@ class AccountHelper extends HelperBase $this->view->assign('maxFileSize', round($this->configData->getFilesAllowedSize() / 1024, 1)); $this->view->assign('filesAllowedExts', implode(',', $this->configData->getFilesAllowedExts())); - if ($this->configData->isPublinksEnabled() && $this->accountAcl->isShowLink()) { + if ($this->configData->isPublinksEnabled() && $accountAcl->isShowLink()) { $publicLinkData = $this->publicLinkService->getHashForItem($this->accountId); $publicLinkUrl = $publicLinkData ? PublicLinkService::getLinkForHash($publicLinkData->getHash()) : null; @@ -160,7 +162,7 @@ class AccountHelper extends HelperBase $this->view->assign('accountData', $accountData); $this->view->assign('gotData', true); - $this->view->assign('actions', $this->getActionsHelper()->getActionsForAccount($this->accountAcl->getStoredAcl(), new AccountActionsDto($this->accountId, null, $accountData->getParentId()))); + $this->view->assign('actions', $this->getActionsHelper()->getActionsForAccount($accountAcl, new AccountActionsDto($this->accountId, null, $accountData->getParentId()))); $this->setViewCommon(); } @@ -184,7 +186,8 @@ class AccountHelper extends HelperBase * Comprobar si el usuario dispone de acceso al módulo * * @param AccountDetailsResponse $accountDetailsResponse - * @return bool + * @return AccountAcl + * @throws AccountPermissionException */ protected function checkAccess(AccountDetailsResponse $accountDetailsResponse) { @@ -198,13 +201,13 @@ class AccountHelper extends HelperBase $acccountAclDto->setUsersId($accountDetailsResponse->getUsers()); $acccountAclDto->setUserGroupsId($accountDetailsResponse->getUserGroups()); - if (!$this->accountAcl->getAcl($acccountAclDto)->checkAccountAccess()) { - ErrorUtil::showErrorInView($this->view, ErrorUtil::ERR_ACCOUNT_NO_PERMISSION); + $accountAcl = $this->accountAcl->getAcl($acccountAclDto); - return false; + if ($accountAcl === null || !$accountAcl->checkAccountAccess()) { + throw new AccountPermissionException(SPException::SP_INFO); } - return true; + return $accountAcl; } /** diff --git a/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php index 20b57a89..4a6a6929 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php @@ -36,12 +36,8 @@ use SP\Html\DataGrid\DataGridHeaderSort; use SP\Html\DataGrid\DataGridPager; use SP\Html\DataGrid\DataGridSort; use SP\Http\Request; -use SP\Modules\Web\Controllers\Helpers\Account\AccountActionsHelper; use SP\Modules\Web\Controllers\Helpers\HelperBase; use SP\Mvc\View\Components\SelectItemAdapter; -use SP\Repositories\Category\CategoryRepository; -use SP\Repositories\Client\ClientRepository; -use SP\Repositories\Tag\TagRepository; use SP\Services\Account\AccountSearchService; use SP\Services\Category\CategoryService; use SP\Services\Client\ClientService; diff --git a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php index 2bf2b643..d4e9de63 100644 --- a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php +++ b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php @@ -950,6 +950,7 @@ class ItemsGridHelper extends HelperBase // Grid Header $GridHeaders = new DataGridHeader(); $GridHeaders->addHeader(__('Cuenta')); + $GridHeaders->addHeader(__('Cliente')); $GridHeaders->addHeader(__('Fecha Creación')); $GridHeaders->addHeader(__('Fecha Caducidad')); $GridHeaders->addHeader(__('Usuario')); @@ -960,6 +961,7 @@ class ItemsGridHelper extends HelperBase $GridData = new DataGridData(); $GridData->setDataRowSourceId('id'); $GridData->addDataRowSource('accountName'); + $GridData->addDataRowSource('clientName'); $GridData->addDataRowSource('getDateAddFormat', true); $GridData->addDataRowSource('getDateExpireFormat', true); $GridData->addDataRowSource('userLogin'); diff --git a/app/modules/web/Controllers/Helpers/TabsHelper.php b/app/modules/web/Controllers/Helpers/TabsHelper.php new file mode 100644 index 00000000..6297558c --- /dev/null +++ b/app/modules/web/Controllers/Helpers/TabsHelper.php @@ -0,0 +1,71 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Helpers; + +use SP\Mvc\View\Components\DataTab; + +/** + * Class TabsHelper + * + * @package SP\Modules\Web\Controllers\Helpers + */ +class TabsHelper extends HelperBase +{ + /** + * Máximo numero de acciones antes de agrupar + */ + const MAX_NUM_ACTIONS = 3; + /** + * @var DataTab[] + */ + protected $tabs = []; + + /** + * Inicializar las plantillas para las pestañas + * + * @param string $route + * @param int $activeTab + */ + public function renderTabs($route, $activeTab = 0) + { + $this->view->addTemplate('datatabs', 'common'); + + $this->view->assign('tabs', $this->tabs); + $this->view->assign('activeTab', $activeTab); + $this->view->assign('maxNumActions', self::MAX_NUM_ACTIONS); + $this->view->assign('tabsRoute', $route); + } + + /** + * Add a new data tab + * + * @param DataTab $tab + */ + public function addTab(DataTab $tab) + { + $this->tabs[] = $tab; + } + +} \ No newline at end of file diff --git a/app/modules/web/Controllers/ItemManagerController.php b/app/modules/web/Controllers/ItemManagerController.php index a46885a0..56ae3d85 100644 --- a/app/modules/web/Controllers/ItemManagerController.php +++ b/app/modules/web/Controllers/ItemManagerController.php @@ -31,14 +31,14 @@ use SP\DataModel\ItemSearchData; use SP\Http\Request; use SP\Modules\Web\Controllers\Helpers\ItemsGridHelper; use SP\Modules\Web\Controllers\Helpers\TabsGridHelper; -use SP\Repositories\Account\AccountFileRepository; -use SP\Repositories\Account\AccountHistoryRepository; -use SP\Repositories\Account\AccountRepository; -use SP\Repositories\Category\CategoryRepository; -use SP\Repositories\Client\ClientRepository; -use SP\Repositories\CustomField\CustomFieldDefRepository; use SP\Repositories\Plugin\PluginRepository; -use SP\Repositories\Tag\TagRepository; +use SP\Services\Account\AccountFileService; +use SP\Services\Account\AccountHistoryService; +use SP\Services\Account\AccountService; +use SP\Services\Category\CategoryService; +use SP\Services\Client\ClientService; +use SP\Services\CustomField\CustomFieldDefService; +use SP\Services\Tag\TagService; /** * Class ItemManagerController @@ -125,70 +125,84 @@ class ItemManagerController extends ControllerBase /** * Returns categories' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getCategoriesList() { - $service = new CategoryRepository(); + $service = new CategoryService(); return $this->itemsGridHelper->getCategoriesGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns tags' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getTagsList() { - $service = new TagRepository(); + $service = new TagService(); return $this->itemsGridHelper->getTagsGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns clients' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getClientsList() { - $service = new ClientRepository(); + $service = new ClientService(); return $this->itemsGridHelper->getClientsGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns custom fields' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getCustomFieldsList() { - $service = new CustomFieldDefRepository(); + $service = new CustomFieldDefService(); return $this->itemsGridHelper->getCustomFieldsGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns account files' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getAccountFilesList() { - $service = new AccountFileRepository(); + $service = new AccountFileService(); return $this->itemsGridHelper->getFilesGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns accounts' data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getAccountsList() { - $service = new AccountRepository(); + $service = new AccountService(); return $this->itemsGridHelper->getAccountsGrid($service->search($this->itemSearchData))->updatePager(); } /** * Returns accounts' history data tab + * + * @throws \SP\Core\Dic\ContainerException */ protected function getAccountsHistoryList() { - $service = new AccountHistoryRepository(); + $service = new AccountHistoryService(); return $this->itemsGridHelper->getAccountsHistoryGrid($service->search($this->itemSearchData))->updatePager(); } @@ -198,6 +212,7 @@ class ItemManagerController extends ControllerBase */ protected function getPluginsList() { + // FIXME: create Plugin Service $service = new PluginRepository(); return $this->itemsGridHelper->getPluginsGrid($service->search($this->itemSearchData))->updatePager(); diff --git a/app/modules/web/themes/material-blue/views/common/datatabs.inc b/app/modules/web/themes/material-blue/views/common/datatabs.inc new file mode 100644 index 00000000..b5f89876 --- /dev/null +++ b/app/modules/web/themes/material-blue/views/common/datatabs.inc @@ -0,0 +1,27 @@ + + +
+
+ + $tab): ?> +
+
+ render(); ?> +
+
+ + + +
+ \ No newline at end of file diff --git a/app/modules/web/themes/material-blue/views/config/accounts.inc b/app/modules/web/themes/material-blue/views/config/accounts.inc index 230c6cb4..f2788f26 100644 --- a/app/modules/web/themes/material-blue/views/config/accounts.inc +++ b/app/modules/web/themes/material-blue/views/config/accounts.inc @@ -1,334 +1,328 @@ -
-
-
+ -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
- - -
-
- -
-

- -

-
-
- -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
-
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

-
-
- -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-

- -

-
-
- -
- -
- -
- - - - - - - - - - - - - - - - - - -
- -
-

- -

- -

- -

- -

- -

-
-
- -
- - -
- - -
-
- - -
- - -
-
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
- -
- -
- - - - - - - - - - - - - - -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

- -

- -

-
-
-
- - -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

-
-
-
- - -
-
- - - - - -
- -
-
    -
  • - -
  • -
  • - -
  • -
-
+
+
-
\ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
+ + +
+
+ +
+

+ +

+
+
+ +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+
+
+ +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+

+ +

+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + +
+ +
+

+ +

+ +

+ +

+ +

+ +

+
+
+ +
+ + +
+ + +
+
+ + +
+ + +
+
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+ +

+ +

+
+
+
+ + +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+
+
+
+ + +
+
+ + + + + +
+
    +
  • + +
  • +
  • + +
  • +
+
diff --git a/app/modules/web/themes/material-blue/views/config/general-auth.inc b/app/modules/web/themes/material-blue/views/config/general-auth.inc index f72db714..3bb995c0 100644 --- a/app/modules/web/themes/material-blue/views/config/general-auth.inc +++ b/app/modules/web/themes/material-blue/views/config/general-auth.inc @@ -9,7 +9,7 @@ @@ -21,7 +21,7 @@ isAuthBasicAutoLoginEnabled() ? 'checked' : ''; ?>/> + isAuthBasicAutoLoginEnabled() ? 'checked' : ''; ?>/> @@ -41,7 +41,7 @@
+ maxlength="128" value="getAuthBasicDomain(); ?>">
@@ -64,9 +64,10 @@ @@ -88,9 +89,10 @@ diff --git a/app/modules/web/themes/material-blue/views/config/general-events.inc b/app/modules/web/themes/material-blue/views/config/general-events.inc index 04f90737..1447cbbc 100644 --- a/app/modules/web/themes/material-blue/views/config/general-events.inc +++ b/app/modules/web/themes/material-blue/views/config/general-events.inc @@ -17,7 +17,7 @@ @@ -28,7 +28,7 @@ @@ -39,7 +39,7 @@ @@ -52,7 +52,7 @@
+ value="getSyslogServer(); ?>"/>
@@ -66,7 +66,7 @@
+ value="getSyslogPort(); ?>"/>
diff --git a/app/modules/web/themes/material-blue/views/config/general-proxy.inc b/app/modules/web/themes/material-blue/views/config/general-proxy.inc index 900167e1..8e576a12 100644 --- a/app/modules/web/themes/material-blue/views/config/general-proxy.inc +++ b/app/modules/web/themes/material-blue/views/config/general-proxy.inc @@ -9,7 +9,7 @@ @@ -22,7 +22,7 @@
+ maxlength="128" value="getProxyServer(); ?>">
@@ -36,7 +36,7 @@
+ maxlength="128" value="getProxyPort(); ?>">
@@ -50,7 +50,7 @@
+ maxlength="128" value="getProxyUser(); ?>">
@@ -64,7 +64,7 @@
+ maxlength="128" value="getProxyPass(); ?>">
diff --git a/app/modules/web/themes/material-blue/views/config/general-site.inc b/app/modules/web/themes/material-blue/views/config/general-site.inc index f4643e70..5af75558 100644 --- a/app/modules/web/themes/material-blue/views/config/general-site.inc +++ b/app/modules/web/themes/material-blue/views/config/general-site.inc @@ -26,7 +26,7 @@ @@ -49,7 +49,7 @@ class="select-box sel-chosen-ns" > $themeName): ?> + value='' getSiteTheme() === $themeDir) ? "SELECTED" : ""; ?>> @@ -62,7 +62,7 @@
+ value="getSessionTimeout(); ?>" required/>
@@ -82,7 +82,7 @@ @@ -100,7 +100,7 @@ @@ -118,7 +118,7 @@ @@ -136,7 +136,7 @@ @@ -154,7 +154,7 @@ @@ -175,7 +175,7 @@ diff --git a/app/modules/web/themes/material-blue/views/config/general.inc b/app/modules/web/themes/material-blue/views/config/general.inc index d38d181e..0c017eb6 100644 --- a/app/modules/web/themes/material-blue/views/config/general.inc +++ b/app/modules/web/themes/material-blue/views/config/general.inc @@ -1,44 +1,37 @@ - -
-
-
+ - includeTemplate('general-site');; ?> - includeTemplate('general-events'); ?> - includeTemplate('general-proxy'); ?> - includeTemplate('general-auth'); ?> + includeTemplate('general-site'); ?> + includeTemplate('general-events'); ?> + includeTemplate('general-proxy'); ?> + includeTemplate('general-auth'); ?> - - - - -
+ + + -
-
    -
  • - -
  • -
  • - -
  • -
-
-
-
\ No newline at end of file +
+
    +
  • + +
  • +
  • + +
  • +
+
diff --git a/app/modules/web/themes/material-blue/views/config/ldap.inc b/app/modules/web/themes/material-blue/views/config/ldap.inc index 9fa1800d..ab7a8842 100644 --- a/app/modules/web/themes/material-blue/views/config/ldap.inc +++ b/app/modules/web/themes/material-blue/views/config/ldap.inc @@ -1,361 +1,356 @@ - -
-
-
- -
+
+ +
-
- - - - + + + + + + + + + + +
-
getIconHelp()->getIcon(); ?>
-
-

- -

+ + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - - - - - - -
+
getIconHelp()->getIcon(); ?>
+
+

+ +

-

- -

-
-
- -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

+

+ +

+
+
+ +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

-

- -

+

+ +

-
    -
  • ldap.example.org
  • -
  • ldap://ldap.example.org
  • -
  • ldaps://ldap.example.org
  • -
-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

+
    +
  • ldap.example.org
  • +
  • ldap://ldap.example.org
  • +
  • ldaps://ldap.example.org
  • +
+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

-

- -

+

+ +

-
    -
  • cn=syspass,ou=Users,dc=syspass,o=org
  • -
  • syspass
  • -
-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

+
    +
  • cn=syspass,ou=Users,dc=syspass,o=org
  • +
  • syspass
  • +
+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

-

- -

+

+ +

-
    -
  • cn=Users,dc=example,dc=org
  • -
  • ou=AdminUsers,dc=example,o=org
  • -
-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

+
    +
  • cn=Users,dc=example,dc=org
  • +
  • ou=AdminUsers,dc=example,o=org
  • +
+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

-

- -

+

+ +

-

- -

+

+ +

-
    -
  • cn=GRP_SPUSERS,cn=Users,dc=example,dc=org
  • -
  • GRP_SPUSERS
  • -
-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
+
    +
  • cn=GRP_SPUSERS,cn=Users,dc=example,dc=org
  • +
  • GRP_SPUSERS
  • +
+ +
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
- -
- -
+ +
+ +
- - - - - -
+ + + + -
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
-
\ No newline at end of file +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
diff --git a/app/modules/web/themes/material-blue/views/config/mail.inc b/app/modules/web/themes/material-blue/views/config/mail.inc index 0ca3911c..f20ddb55 100644 --- a/app/modules/web/themes/material-blue/views/config/mail.inc +++ b/app/modules/web/themes/material-blue/views/config/mail.inc @@ -1,164 +1,157 @@ - -
-
-
- -
+
+ +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + +
- -
- - -
- - -
-
- - -
- - -
-
- -
- - -
- - -
-
- - -
- - -
-
- - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - -
+ +
+ + +
+ + +
+
+ + +
+ + +
+
+ +
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
- -
- - -
- - -
-
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
+ +
+ + +
+ + +
+
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
- - - - -
+ + + -
-
    -
  • - -
  • -
  • - -
  • -
-
-
-
\ No newline at end of file +
+
    +
  • + +
  • +
  • + +
  • +
+
diff --git a/app/modules/web/themes/material-blue/views/config/wiki.inc b/app/modules/web/themes/material-blue/views/config/wiki.inc index a6945aaa..ae0bc368 100644 --- a/app/modules/web/themes/material-blue/views/config/wiki.inc +++ b/app/modules/web/themes/material-blue/views/config/wiki.inc @@ -1,299 +1,293 @@ - -
-
-
+ -
- -
- - - - - - - - - - - - - - - - - - -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

- -

- -

- -

- https://wiki.example.org/search.php?phrase= -

-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

- -

- -

- -

- https://wiki.example.org/show.php?name= -

-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

-
-
-
- - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
getIconHelp()->getIcon(); ?>
-
-

- -

-

- -

-
-
- -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

    -
  • http://wiki.syspass.org/lib/exe/xmlrpc.php
  • -
-

-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

    -
  • http://wiki.syspass.org/dokuwiki
  • -
-

-
-
-
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
- - -
-
- - -
- - -
-
- -
getIconHelp()->getIcon(); ?>
-
-

- -

-
-
-
- - -
-
- - - - - - -
- -
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
+
+
-
\ No newline at end of file + + + + + + + + + + + + + + + + + + +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+ +

+ +

+ +

+ https://wiki.example.org/search.php?phrase= +

+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+ +

+ +

+ +

+ https://wiki.example.org/show.php?name= +

+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

+
+
+
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
getIconHelp()->getIcon(); ?>
+
+

+ +

+

+ +

+
+
+ +
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

    +
  • http://wiki.syspass.org/lib/exe/xmlrpc.php
  • +
+

+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+ +

+ +

    +
  • http://wiki.syspass.org/dokuwiki
  • +
+

+
+
+
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
+ + +
+
+ + +
+ + +
+
+ +
getIconHelp()->getIcon(); ?>
+
+

+ +

+
+
+
+ + +
+
+ + + + + + +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
diff --git a/lib/SP/Account/AccountSearchItem.php b/lib/SP/Account/AccountSearchItem.php index 47df795e..fd95739d 100644 --- a/lib/SP/Account/AccountSearchItem.php +++ b/lib/SP/Account/AccountSearchItem.php @@ -109,6 +109,7 @@ class AccountSearchItem * * @param AccountSearchVData $accountSearchVData * @param AccountAcl $accountAcl + * @throws \SP\Core\Dic\ContainerException */ public function __construct(AccountSearchVData $accountSearchVData, AccountAcl $accountAcl) { diff --git a/lib/SP/Core/Acl/AccountPermissionException.php b/lib/SP/Core/Acl/AccountPermissionException.php new file mode 100644 index 00000000..a99cda06 --- /dev/null +++ b/lib/SP/Core/Acl/AccountPermissionException.php @@ -0,0 +1,47 @@ +. + */ + +namespace SP\Core\Acl; + +use SP\Core\Exceptions\SPException; + +/** + * Class AccountPermissionException + * + * @package SP\Core\Acl + */ +class AccountPermissionException extends SPException +{ + /** + * SPException constructor. + * + * @param string $type + * @param int $code + * @param \Exception|null $previous + */ + public function __construct($type, $code = 0, \Exception $previous = null) + { + parent::__construct($type, __u('No tiene permisos para acceder a esta cuenta'), __u('Consulte con el administrador'), $code, $previous); + } +} \ No newline at end of file diff --git a/lib/SP/Crypt/TemporaryMasterPass.php b/lib/SP/Crypt/TemporaryMasterPass.php index 389853a2..889bd1e9 100644 --- a/lib/SP/Crypt/TemporaryMasterPass.php +++ b/lib/SP/Crypt/TemporaryMasterPass.php @@ -63,6 +63,8 @@ class TemporaryMasterPass /** * MasterPass constructor. + * + * @throws \SP\Core\Dic\ContainerException */ public function __construct() { @@ -134,6 +136,7 @@ class TemporaryMasterPass * @param $key string con la clave utilizada para encriptar * @return string con la clave maestra desencriptada * @throws \Defuse\Crypto\Exception\CryptoException + * @throws \SP\Services\Config\ParameterNotFoundException */ public function getUsingKey($key) { diff --git a/lib/SP/Html/DataGrid/DataGridActionBase.php b/lib/SP/Html/DataGrid/DataGridActionBase.php index 3ba49cf1..66841805 100644 --- a/lib/SP/Html/DataGrid/DataGridActionBase.php +++ b/lib/SP/Html/DataGrid/DataGridActionBase.php @@ -144,6 +144,7 @@ abstract class DataGridActionBase implements DataGridActionInterface * @param string $class * @param string $method * @return $this + * @throws \ReflectionException */ public function setReflectionFilter($class, $method) { diff --git a/lib/SP/Html/DataGrid/DataGridBase.php b/lib/SP/Html/DataGrid/DataGridBase.php index ed09c67a..b0d25590 100644 --- a/lib/SP/Html/DataGrid/DataGridBase.php +++ b/lib/SP/Html/DataGrid/DataGridBase.php @@ -121,6 +121,8 @@ abstract class DataGridBase implements DataGridInterface /** * DataGridBase constructor. + * + * @throws \SP\Core\Dic\ContainerException */ public function __construct() { diff --git a/lib/SP/Html/DataGrid/DataGridTab.php b/lib/SP/Html/DataGrid/DataGridTab.php index 33e2a874..b2887b46 100644 --- a/lib/SP/Html/DataGrid/DataGridTab.php +++ b/lib/SP/Html/DataGrid/DataGridTab.php @@ -42,10 +42,13 @@ class DataGridTab extends DataGridBase /** * @param $title string + * @return DataGridTab */ public function setTitle($title) { $this->_title = $title; + + return $this; } /** diff --git a/lib/SP/Log/ActionLog.php b/lib/SP/Log/ActionLog.php index 259d10cf..8f265eba 100644 --- a/lib/SP/Log/ActionLog.php +++ b/lib/SP/Log/ActionLog.php @@ -26,9 +26,9 @@ namespace SP\Log; use SP\Config\Config; use SP\Config\ConfigData; -use SP\Core\Crypt\Session; use SP\Core\Language; use SP\Core\Messages\LogMessage; +use SP\Core\Session\Session; use SP\Core\Traits\InjectableTrait; /** @@ -77,6 +77,7 @@ abstract class ActionLog extends LogLevel * * @param LogMessage $LogMessage * @param string $level El nivel del mensaje + * @throws \SP\Core\Dic\ContainerException */ public function __construct(LogMessage $LogMessage = null, $level = Log::INFO) { @@ -89,6 +90,7 @@ abstract class ActionLog extends LogLevel /** * @param Config $config * @param Language $language + * @param Session $session */ public function inject(Config $config, Language $language, Session $session) { diff --git a/lib/SP/Mvc/View/Components/DataTab.php b/lib/SP/Mvc/View/Components/DataTab.php new file mode 100644 index 00000000..6ed9e0e6 --- /dev/null +++ b/lib/SP/Mvc/View/Components/DataTab.php @@ -0,0 +1,89 @@ +. + */ + +namespace SP\Mvc\View\Components; + +use SP\Core\Exceptions\FileNotFoundException; +use SP\Mvc\View\Template; + +/** + * Class DataTab + * + * @package SP\Mvc\View\Components + */ +class DataTab +{ + /** + * @var string + */ + protected $title; + /** + * @var Template + */ + protected $template; + + /** + * DataTab constructor. + * + * @param string $title + * @param Template $template + */ + public function __construct($title, Template $template) + { + $this->title = $title; + $this->template = $template; + } + + /** + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $title + * @return DataTab + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * @return string + */ + public function render() + { + try { + return $this->template->render(); + } catch (FileNotFoundException $e) { + return $e->getMessage(); + } + } + +} \ No newline at end of file diff --git a/lib/SP/Repositories/Category/CategoryRepository.php b/lib/SP/Repositories/Category/CategoryRepository.php index 7287721d..eccb5644 100644 --- a/lib/SP/Repositories/Category/CategoryRepository.php +++ b/lib/SP/Repositories/Category/CategoryRepository.php @@ -50,6 +50,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @throws SPException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function create($itemData) { @@ -79,6 +80,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @return bool * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function checkDuplicatedOnAdd($itemData) { @@ -103,6 +105,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @throws SPException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function update($itemData) { @@ -137,6 +140,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @return bool * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function checkDuplicatedOnUpdate($itemData) { @@ -215,6 +219,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @param array $ids * @return void * @throws SPException + * @throws \SP\Core\Dic\ContainerException */ public function deleteByIdBatch(array $ids) { @@ -230,6 +235,7 @@ class CategoryRepository extends Repository implements RepositoryItemInterface * @return int * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function delete($id) { diff --git a/lib/SP/Repositories/PublicLink/PublicLinkRepository.php b/lib/SP/Repositories/PublicLink/PublicLinkRepository.php index f5f1e73a..5cf933a0 100644 --- a/lib/SP/Repositories/PublicLink/PublicLinkRepository.php +++ b/lib/SP/Repositories/PublicLink/PublicLinkRepository.php @@ -171,7 +171,7 @@ class PublicLinkRepository extends Repository implements RepositoryItemInterface */ public function checkInUse($id) { - throw new \RuntimeException('Unimplemented'); + throw new \RuntimeException('Not implemented'); } /** @@ -200,18 +200,21 @@ class PublicLinkRepository extends Repository implements RepositoryItemInterface PL.useInfo, U.name AS userName, U.login AS userLogin, - A.name AS accountName'); + A.name AS accountName, + C.name AS clientName'); $Data->setFrom('PublicLink PL INNER JOIN User U ON PL.userId = U.id - INNER JOIN Account A ON itemId = A.id'); + INNER JOIN Account A ON itemId = A.id + INNER JOIN Client C ON A.clientId = C.id'); $Data->setOrder('PL.dateExpire DESC'); if ($SearchData->getSeachString() !== '') { - $Data->setWhere('U.login LIKE ? OR A.name LIKE ?'); + $Data->setWhere('U.login LIKE ? OR A.name LIKE ? OR C.name LIKE ?'); $search = '%' . $SearchData->getSeachString() . '%'; $Data->addParam($search); $Data->addParam($search); + $Data->addParam($search); } $Data->setLimit('?,?'); @@ -435,6 +438,10 @@ class PublicLinkRepository extends Repository implements RepositoryItemInterface throw new SPException(SPException::SP_ERROR, __u('Error al obtener enlace')); } + if ($Data->getQueryNumRows() === 0) { + throw new SPException(SPException::SP_ERROR, __u('El enlace no existe')); + } + return $queryRes; } @@ -480,6 +487,10 @@ class PublicLinkRepository extends Repository implements RepositoryItemInterface throw new SPException(SPException::SP_ERROR, __u('Error al obtener enlace')); } + if ($Data->getQueryNumRows() === 0) { + throw new SPException(SPException::SP_ERROR, __u('El enlace no existe')); + } + return $queryRes; } diff --git a/lib/SP/Services/Account/AccountHistoryService.php b/lib/SP/Services/Account/AccountHistoryService.php index 111243e9..f9480fc3 100644 --- a/lib/SP/Services/Account/AccountHistoryService.php +++ b/lib/SP/Services/Account/AccountHistoryService.php @@ -27,6 +27,7 @@ namespace SP\Services\Account; use SP\Core\Exceptions\SPException; use SP\Core\Traits\InjectableTrait; use SP\DataModel\AccountHistoryData; +use SP\DataModel\ItemSearchData; use SP\Repositories\Account\AccountHistoryRepository; use SP\Repositories\Account\AccountToUserGroupRepository; use SP\Repositories\Account\AccountToUserRepository; @@ -118,4 +119,13 @@ class AccountHistoryService { return $this->accountToUserGroupRepository->getUserGroupsByAccountId($id); } + + /** + * @param ItemSearchData $itemSearchData + * @return mixed + */ + public function search(ItemSearchData $itemSearchData) + { + return $this->accountHistoryRepository->search($itemSearchData); + } } \ No newline at end of file diff --git a/lib/SP/Services/Account/AccountService.php b/lib/SP/Services/Account/AccountService.php index bea2c3c2..982ea2d5 100644 --- a/lib/SP/Services/Account/AccountService.php +++ b/lib/SP/Services/Account/AccountService.php @@ -36,6 +36,7 @@ use SP\Core\Exceptions\SPException; use SP\Core\Session\Session; use SP\Core\Traits\InjectableTrait; use SP\DataModel\Dto\AccountDetailsResponse; +use SP\DataModel\ItemSearchData; use SP\Log\Log; use SP\Repositories\Account\AccountHistoryRepository; use SP\Repositories\Account\AccountRepository; @@ -445,4 +446,13 @@ class AccountService implements AccountServiceInterface { return $this->accountRepository->getAll(); } + + /** + * @param ItemSearchData $itemSearchData + * @return mixed + */ + public function search(ItemSearchData $itemSearchData) + { + return $this->accountRepository->search($itemSearchData); + } } \ No newline at end of file diff --git a/lib/SP/Services/Category/CategoryService.php b/lib/SP/Services/Category/CategoryService.php index 98295ee7..eeec663a 100644 --- a/lib/SP/Services/Category/CategoryService.php +++ b/lib/SP/Services/Category/CategoryService.php @@ -81,6 +81,7 @@ class CategoryService * @throws SPException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function delete($id) { @@ -97,6 +98,7 @@ class CategoryService * @throws SPException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function create($itemData) { @@ -109,6 +111,7 @@ class CategoryService * @throws SPException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Core\Dic\ContainerException */ public function update($itemData) { diff --git a/lib/SP/Services/PublicLink/PublicLinkService.php b/lib/SP/Services/PublicLink/PublicLinkService.php index cc969339..4fc2c497 100644 --- a/lib/SP/Services/PublicLink/PublicLinkService.php +++ b/lib/SP/Services/PublicLink/PublicLinkService.php @@ -272,7 +272,7 @@ class PublicLinkService public function addLinkView(PublicLinkData $publicLinkData) { /** @var array $useInfo */ - $useInfo = serialize($publicLinkData->getUseInfo()); + $useInfo = unserialize($publicLinkData->getUseInfo()); $useInfo[] = self::getUseInfo($publicLinkData->getHash()); $publicLinkData->setUseInfo($useInfo); diff --git a/lib/SP/Storage/DbWrapper.php b/lib/SP/Storage/DbWrapper.php index d16b186f..2745bb53 100644 --- a/lib/SP/Storage/DbWrapper.php +++ b/lib/SP/Storage/DbWrapper.php @@ -137,6 +137,7 @@ class DbWrapper * @param string $query La consulta que genera el error * @param \Exception $e * @param string $queryFunction + * @throws \SP\Core\Dic\ContainerException */ private static function logDBException($query, \Exception $e, $queryFunction) { @@ -166,6 +167,7 @@ class DbWrapper * @param DatabaseInterface $db * @return PDOStatement|false * @throws SPException + * @throws \SP\Core\Dic\ContainerException */ public static function getResultsRaw(QueryData $queryData, DatabaseInterface $db = null) { @@ -192,6 +194,7 @@ class DbWrapper * @return bool * @throws ConstraintException * @throws QueryException + * @throws \SP\Core\Dic\ContainerException */ public static function getQuery(QueryData $queryData, DatabaseInterface $db = null) {