Code Duplication    Length = 12-16 lines in 2 locations

lib/private/Group/Database.php 1 location

@@ 133-148 (lines=16) @@
130
	 *
131
	 * Checks whether the user is member of a group or not.
132
	 */
133
	public function inGroup( $uid, $gid ) {
134
		$this->fixDI();
135
136
		// check
137
		$qb = $this->dbConn->getQueryBuilder();
138
		$cursor = $qb->select('uid')
139
			->from('group_user')
140
			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
141
			->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
142
			->execute();
143
144
		$result = $cursor->fetch();
145
		$cursor->closeCursor();
146
147
		return $result ? true : false;
148
	}
149
150
	/**
151
	 * Add a user to a group

apps/dav/lib/CalDAV/CalDavBackend.php 1 location

@@ 1638-1649 (lines=12) @@
1635
	 * @param \OCA\DAV\CalDAV\Calendar $calendar
1636
	 * @return mixed
1637
	 */
1638
	public function getPublishStatus($calendar) {
1639
		$query = $this->db->getQueryBuilder();
1640
		$result = $query->select('publicuri')
1641
			->from('dav_shares')
1642
			->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
1643
			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
1644
			->execute();
1645
1646
		$row = $result->fetch();
1647
		$result->closeCursor();
1648
		return $row ? reset($row) : false;
1649
	}
1650
1651
	/**
1652
	 * @param int $resourceId