How to hide a block or text if user can edit node? In a block there's a flag where users can ask for permission to edit the node. The admin gets a mail when the node is flagged. Admin can grant acces with node-acces to a particular user. This part is working.

However, when the user can edit the node, this block (or snippet; could use if else statement) should be hidden. I'm looking for (and can't find it) a snippet like

if user can edit 
    {'you can edit'} 
else 
    {show flag}


How should I do the first part?
Seems it can be done via this PoC

if (node_access('edit', $node, $user)) {
  {'you can edit'} 
}
else {
  {show flag}
}