| @@ 592-604 (lines=13) @@ | ||
| 589 | * @param $nid |
|
| 590 | * @return bool|int |
|
| 591 | */ |
|
| 592 | private function checkPermissions($permission, $nid) { |
|
| 593 | // gather information |
|
| 594 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
|
| 595 | $note = $this->getNote($nid); |
|
| 596 | // owner is allowed to change everything |
|
| 597 | if ($uid === $note['uid']) { |
|
| 598 | return true; |
|
| 599 | } |
|
| 600 | ||
| 601 | // check share permissions |
|
| 602 | $shared_note = \OCP\Share::getItemSharedWith('ownnote', $nid, 'populated_shares')[0]; |
|
| 603 | return $shared_note['permissions'] & $permission; |
|
| 604 | } |
|
| 605 | } |
|
| 606 | ||
| 607 | ?> |
|
| @@ 444-456 (lines=13) @@ | ||
| 441 | return $farray; |
|
| 442 | } |
|
| 443 | ||
| 444 | private function checkPermissions($permission, $nid) { |
|
| 445 | // gather information |
|
| 446 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
|
| 447 | $note = $this->find($nid); |
|
| 448 | // owner is allowed to change everything |
|
| 449 | if ($uid === $note->getUid()) { |
|
| 450 | return true; |
|
| 451 | } |
|
| 452 | ||
| 453 | // check share permissions |
|
| 454 | $shared_note = \OCP\Share::getItemSharedWith('ownnote', $nid, 'populated_shares')[0]; |
|
| 455 | return $shared_note['permissions'] & $permission; |
|
| 456 | } |
|
| 457 | } |
|
| 458 | ||