juzna

nette latte authorization

Mar 17th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. MyPresenter.php
  2. ----------
  3.  
  4. /**
  5. * Handle action, only valid for a logged-in user otherwise throws
  6. * @User
  7. */
  8. public function handleLike($itemId) { ... }
  9.  
  10.  
  11.  
  12. page.latte without auth testing
  13. ----------
  14.  
  15. <a n:href="like! $item->id">Like</a>
  16.  
  17.  
  18.  
  19.  
  20. Task:
  21. You want to hide the link, if the user is not authorized to perform such signal/action. How would you do that?
  22. What would happen, if you decide to change the rules for signal handler (e.g. only allowed for users with an editor role)?
Advertisement
Add Comment
Please, Sign In to add comment