mirror of
https://github.com/JanGross/quicknotes.git
synced 2026-01-17 03:07:16 +01:00
Remove unused code..
This commit is contained in:
@@ -389,88 +389,4 @@ class NoteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
*/
|
|
||||||
public function getUserGroupsAndUsersWithShare($userId, $noteId) {
|
|
||||||
$userMgr = \OC::$server->getUserManager();
|
|
||||||
$grpMgr = \OC::$server->getGroupManager();
|
|
||||||
$users = array();
|
|
||||||
$groups = array();
|
|
||||||
if($grpMgr->isAdmin($userId)) {
|
|
||||||
$igroups = $grpMgr->search("");
|
|
||||||
$iusers = $userMgr->search("");
|
|
||||||
foreach($igroups as $g) {
|
|
||||||
$groups[] = $g->getGID();
|
|
||||||
}
|
|
||||||
foreach($iusers as $u) {
|
|
||||||
$users[] = $u->getUID();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$igroups = $grpMgr->getUserGroups($userMgr->get($userId));
|
|
||||||
foreach($igroups as $g) {
|
|
||||||
$iusers = $g->getUsers();
|
|
||||||
foreach($iusers as $u) {
|
|
||||||
$users[] = $u->getUID();
|
|
||||||
}
|
|
||||||
$groups[] = $g->getGID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$users = array_unique($users);
|
|
||||||
if(($i = array_search($userId, $users)) !== false) {
|
|
||||||
unset($users[$i]);
|
|
||||||
}
|
|
||||||
$pos_users = array();
|
|
||||||
$pos_groups = array();
|
|
||||||
$shares = $this->noteShareMapper->getSharesForNote($noteId);
|
|
||||||
foreach($shares as $s) {
|
|
||||||
$shareType = $s->getSharedUser();
|
|
||||||
if(strlen($shareType) !== 0) {
|
|
||||||
if(($i = array_search($shareType, $users)) !== false) {
|
|
||||||
unset($users[$i]);
|
|
||||||
$pos_users[] = $shareType;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$shareType = $s->getSharedGroup();
|
|
||||||
if(($i = array_search($shareType, $groups)) !== false) {
|
|
||||||
unset($groups[$i]);
|
|
||||||
$pos_groups[] = $shareType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ['groups' => $groups, 'users' => $users, 'posGroups' => $pos_groups, 'posUsers' => $pos_users];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public function addGroupShare($groupId, $noteId) {
|
|
||||||
$share = new NoteShare();
|
|
||||||
$share->setSharedGroup($groupId);
|
|
||||||
$share->setNoteId($noteId);
|
|
||||||
$this->noteShareMapper->insert($share);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public function removeGroupShare($groupId, $noteId) {
|
|
||||||
$share = $this->noteShareMapper->findByNoteAndGroup($noteId, $groupId);
|
|
||||||
$this->noteShareMapper->delete($share);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public function addUserShare($userId, $noteId) {
|
|
||||||
$share = new NoteShare();
|
|
||||||
$share->setSharedUser($userId);
|
|
||||||
$share->setNoteId($noteId);
|
|
||||||
$this->noteShareMapper->insert($share);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public function removeUserShare($userId, $noteId) {
|
|
||||||
$share = $this->noteShareMapper->findByNoteAndUser($noteId, $userId);
|
|
||||||
$this->noteShareMapper->delete($share);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user