mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add audit trail messages to several controllers.
This commit is contained in:
parent
c6e3b54705
commit
c5af1d363c
@ -64,6 +64,8 @@ class ConfigurationController extends Controller
|
|||||||
$subTitle = (string)trans('firefly.instance_configuration');
|
$subTitle = (string)trans('firefly.instance_configuration');
|
||||||
$subTitleIcon = 'fa-wrench';
|
$subTitleIcon = 'fa-wrench';
|
||||||
|
|
||||||
|
Log::channel('audit')->info('User visits admin config index.');
|
||||||
|
|
||||||
// all available configuration and their default value in case
|
// all available configuration and their default value in case
|
||||||
// they don't exist yet.
|
// they don't exist yet.
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
@ -88,6 +90,8 @@ class ConfigurationController extends Controller
|
|||||||
// get config values:
|
// get config values:
|
||||||
$data = $request->getConfigurationData();
|
$data = $request->getConfigurationData();
|
||||||
|
|
||||||
|
Log::channel('audit')->info('User updates global configuration.', $data);
|
||||||
|
|
||||||
// store config values
|
// store config values
|
||||||
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
||||||
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
||||||
|
@ -52,6 +52,7 @@ class HomeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
Log::channel('audit')->info('User visits admin index.');
|
||||||
$title = (string)trans('firefly.administration');
|
$title = (string)trans('firefly.administration');
|
||||||
$mainTitleIcon = 'fa-hand-spock-o';
|
$mainTitleIcon = 'fa-hand-spock-o';
|
||||||
$sandstorm = 1 === (int)getenv('SANDSTORM');
|
$sandstorm = 1 === (int)getenv('SANDSTORM');
|
||||||
@ -68,6 +69,7 @@ class HomeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function testMessage(Request $request)
|
public function testMessage(Request $request)
|
||||||
{
|
{
|
||||||
|
Log::channel('audit')->info('User sends test message.');
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$ipAddress = $request->ip();
|
$ipAddress = $request->ip();
|
||||||
|
@ -28,6 +28,7 @@ use FireflyIII\Http\Requests\LinkTypeFormRequest;
|
|||||||
use FireflyIII\Models\LinkType;
|
use FireflyIII\Models\LinkType;
|
||||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Log;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +64,8 @@ class LinkController extends Controller
|
|||||||
$subTitle = (string)trans('firefly.create_new_link_type');
|
$subTitle = (string)trans('firefly.create_new_link_type');
|
||||||
$subTitleIcon = 'fa-link';
|
$subTitleIcon = 'fa-link';
|
||||||
|
|
||||||
|
Log::channel('audit')->info('User visits link index.');
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "create another").
|
// put previous url in session if not redirect from store (not "create another").
|
||||||
if (true !== session('link-types.create.fromStore')) {
|
if (true !== session('link-types.create.fromStore')) {
|
||||||
$this->rememberPreviousUri('link-types.create.uri');
|
$this->rememberPreviousUri('link-types.create.uri');
|
||||||
@ -88,6 +91,8 @@ class LinkController extends Controller
|
|||||||
return redirect(route('admin.links.index'));
|
return redirect(route('admin.links.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log::channel('audit')->info(sprintf('User wants to delete link type #%d', $linkType->id));
|
||||||
|
|
||||||
$subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);
|
$subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);
|
||||||
$otherTypes = $repository->get();
|
$otherTypes = $repository->get();
|
||||||
$count = $repository->countJournals($linkType);
|
$count = $repository->countJournals($linkType);
|
||||||
@ -116,6 +121,7 @@ class LinkController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
public function destroy(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
||||||
{
|
{
|
||||||
|
Log::channel('audit')->info(sprintf('User destroyed link type #%d', $linkType->id));
|
||||||
$name = $linkType->name;
|
$name = $linkType->name;
|
||||||
$moveTo = $repository->findNull((int)$request->get('move_link_type_before_delete'));
|
$moveTo = $repository->findNull((int)$request->get('move_link_type_before_delete'));
|
||||||
$repository->destroy($linkType, $moveTo);
|
$repository->destroy($linkType, $moveTo);
|
||||||
@ -144,6 +150,8 @@ class LinkController extends Controller
|
|||||||
$subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]);
|
$subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]);
|
||||||
$subTitleIcon = 'fa-link';
|
$subTitleIcon = 'fa-link';
|
||||||
|
|
||||||
|
Log::channel('audit')->info(sprintf('User wants to edit link type #%d', $linkType->id));
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
if (true !== session('link-types.edit.fromUpdate')) {
|
if (true !== session('link-types.edit.fromUpdate')) {
|
||||||
$this->rememberPreviousUri('link-types.edit.uri'); // @codeCoverageIgnore
|
$this->rememberPreviousUri('link-types.edit.uri'); // @codeCoverageIgnore
|
||||||
@ -165,6 +173,8 @@ class LinkController extends Controller
|
|||||||
$subTitle = (string)trans('firefly.journal_link_configuration');
|
$subTitle = (string)trans('firefly.journal_link_configuration');
|
||||||
$subTitleIcon = 'fa-link';
|
$subTitleIcon = 'fa-link';
|
||||||
$linkTypes = $repository->get();
|
$linkTypes = $repository->get();
|
||||||
|
|
||||||
|
Log::channel('audit')->info('User on index of link types in admin.');
|
||||||
$linkTypes->each(
|
$linkTypes->each(
|
||||||
function (LinkType $linkType) use ($repository) {
|
function (LinkType $linkType) use ($repository) {
|
||||||
$linkType->journalCount = $repository->countJournals($linkType);
|
$linkType->journalCount = $repository->countJournals($linkType);
|
||||||
@ -187,6 +197,8 @@ class LinkController extends Controller
|
|||||||
$subTitleIcon = 'fa-link';
|
$subTitleIcon = 'fa-link';
|
||||||
$links = $linkType->transactionJournalLinks()->get();
|
$links = $linkType->transactionJournalLinks()->get();
|
||||||
|
|
||||||
|
Log::channel('audit')->info(sprintf('User viewing link type #%d', $linkType->id));
|
||||||
|
|
||||||
return view('admin.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));
|
return view('admin.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +218,9 @@ class LinkController extends Controller
|
|||||||
'outward' => $request->string('outward'),
|
'outward' => $request->string('outward'),
|
||||||
];
|
];
|
||||||
$linkType = $repository->store($data);
|
$linkType = $repository->store($data);
|
||||||
|
|
||||||
|
Log::channel('audit')->info('User stored new link type.', $linkType->toArray());
|
||||||
|
|
||||||
$request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
|
$request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
|
||||||
$redirect = redirect($this->getPreviousUri('link-types.create.uri'));
|
$redirect = redirect($this->getPreviousUri('link-types.create.uri'));
|
||||||
if (1 === (int)$request->get('create_another')) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
@ -243,6 +258,8 @@ class LinkController extends Controller
|
|||||||
];
|
];
|
||||||
$repository->update($linkType, $data);
|
$repository->update($linkType, $data);
|
||||||
|
|
||||||
|
Log::channel('audit')->info(sprintf('User update link type #%d.', $linkType->id), $data);
|
||||||
|
|
||||||
$request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));
|
$request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
$redirect = redirect($this->getPreviousUri('link-types.edit.uri'));
|
$redirect = redirect($this->getPreviousUri('link-types.edit.uri'));
|
||||||
|
@ -268,7 +268,7 @@ class CurrencyController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$request->session()->flash('preFilled', $preFilled);
|
$request->session()->flash('preFilled', $preFilled);
|
||||||
|
Log::channel('audit')->info('Edit currency.', $currency->toArray());
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
if (true !== session('currencies.edit.fromUpdate')) {
|
if (true !== session('currencies.edit.fromUpdate')) {
|
||||||
|
@ -62,7 +62,7 @@ class UpdateRequest implements GithubRequest
|
|||||||
$releaseXml = new SimpleXMLElement($res->getBody()->getContents(), LIBXML_NOCDATA);
|
$releaseXml = new SimpleXMLElement($res->getBody()->getContents(), LIBXML_NOCDATA);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
Log::error(sprintf('Could not get body from github updat result: %s', $e->getMessage()));
|
Log::error(sprintf('Could not get body from github updat result: %s', $e->getMessage()));
|
||||||
$releaseXml = new SimpleXMLElement('');
|
throw new FireflyException(sprintf('Could not get body from github updat result: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//fetch the products for each category
|
//fetch the products for each category
|
||||||
|
Loading…
Reference in New Issue
Block a user