本文整理汇总了PHP中Authenticate::getPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticate::getPermission方法的具体用法?PHP Authenticate::getPermission怎么用?PHP Authenticate::getPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticate
的用法示例。
在下文中一共展示了Authenticate::getPermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess
function preprocess()
{
$me = CoreLocal::get('CashierNo');
$this->security = Authenticate::getPermission($me);
if (isset($_REQUEST['selectlist'])) {
if (!FormLib::validateToken()) {
return false;
}
if (empty($_REQUEST['selectlist'])) {
$this->change_page($this->page_url . "gui-modules/pos2.php");
return False;
} elseif ($_REQUEST['selectlist'] == 'SUSPEND') {
Database::getsubtotals();
if (CoreLocal::get("LastID") == 0) {
CoreLocal::set("boxMsg", _("no transaction in progress"));
CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
$this->change_page($this->page_url . "gui-modules/boxMsg2.php");
return False;
} else {
// ajax call to end transaction
// and print receipt
$ref = SuspendLib::suspendorder();
$this->add_onload_command("\$.ajax({\n type:'post',\n url:'{$this->page_url}ajax-callbacks/ajax-end.php',\n cache: false,\n data: 'receiptType=suspended&ref={$ref}',\n dataType: 'json',\n success: function(data){\n \$.ajax({\n type:'post',\n url:'{$this->page_url}ajax-callbacks/ajax-transaction-sync.php',\n cache: false,\n success: function(data){\n location='{$this->page_url}gui-modules/pos2.php';\n },\n error: function(e1){\n location='{$this->page_url}gui-modules/pos2.php';\n }\n });\n },\n error: function(e1){\n location='{$this->page_url}gui-modules/pos2.php';\n }\n });");
return True;
}
} else {
if ($_REQUEST['selectlist'] == 'RESUME') {
Database::getsubtotals();
if (CoreLocal::get("LastID") != 0) {
CoreLocal::set("boxMsg", _("transaction in progress"));
CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
$this->change_page($this->page_url . "gui-modules/boxMsg2.php");
} elseif (SuspendLib::checksuspended() == 0) {
CoreLocal::set("boxMsg", _("no suspended transaction"));
CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
CoreLocal::set("strRemembered", "");
$this->change_page($this->page_url . "gui-modules/boxMsg2.php");
} else {
$this->change_page($this->page_url . "gui-modules/suspendedlist.php");
}
return False;
} else {
if ($_REQUEST['selectlist'] == 'TR') {
TenderReport::printReport();
$this->change_page($this->page_url . "gui-modules/pos2.php");
return False;
} else {
if ($_REQUEST['selectlist'] == 'OTR' && $this->security >= 30) {
$this->change_page($this->page_url . 'gui-modules/requestInfo.php?class=AnyTenderReportRequest');
return False;
} elseif ($_REQUEST['selectlist'] == 'UNDO' && $this->security >= 30) {
$this->change_page($this->page_url . 'gui-modules/undo.php');
return false;
}
}
}
}
}
return True;
}
示例2: preprocess
function preprocess()
{
$this->my_drawer = ReceiptLib::currentDrawer();
$this->available = ReceiptLib::availableDrawers();
$this->is_admin = false;
$db = Database::pDataConnect();
$sec = Authenticate::getPermission(CoreLocal::get('CashierNo'));
if ($sec >= 30) {
$this->is_admin = true;
}
if (isset($_REQUEST['selectlist'])) {
if (empty($_REQUEST['selectlist'])) {
if (empty($this->available) && !$this->is_admin && $this->my_drawer == 0) {
// no drawer available and not admin
// sign out and go back to main login screen
Database::setglobalvalue("LoggedIn", 0);
CoreLocal::set("LoggedIn", 0);
CoreLocal::set("training", 0);
CoreLocal::set("gui-scale", "no");
$this->change_page($this->page_url . "gui-modules/login2.php");
} else {
$this->change_page($this->page_url . "gui-modules/pos2.php");
}
return False;
}
if (substr($_REQUEST['selectlist'], 0, 2) == 'TO' && $this->is_admin) {
// take over a drawer
$new_drawer = substr($_REQUEST['selectlist'], 2);
if ($this->my_drawer != 0) {
// free up the current drawer if it exists
ReceiptLib::drawerKick();
ReceiptLib::freeDrawer($this->my_drawer);
}
// switch to the requested drawer
ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $new_drawer);
ReceiptLib::drawerKick();
$this->my_drawer = $new_drawer;
} elseif (substr($_REQUEST['selectlist'], 0, 2) == 'SW') {
// switch to available drawer
$new_drawer = substr($_REQUEST['selectlist'], 2);
foreach ($this->available as $id) {
// verify the requested drawer is available
if ($new_drawer == $id) {
if ($this->my_drawer != 0) {
// free up the current drawer if it exists
ReceiptLib::drawerKick();
ReceiptLib::freeDrawer($this->my_drawer);
}
// switch to the requested drawer
ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $new_drawer);
ReceiptLib::drawerKick();
$this->my_drawer = $new_drawer;
break;
}
}
}
}
return True;
}
示例3: body_content
function body_content()
{
$local = array();
$other = array();
$db = Database::tDataConnect();
$localQ = 'SELECT amount, PAN, refNum FROM efsnetRequest GROUP BY amount, PAN, refNum';
$localR = $db->query($localQ);
while ($w = $db->fetch_row($localR)) {
$local['_l' . $w['refNum']] = '(CURRENT)' . $w['PAN'] . ' : ' . sprintf('%.2f', $w['amount']);
}
if (CoreLocal::get('standalone') == 0) {
$emp = CoreLocal::get('CashierNo');
$sec = Authenticate::getPermission($emp);
$supervisor = $sec >= 30 ? true : false;
$db = Database::mDataConnect();
$otherQ = 'SELECT MIN(datetime) as dt, amount, PAN, refNum,
cashierNo, laneNo, transNo
FROM efsnetRequest
WHERE date=' . date('Ymd');
if (!$supervisor) {
$otherQ .= ' AND laneNo=' . (int) CoreLocal::get('laneno') . '
AND cashierNo=' . (int) CoreLocal::get('CashierNo');
}
$otherQ .= ' GROUP BY amount, PAN, refNum
ORDER BY datetime DESC';
$otherR = $db->query($otherQ);
while ($w = $db->fetch_row($otherR)) {
$other[$w['refNum']] = $w['dt'] . ' : ' . $w['cashierNo'] . '-' . $w['laneNo'] . '-' . $w['transNo'] . ' : ' . sprintf('%.2f', $w['amount']);
}
}
?>
<div class="baseHeight">
<div class="listbox">
<form name="selectform" method="post" id="selectform"
action="<?php
echo $_SERVER['PHP_SELF'];
?>
" >
<select name="selectlist" size="10" id="selectlist"
onblur="$('#selectlist').focus()" >
<?php
$selected = 'selected';
foreach ($local as $id => $label) {
printf('<option %s value="%s">%s</option>', $selected, $id, $label);
$selected = '';
}
foreach ($other as $id => $label) {
printf('<option %s value="%s">%s</option>', $selected, $id, $label);
$selected = '';
}
if (count($local) == 0 && count($other) == 0) {
echo '<option value="" selected>No transactions found</option>';
}
?>
</select>
</form>
</div>
<div class="listboxText coloredText centerOffset">
<?php
echo _("use arrow keys to navigate");
?>
<br />
<?php
echo _("enter to reprint receipt");
?>
<br />
<?php
echo _("clear to cancel");
?>
</div>
<div class="clear"></div>
</div>
<?php
$this->add_onload_command("\$('#selectlist').keypress(processkeypress);\n");
$this->add_onload_command("\$('#selectlist').focus();\n");
}
示例4: testAuthenticate
public function testAuthenticate()
{
CoreLocal::set('scaleDriver', '');
// don't interact w/ scale
Database::setglobalvalue('LoggedIn', 1);
Database::setglobalvalue('CashierNo', 1);
$fail = Authenticate::checkPassword('9999');
$this->assertEquals(False, $fail);
Database::setglobalvalue('CashierNo', 9999);
$pass = Authenticate::checkPassword('9999');
$this->assertEquals(True, $pass);
Database::setglobalvalue('LoggedIn', 0);
Database::setglobalvalue('CashierNo', 1);
$pass = Authenticate::checkPassword('9999');
$this->assertEquals(True, $pass);
Database::setglobalvalue('LoggedIn', 0);
Database::setglobalvalue('CashierNo', 1);
$pass = Authenticate::checkPassword('56');
$this->assertEquals(True, $pass);
Database::setglobalvalue('LoggedIn', 0);
Database::setglobalvalue('CashierNo', 1);
$fail = Authenticate::checkPassword('invalid password');
$this->assertEquals(false, $fail);
$this->assertEquals(false, Authenticate::checkPermission('56', 50));
$this->assertEquals(false, Authenticate::checkPermission('56', 21));
$this->assertEquals(true, Authenticate::checkPermission('56', 20));
$this->assertEquals(true, Authenticate::checkPermission('56', 10));
$this->assertEquals(false, Authenticate::getEmployeeByPassword('asdf'));
$this->assertInternalType('array', Authenticate::getEmployeeByPassword('56'));
$this->assertEquals(false, Authenticate::getEmployeeByNumber(75));
$this->assertInternalType('array', Authenticate::getEmployeeByNumber(56));
$this->assertEquals(0, Authenticate::getPermission(55));
$this->assertEquals(20, Authenticate::getPermission(56));
}
示例5: body_content
function body_content()
{
$fes = Authenticate::getPermission(CoreLocal::get('CashierNo'));
/* if front end security >= 25, pull all
* available receipts; other wise, just
* current cashier's receipt */
$result = -1;
if ($fes >= 25) {
$query = "select emp_no, register_no, trans_no, sum((case when trans_type = 'T' then -1 * total else 0 end)) as total " . "from localtranstoday " . " group by register_no, emp_no, trans_no\n having sum((case when trans_type='T' THEN -1*total ELSE 0 end)) >= 30\n order by register_no,emp_no,trans_no desc";
$db = Database::tDataConnect();
if (CoreLocal::get("standalone") == 0) {
$query = str_replace("localtranstoday", "dtransactions", $query);
$db = Database::mDataConnect();
}
$result = $db->query($query);
} else {
$db = Database::tDataConnect();
$query = "\n SELECT emp_no, \n register_no, \n trans_no, \n SUM((CASE WHEN trans_type = 'T' THEN -1 * total ELSE 0 END)) AS total \n FROM localtranstoday \n WHERE register_no = ?\n AND emp_no = ?\n AND datetime >= " . $db->curdate() . "\n GROUP BY register_no, \n emp_no, \n trans_no\n HAVING SUM((CASE WHEN trans_type='T' THEN -1*total ELSE 0 END)) >= 30\n ORDER BY trans_no desc";
$args = array(CoreLocal::get('laneno'), CoreLocal::get('CashierNo'));
$prep = $db->prepare($query);
$result = $db->execute($prep, $args);
}
$num_rows = $db->num_rows($result);
?>
<div class="baseHeight">
<div class="listbox">
<form id="selectform" name="selectform" onsubmit="return submitWrapper();">
<select name="selectlist" size="15" onblur="$('#selectlist').focus()"
id="selectlist">
<?php
$selected = "selected";
for ($i = 0; $i < $num_rows; $i++) {
$row = $db->fetch_array($result);
echo "<option value='" . $row["emp_no"] . "-" . $row["register_no"] . "-" . $row["trans_no"] . "'";
echo $selected;
echo ">lane " . substr(100 + $row["register_no"], -2) . " Cashier " . $row["emp_no"] . " #" . $row["trans_no"] . " -- \$" . $row["total"];
$selected = "";
}
if ($num_rows == 0) {
echo "<option selected value=\"\">None found</option>";
}
?>
</select>
</div>
<?php
if (CoreLocal::get('touchscreen')) {
echo '<div class="listbox listboxText">' . DisplayLib::touchScreenScrollButtons('#selectlist') . '</div>';
}
?>
<div class="listboxText coloredText centerOffset">
<?php
echo _("use arrow keys to navigate");
?>
<br />
<p>
<button type="submit" class="pos-button wide-button coloredArea">
Reprint <span class="smaller">[enter]</span>
</button>
</p>
<p>
<button type="submit" class="pos-button wide-button errorColoredArea"
onclick="$('#selectlist').append($('<option>').val(''));$('#selectlist').val('');">
Cancel <span class="smaller">[clear]</span>
</button></p>
</div>
</form>
<div class="clear"></div>
</div>
<?php
}