Implement voting for editor permissions (draft)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Collector;
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -18,6 +19,16 @@ class CollectorRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, Collector::class);
|
||||
}
|
||||
|
||||
public function hasCreatorEditor(string $creator): bool
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$repo = $em->getRepository(User::class);
|
||||
|
||||
$creator = $repo->findOneBy(['username' => $creator]);
|
||||
|
||||
return in_array('ROLE_EDITOR', $creator->getRoles());
|
||||
}
|
||||
|
||||
public function findAllByBibliography(int $biblioId): ?ArrayCollection
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
|
||||
Reference in New Issue
Block a user