function childExists($tagId)
 {
     try {
         return $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true);
     } catch (\InvalidArgumentException $e) {
         throw new BadRequest('Invalid tag id', 0, $e);
     } catch (TagNotFoundException $e) {
         return false;
     }
 }
 function childExists($tagId)
 {
     try {
         $result = $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true);
         if ($result) {
             $tags = $this->tagManager->getTagsByIds([$tagId]);
             $tag = current($tags);
             if (!$this->tagManager->canUserSeeTag($tag, $this->user)) {
                 return false;
             }
         }
         return $result;
     } catch (\InvalidArgumentException $e) {
         throw new BadRequest('Invalid tag id', 0, $e);
     } catch (TagNotFoundException $e) {
         return false;
     }
 }
 function childExists($tagId)
 {
     try {
         $result = $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true);
         if ($this->isAdmin || !$result) {
             return $result;
         }
         // verify if user is allowed to see this tag
         $tag = $this->tagManager->getTagsByIds($tagId);
         $tag = current($tag);
         if (!$tag->isUserVisible()) {
             return false;
         }
         return true;
     } catch (\InvalidArgumentException $e) {
         throw new BadRequest('Invalid tag id', 0, $e);
     } catch (TagNotFoundException $e) {
         return false;
     }
 }
Esempio n. 4
0
 /**
  * @expectedException \OCP\SystemTag\TagNotFoundException
  */
 public function testHaveTagNonExisting()
 {
     $this->tagMapper->haveTag([1], 'testtype', 100);
 }