Add ORPHAN_VISITS_EXCLUDED API key role

This commit is contained in:
Alejandro Celaya
2023-05-30 09:12:46 +02:00
parent 112b54ec7d
commit 8b03532ddb
11 changed files with 54 additions and 23 deletions

View File

@@ -79,6 +79,7 @@ class DomainRepository extends EntitySpecificationRepository implements DomainRe
yield from $apiKey?->mapRoles(fn (Role $role, array $meta) => match ($role) {
Role::DOMAIN_SPECIFIC => ['d', new IsDomain(Role::domainIdFromMeta($meta))],
Role::AUTHORED_SHORT_URLS => ['s', new BelongsToApiKey($apiKey)],
default => null,
}) ?? [];
}
}

View File

@@ -56,6 +56,7 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
Role::AUTHORED_SHORT_URLS => $qb->andWhere(
$qb->expr()->eq('s.author_api_key_id', $conn->quote($apiKey->getId())),
),
default => $qb,
});
// For admins and when no API key is present, we'll return tags which are not linked to any short URL