[Flow] How to find all accounts for given role?

Christian Loock chl at vkf-renzel.de
Tue Aug 19 08:12:38 CEST 2014


Here something that might work (untested). In your accountrepository:

public function findByRoles(array $roles) {
     $query = $this->createQuery();
     return $query->matching(
         $query->contains("roles", $roles)
     )->execute();
}


On 19.08.2014 07:19, Max Mustermann wrote:
> Hi,
>
> i'm using the account repository to handle authentication out of the box.
> Additionally i want that higher privileged accounts can modify lower 
> privileged.
> The privileges are reflected by the Role-Tree configured in Policy.yaml.
>
> Now i want to present an account with, e.g. Admin role, all accounts 
> with lower privileges.
> Gathering the relevant roles is not the problem, but
> given a specific role, e.g. Customer, how can i query a list of all 
> accounts having this role set?
> One obvious option would be to use
> $accountRepository->findAll();
> and drop not needed accounts - kinda boring this way.
>
> So, how can i query all accounts for given role?
>
> thanks for any hint
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow

-- 
Christian Loock
Web Developer
Renzel Agentur
www.renzel-agentur.de



More information about the Flow mailing list