public function indexAction() {
        $oid = new ObjectIdentity('class', 'FOM\UserBundle\Entity\Group');

        $query = $this->getDoctrine()->getManager()->createQuery('SELECT g FROM FOMUserBundle:Group g');
        $groups = $query->getResult();
        $allowed_groups = array();
        // ACL access check
        foreach($groups as $index => $group) {
            if($this->get('security.authorization_checker')->isGranted('VIEW', $group)) {
                $allowed_groups[] = $group;
            }
        }

        return array(
            'groups' => $allowed_groups,
            'create_permission' => $this->get('security.authorization_checker')->isGranted('CREATE', $oid)
        );
    }