Skip to content

Commit

Permalink
You can no longer export user data without permission.
Browse files Browse the repository at this point in the history
------
Ya no se pueden exportar datos del usuario sin permiso.
  • Loading branch information
NeoRazorX committed Apr 30, 2022
1 parent 5bca5e4 commit 92afdf3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions Core/Controller/EditUser.php
Expand Up @@ -89,6 +89,10 @@ protected function createViews()
$this->views[$this->getMainViewName()]->disableColumn('warehouse');
}

// disable print button
$this->setSettings($this->getMainViewName(), 'btnPrint', false);

// add roles tab
if ($this->user->admin) {
$this->createViewsRole();
}
Expand Down
18 changes: 5 additions & 13 deletions Core/Controller/ListUser.php
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2021 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2017-2022 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -31,12 +31,7 @@
class ListUser extends ListController
{

/**
* Returns basic page attributes
*
* @return array
*/
public function getPageData()
public function getPageData(): array
{
$data = parent::getPageData();
$data['menu'] = 'admin';
Expand All @@ -54,9 +49,6 @@ protected function createViews()
$this->createViewsRoles();
}

/**
* @param string $viewName
*/
protected function createViewsRoles(string $viewName = 'ListRole')
{
$this->addView($viewName, 'Role', 'roles', 'fas fa-address-card');
Expand All @@ -65,9 +57,6 @@ protected function createViewsRoles(string $viewName = 'ListRole')
$this->addOrderBy($viewName, ['codrole'], 'code');
}

/**
* @param string $viewName
*/
protected function createViewsUsers(string $viewName = 'ListUser')
{
$this->addView($viewName, 'User', 'users', 'fas fa-users');
Expand All @@ -94,5 +83,8 @@ protected function createViewsUsers(string $viewName = 'ListUser')
if (count($warehouses) > 2) {
$this->addFilterSelect($viewName, 'codalmacen', 'warehouse', 'codalmacen', $warehouses);
}

// disable print button
$this->setSettings($viewName, 'btnPrint', false);
}
}
7 changes: 6 additions & 1 deletion Core/Lib/ExtendedController/BaseController.php
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2021 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2017-2022 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -344,6 +344,11 @@ protected function deleteAction()

protected function exportAction()
{
if (false === $this->views[$this->active]->settings['btnPrint']) {
$this->toolBox()->i18nLog()->warning('no-print-permission');
return;
}

$this->setTemplate(false);
$this->exportManager->newDoc(
$this->request->get('option', ''),
Expand Down
8 changes: 6 additions & 2 deletions Core/Lib/ExtendedController/ListController.php
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2021 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2017-2022 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -302,8 +302,12 @@ protected function execPreviousAction($action)

protected function exportAction()
{
$this->setTemplate(false);
if (false === $this->views[$this->active]->settings['btnPrint']) {
$this->toolBox()->i18nLog()->warning('no-print-permission');
return;
}

$this->setTemplate(false);
$codes = $this->request->request->get('code');
$option = $this->request->get('option', '');
$this->exportManager->newDoc($option);
Expand Down

0 comments on commit 92afdf3

Please sign in to comment.