@@ 25-57 (lines=33) @@ | ||
22 | use Surfnet\Stepup\Configuration\Value\Institution; |
|
23 | use Surfnet\StepupMiddleware\ApiBundle\Configuration\Entity\AllowedSecondFactor; |
|
24 | ||
25 | final class AllowedSecondFactorRepository extends EntityRepository |
|
26 | { |
|
27 | public function save(AllowedSecondFactor $allowedSecondFactor) |
|
28 | { |
|
29 | $entityManager = $this->getEntityManager(); |
|
30 | $entityManager->persist($allowedSecondFactor); |
|
31 | $entityManager->flush(); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * @param Institution $institution |
|
36 | * @return AllowedSecondFactor[] |
|
37 | */ |
|
38 | public function getAllowedSecondFactorsFor(Institution $institution) |
|
39 | { |
|
40 | return $this->createQueryBuilder('asf') |
|
41 | ->select() |
|
42 | ->where('asf.institution = :institution') |
|
43 | ->setParameter('institution', $institution->getInstitution()) |
|
44 | ->getQuery() |
|
45 | ->execute(); |
|
46 | } |
|
47 | ||
48 | public function clearAllowedSecondFactorListFor(Institution $institution) |
|
49 | { |
|
50 | $this->createQueryBuilder('asf') |
|
51 | ->delete() |
|
52 | ->where('asf.institution = :institution') |
|
53 | ->setParameter('institution', $institution->getInstitution()) |
|
54 | ->getQuery() |
|
55 | ->execute(); |
|
56 | } |
|
57 | } |
|
58 |
@@ 25-65 (lines=41) @@ | ||
22 | use Surfnet\Stepup\Configuration\Value\Institution; |
|
23 | use Surfnet\StepupMiddleware\ApiBundle\Configuration\Entity\ConfiguredInstitution; |
|
24 | ||
25 | class ConfiguredInstitutionRepository extends EntityRepository |
|
26 | { |
|
27 | /** |
|
28 | * @param ConfiguredInstitution $configuredInstitution |
|
29 | */ |
|
30 | public function save(ConfiguredInstitution $configuredInstitution) |
|
31 | { |
|
32 | $entityManager = $this->getEntityManager(); |
|
33 | $entityManager->persist($configuredInstitution); |
|
34 | $entityManager->flush(); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @param Institution $institution |
|
39 | * @return bool |
|
40 | */ |
|
41 | public function hasConfigurationFor(Institution $institution) |
|
42 | { |
|
43 | $result = $this->createQueryBuilder('ci') |
|
44 | ->select('ci.institution') |
|
45 | ->where('ci.institution = :institution') |
|
46 | ->setParameter('institution', $institution->getInstitution()) |
|
47 | ->getQuery() |
|
48 | ->getOneOrNullResult(); |
|
49 | ||
50 | return $result !== null; |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * @param Institution $institution |
|
55 | */ |
|
56 | public function removeConfigurationFor(Institution $institution) |
|
57 | { |
|
58 | $this->createQueryBuilder('ci') |
|
59 | ->delete() |
|
60 | ->where('ci.institution = :institution') |
|
61 | ->setParameter('institution', $institution->getInstitution()) |
|
62 | ->getQuery() |
|
63 | ->execute(); |
|
64 | } |
|
65 | } |
|
66 |
@@ 27-66 (lines=40) @@ | ||
24 | use Surfnet\Stepup\Configuration\Value\Institution; |
|
25 | use Surfnet\StepupMiddleware\ApiBundle\Configuration\Entity\InstitutionConfigurationOptions; |
|
26 | ||
27 | final class InstitutionConfigurationOptionsRepository extends EntityRepository |
|
28 | { |
|
29 | /** |
|
30 | * @param Institution $institution |
|
31 | * @return InstitutionConfigurationOptions |
|
32 | * @throws NoResultException |
|
33 | * @throws NonUniqueResultException |
|
34 | */ |
|
35 | public function findConfigurationOptionsFor(Institution $institution) |
|
36 | { |
|
37 | return $this->createQueryBuilder('ico') |
|
38 | ->where('ico.institution = :institution') |
|
39 | ->setParameter('institution', $institution->getInstitution()) |
|
40 | ->getQuery() |
|
41 | ->getOneOrNullResult(); |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * @param InstitutionConfigurationOptions $institutionConfigurationOptions |
|
46 | */ |
|
47 | public function save(InstitutionConfigurationOptions $institutionConfigurationOptions) |
|
48 | { |
|
49 | $entityManager = $this->getEntityManager(); |
|
50 | $entityManager->persist($institutionConfigurationOptions); |
|
51 | $entityManager->flush(); |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @param Institution $institution |
|
56 | */ |
|
57 | public function removeConfigurationOptionsFor(Institution $institution) |
|
58 | { |
|
59 | $this->createQueryBuilder('ico') |
|
60 | ->delete() |
|
61 | ->where('ico.institution = :institution') |
|
62 | ->setParameter('institution', $institution->getInstitution()) |
|
63 | ->getQuery() |
|
64 | ->execute(); |
|
65 | } |
|
66 | } |
|
67 |