forked from MPOS/php-mpos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [ADDED] Smarty acl_check function
* [ADDED] Optional default return value for getValue calls
* [UPDATE] ACL Checks in page controllers
* [UPDATE] Navigation template to use check_acl from Smarty
* [ADDED] New ACL options where needed
* [REMOVED] Disable pages from System Settings Tab
* [ADDED] Above removed pages into ACL Settings Tab
This will make usage of ACLs a bit easier and transparent.
Also fixes #1731 once merged.
- Loading branch information
Showing
17 changed files
with
179 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
$smarty->registerPlugin("function","acl_check", "check_acl_access"); | ||
|
||
function check_acl_access($params, $smarty) | ||
{ | ||
$isAuthenticated = isset($_SESSION['AUTHENTICATED']) ? true : false; | ||
$iAclSetting = $params['acl']; | ||
$sUrl = '<li class="'.$params['icon'].'"><a href="'.$_SERVER['SCRIPT_NAME'].'?page='.$params['page'].'&action='.$params['action'].'">'.$params['name'].'</a></li>'; | ||
if (isset($params['fallback'])) | ||
$sFallbackUrl = '<li class="'.$params['icon'].'"><a href="'.$_SERVER['SCRIPT_NAME'].'?page='.$params['page'].'">'.$params['name'].'</a></li>'; | ||
switch($iAclSetting) { | ||
case '0': | ||
if ($isAuthenticated) { | ||
echo $sUrl; | ||
} else if (isset($params['fallback']) && !$isAuthenticated) { | ||
echo $sFallbackUrl; | ||
} | ||
break; | ||
case '1': | ||
echo $sUrl; | ||
break; | ||
case '2': | ||
break; | ||
default: | ||
echo $sUrl; | ||
break; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
<?php | ||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; | ||
|
||
if ($setting->getValue('disable_donors')) { | ||
$_SESSION['POPUP'][] = array('CONTENT' => 'Donors are currently disabled. Please try again later.', 'TYPE' => 'errormsg'); | ||
$smarty->assign("CONTENT", "disabled.tpl"); | ||
} else { | ||
// ACL check | ||
switch($setting->getValue('acl_donors_page', 1)) { | ||
case '0': | ||
if ($user->isAuthenticated()) { | ||
$aDonors = $transaction->getDonations(); | ||
$smarty->assign("DONORS", $aDonors); | ||
$smarty->assign("CONTENT", "default.tpl"); | ||
} | ||
break; | ||
case '1': | ||
$aDonors = $transaction->getDonations(); | ||
|
||
// Tempalte specifics | ||
$smarty->assign("DONORS", $aDonors); | ||
$smarty->assign("CONTENT", "default.tpl"); | ||
break; | ||
case '2': | ||
$_SESSION['POPUP'][] = array('CONTENT' => 'Page currently disabled. Please try again later.', 'TYPE' => 'errormsg'); | ||
$smarty->assign("CONTENT", "disabled.tpl"); | ||
break; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
<?php | ||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; | ||
|
||
if ($setting->getValue('disable_about')) { | ||
$_SESSION['POPUP'][] = array('CONTENT' => 'Donors are currently disabled. Please try again later.', 'TYPE' => 'errormsg'); | ||
$smarty->assign("CONTENT", "disabled.tpl"); | ||
} else { | ||
// Tempalte specifics | ||
// ACL check | ||
switch($setting->getValue('acl_about_page', 1)) { | ||
case '0': | ||
if ($user->isAuthenticated()) { | ||
$smarty->assign("CONTENT", "default.tpl"); | ||
} | ||
break; | ||
case '1': | ||
$smarty->assign("CONTENT", "default.tpl"); | ||
break; | ||
case '2': | ||
$_SESSION['POPUP'][] = array('CONTENT' => 'Page currently disabled. Please try again later.', 'TYPE' => 'errormsg'); | ||
$smarty->assign("CONTENT", "disabled.tpl"); | ||
break; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.