Skip to content

Commit

Permalink
make secure-id of receipt readable for owners
Browse files Browse the repository at this point in the history
  • Loading branch information
hadimansouri committed Feb 5, 2020
1 parent 4908c01 commit e19271d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Bank/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static function create($param, $owner = null, $ownerId = null)
$engine = $backend->get_engine();
$engine->create($receipt);
$receipt->update();
$receipt->_a['cols']['secure_id']['readable'] = true;
return $receipt;
}

Expand Down
12 changes: 11 additions & 1 deletion src/Bank/Views/Receipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ class Bank_Views_Receipt
*/
public function find($request, $match)
{
$pag = new Pluf_Paginator(new Bank_Receipt());
$receipt = new Bank_Receipt();
if(User_Precondition::isOwner($request)){
// Make secure-id as readable for owners.
$receipt->_a['cols']['secure_id']['readable'] = true;
}
$pag = new Pluf_Paginator($receipt);
$pag->configure(array(), array( // search
'title',
'description'
Expand Down Expand Up @@ -73,6 +78,9 @@ public function create($request, $match)
public function get($request, $match)
{
$receipt = Bank_Shortcuts_GetReceiptOr404($match['id']);
if(User_Precondition::isOwner($request)){
$receipt->_a['cols']['secure_id']['readable'] = true;
}
return $receipt;
}

Expand All @@ -88,6 +96,7 @@ public function getBySecureId($request, $match)
$match['secure_id']
));
$receipt = $receipt->getOne($sql->gen());
$receipt->_a['cols']['secure_id']['readable'] = true;
return $receipt;
}

Expand Down Expand Up @@ -119,6 +128,7 @@ public function updateBySecureId($request, $match)
if ($engine->update($receipt)) {
$receipt->update();
}
$receipt->_a['cols']['secure_id']['readable'] = true;
return $receipt;
}

Expand Down

0 comments on commit e19271d

Please sign in to comment.