Skip to content

Commit 4dcb88a

Browse files
committed
Some refactoring of access checks - in progress.
1 parent e59d57b commit 4dcb88a

24 files changed

Lines changed: 176 additions & 66 deletions

WEB-INF/templates/footer.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<br>
1313
<table cellspacing="0" cellpadding="4" width="100%" border="0">
1414
<tr>
15-
<td align="center">&nbsp;Anuko Time Tracker 1.17.69.4155 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
15+
<td align="center">&nbsp;Anuko Time Tracker 1.17.69.4156 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
1616
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
1717
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
1818
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>

client_add.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
import('ttClientHelper');
3232
import('ttTeamHelper');
3333

34-
// Access check.
35-
if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) {
34+
// Access checks.
35+
if (!ttAccessAllowed('manage_clients')) {
3636
header('Location: access_denied.php');
3737
exit();
3838
}
39+
if (!$user->isPluginEnabled('cl')) {
40+
header('Location: feature_disabled.php');
41+
exit();
42+
}
3943

4044
$projects = ttTeamHelper::getActiveProjects($user->team_id);
4145

client_delete.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
import('form.Form');
3131
import('ttClientHelper');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_clients')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cl')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$id = (int)$request->getParameter('id');
4044
$client = ttClientHelper::getClient($id);

client_edit.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
import('ttClientHelper');
3232
import('ttTeamHelper');
3333

34-
// Access check.
35-
if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) {
34+
// Access checks.
35+
if (!ttAccessAllowed('manage_clients')) {
3636
header('Location: access_denied.php');
3737
exit();
3838
}
39+
if (!$user->isPluginEnabled('cl')) {
40+
header('Location: feature_disabled.php');
41+
exit();
42+
}
3943

4044
$cl_id = (int) $request->getParameter('id');
4145

clients.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
import('form.Form');
3131
import('ttTeamHelper');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_clients')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cl')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$smarty->assign('active_clients', ttTeamHelper::getActiveClients($user->team_id, true));
4044
$smarty->assign('inactive_clients', ttTeamHelper::getInactiveClients($user->team_id, true));

expense_delete.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@
3131
import('DateAndTime');
3232
import('ttExpenseHelper');
3333

34-
// Access check.
35-
if (!ttAccessAllowed('track_own_expenses') || !$user->isPluginEnabled('ex')) {
34+
// Access checks.
35+
if (!(ttAccessAllowed('track_own_expenses') || ttAccessAllowed('track_expenses'))) {
3636
header('Location: access_denied.php');
3737
exit();
3838
}
39+
if (!$user->isPluginEnabled('ex')) {
40+
header('Location: feature_disabled.php');
41+
exit();
42+
}
43+
44+
3945

4046
$cl_id = $request->getParameter('id');
4147
$expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser());

expense_edit.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@
3232
import('DateAndTime');
3333
import('ttExpenseHelper');
3434

35-
// Access check.
36-
if (!ttAccessAllowed('track_own_expenses') || !$user->isPluginEnabled('ex')) {
35+
// Access checks.
36+
if (!(ttAccessAllowed('track_own_expenses') || ttAccessAllowed('track_expenses'))) {
3737
header('Location: access_denied.php');
3838
exit();
3939
}
40+
if (!$user->isPluginEnabled('ex')) {
41+
header('Location: feature_disabled.php');
42+
exit();
43+
}
4044

4145
$cl_id = $request->getParameter('id');
4246

expenses.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@
3333
import('DateAndTime');
3434
import('ttExpenseHelper');
3535

36-
// Access check.
37-
if (!ttAccessAllowed('track_own_expenses') || !$user->isPluginEnabled('ex')) {
36+
// Access checks.
37+
if (!(ttAccessAllowed('track_own_expenses') || ttAccessAllowed('track_expenses'))) {
3838
header('Location: access_denied.php');
3939
exit();
4040
}
41+
if (!$user->isPluginEnabled('ex')) {
42+
header('Location: feature_disabled.php');
43+
exit();
44+
}
4145

4246
// Initialize and store date in session.
4347
$cl_date = $request->getParameter('date', @$_SESSION['date']);

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
// Redirects for admin and client roles.
3232
if ($auth->isAuthenticated()) {
33-
if ($user->isAdmin()) {
33+
if ($user->can('administer_site')) {
3434
header('Location: admin_teams.php');
3535
exit();
3636
} elseif ($user->isClient()) {

invoice_add.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
import('ttTeamHelper');
3232
import('ttInvoiceHelper');
3333

34-
// Access check.
35-
if (!ttAccessAllowed('manage_invoices') || !$user->isPluginEnabled('iv')) {
34+
// Access checks.
35+
if (!ttAccessAllowed('manage_invoices')) {
3636
header('Location: access_denied.php');
3737
exit();
3838
}
39+
if (!$user->isPluginEnabled('iv')) {
40+
header('Location: feature_disabled.php');
41+
exit();
42+
}
3943

4044
if ($request->isPost()) {
4145
$cl_date = $request->getParameter('date');

0 commit comments

Comments
 (0)