Release 2.0.8 (#3914)

* support parsing negative durations in JS
* bump luxon dependency
* make sure that 2FA is not required for session based API calls
* show name of items to delete
* fix permission issue for recent activity items
This commit is contained in:
Kevin Papst
2023-03-13 01:48:53 +01:00
committed by GitHub
parent 1310285133
commit 8449eafcb6
20 changed files with 92 additions and 50 deletions

View File

@@ -358,7 +358,9 @@ class TimesheetRepository extends EntityRepository
*
* Should a teamlead:
* 1. see all records of his team-members, even if they recorded times for projects invisible to him
* 2. only see records for projects which can be accessed by hom (current situation)
* 2. only see records for projects which can be accessed by him (current situation)
*
* @param array<Team> $teams
*/
private function addPermissionCriteria(QueryBuilder $qb, ?User $user = null, array $teams = []): bool
{
@@ -637,6 +639,7 @@ class TimesheetRepository extends EntityRepository
public function getRecentActivities(User $user, DateTime $startFrom = null, int $limit = 10): array
{
return $this->findTimesheetsById(
$user,
$this->getRecentActivityIds($user, $startFrom, $limit)
);
}
@@ -653,13 +656,11 @@ class TimesheetRepository extends EntityRepository
// do NOT join the customer and do NOT check the customer visibility, as this
// will dramatically increase the speed of this (otherwise slow) query
// ->join('p.customer', 'c')
// ->andWhere($qb->expr()->eq('c.visible', ':visible'))
// you might want to join activity and project to check their visibility
// but for now this is way slower than simply fetching more items
//
// ->join('t.project', 'p')
// ->andWhere($qb->expr()->eq('p.visible', ':visible'))
// ->join('t.activity', 'a')
// ->andWhere($qb->expr()->eq('a.visible', ':visible'))
@@ -680,6 +681,11 @@ class TimesheetRepository extends EntityRepository
->setParameter('begin', $startFrom);
}
$qb->join('t.project', 'p');
$qb->join('p.customer', 'c');
$this->addPermissionCriteria($qb, $user);
$results = $qb->getQuery()->getScalarResult();
if (empty($results)) {
@@ -690,10 +696,13 @@ class TimesheetRepository extends EntityRepository
}
/**
* @param User $user
* @param array<int> $ids
* @param bool $fullyHydrated
* @param bool $basicHydrated
* @return array<Timesheet>
*/
public function findTimesheetsById(array $ids, bool $fullyHydrated = false, bool $basicHydrated = true): array
public function findTimesheetsById(User $user, array $ids, bool $fullyHydrated = false, bool $basicHydrated = true): array
{
if (\count($ids) === 0) {
return [];
@@ -706,6 +715,11 @@ class TimesheetRepository extends EntityRepository
->orderBy('t.end', 'DESC')
;
$qb->join('t.project', 'p');
$qb->join('p.customer', 'c');
$this->addPermissionCriteria($qb, $user);
return $this->getHydratedResultsByQuery($qb, $fullyHydrated, $basicHydrated);
}