Code Duplication    Length = 13-13 lines in 2 locations

lib/backend.php 1 location

@@ 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
?>

lib/Service/OwnNoteService.php 1 location

@@ 447-459 (lines=13) @@
444
		return $farray;
445
	}
446
447
	private function checkPermissions($permission, $nid) {
448
		// gather information
449
		$uid = \OC::$server->getUserSession()->getUser()->getUID();
450
		$note = $this->find($nid);
451
		// owner is allowed to change everything
452
		if ($uid === $note->getUid()) {
453
			return true;
454
		}
455
456
		// check share permissions
457
		$shared_note = \OCP\Share::getItemSharedWith('ownnote', $nid, 'populated_shares')[0];
458
		return $shared_note['permissions'] & $permission;
459
	}
460
}
461