Bugfixes for Kimai 1.4.1 (#1158)
* fix missing translation for preset datatable headers * better dependency check for avatar service * show only own teams to teamleads
This commit is contained in:
@@ -48,11 +48,8 @@ class DoctorController extends AbstractController
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $projectDirectory;
|
||||
private $projectDirectory;
|
||||
|
||||
/**
|
||||
* @param string $projectDirectory
|
||||
*/
|
||||
public function __construct(string $projectDirectory)
|
||||
{
|
||||
$this->projectDirectory = $projectDirectory;
|
||||
@@ -92,6 +89,12 @@ class DoctorController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
$results['Freetype Support'] = true;
|
||||
// @see AvatarService::hasDependencies()
|
||||
if (!function_exists('imagettfbbox')) {
|
||||
$results['Freetype Support'] = false;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class TeamController extends AbstractController
|
||||
{
|
||||
$query = new TeamQuery();
|
||||
$query->setPage($page);
|
||||
$query->setCurrentUser($this->getUser());
|
||||
|
||||
$form = $this->getToolbarForm($query);
|
||||
$form->setData($query);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace App\Repository;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Loader\TeamLoader;
|
||||
use App\Repository\Paginator\LoaderPaginator;
|
||||
use App\Repository\Paginator\PaginatorInterface;
|
||||
@@ -128,6 +129,27 @@ class TeamRepository extends EntityRepository
|
||||
$qb->setParameter('likeContains', '%' . $query->getSearchTerm() . '%');
|
||||
}
|
||||
|
||||
$this->addPermissionCriteria($qb, $query->getCurrentUser(), $query->getTeams());
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
private function addPermissionCriteria(QueryBuilder $qb, ?User $user = null, array $teams = [])
|
||||
{
|
||||
// make sure that all queries without a user see all user
|
||||
if (null === $user && empty($teams)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure that admins see all user
|
||||
if (null !== $user && ($user->isSuperAdmin() || $user->isAdmin())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null !== $user) {
|
||||
$qb
|
||||
->andWhere('t.teamlead = :id')
|
||||
->setParameter('id', $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class AvatarService
|
||||
|
||||
public function generateAvatar(User $profile, bool $regenerate = false): bool
|
||||
{
|
||||
if (!extension_loaded('gd')) {
|
||||
if (!$this->hasDependencies()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -152,4 +152,9 @@ class AvatarService
|
||||
|
||||
return $this->getAvatarUrl($profile);
|
||||
}
|
||||
|
||||
public function hasDependencies(): bool
|
||||
{
|
||||
return extension_loaded('gd') && function_exists('imagettfbbox');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
{% if not headerOptions is iterable %}
|
||||
{% set headerOptions = {'class': headerOptions} %}
|
||||
{% endif %}
|
||||
{% set headerTitle = ('label.' ~ title)|trans %}
|
||||
{% if headerOptions.title is defined %}
|
||||
{% set headerTitle = headerOptions.title %}
|
||||
{% else %}
|
||||
{% set headerTitle = ('label.' ~ title)|trans %}
|
||||
{% endif %}
|
||||
{% if 'alwaysVisible' not in headerOptions.class %}
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user