1: <?php
2:
3: 4: 5:
6:
7: namespace Mapbender\CoreBundle\Controller;
8:
9: use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
11: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
12: use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
13:
14: 15: 16: 17: 18: 19: 20: 21: 22:
23: class WelcomeController extends Controller {
24: 25: 26: 27: 28: 29: 30: 31:
32: public function listAction() {
33: $securityContext = $this->get('security.context');
34: $oid = new ObjectIdentity('class', 'Mapbender\CoreBundle\Entity\Application');
35:
36: $applications = $this->get('mapbender')->getApplicationEntities();
37: $allowed_applications = array();
38: foreach($applications as $application)
39: {
40: if($securityContext->isGranted('VIEW', $application))
41: {
42: if(!$application->isPublished() && !$securityContext->isGranted('EDIT', $application)) {
43: continue;
44: }
45: $allowed_applications[] = $application;
46: }
47: }
48:
49: return array('applications' => $allowed_applications);
50: }
51: }
52:
53: