Example #1
0
 /**
  * Get a form for adding an admin to a show.
  *
  * @param $identifier
  */
 public function editAdminAction($identifier)
 {
     $show = $this->getEntity($identifier);
     $this->get('camdram.security.acl.helper')->ensureGranted('EDIT', $show);
     $ace = new PendingAccess();
     $ace->setRid($show->getId());
     $ace->setType('show');
     $ace->setIssuer($this->getUser());
     $form = $this->createForm(new PendingAccessType(), $ace, array('action' => $this->generateUrl('post_show_admin', array('identifier' => $identifier))));
     $em = $this->getDoctrine()->getManager();
     $admins = $em->getRepository('ActsCamdramSecurityBundle:User')->getEntityOwners($show);
     $requested_admins = $em->getRepository('ActsCamdramSecurityBundle:User')->getRequestedShowAdmins($show);
     $pending_admins = $em->getRepository('ActsCamdramSecurityBundle:PendingAccess')->findByResource($show);
     return $this->view($form, 200)->setData(array('entity' => $show, 'admins' => $admins, 'requested_admins' => $requested_admins, 'pending_admins' => $pending_admins, 'form' => $form->createView()))->setTemplate('ActsCamdramSecurityBundle:PendingAccess:edit.html.twig');
 }
 /**
  * Get a form for adding an admin to an organisation.
  *
  * @param $identifier
  */
 public function editAdminAction($identifier)
 {
     $org = $this->getEntity($identifier);
     $this->get('camdram.security.acl.helper')->ensureGranted('EDIT', $org);
     if ($org->getEntityType() == 'society') {
         $route = 'post_society_admin';
     } else {
         $route = 'post_venue_admin';
     }
     $ace = new PendingAccess();
     $ace->setRid($org->getId());
     $ace->setType($org->getEntityType());
     $ace->setIssuer($this->getUser());
     $form = $this->createForm(new PendingAccessType(), $ace, array('action' => $this->generateUrl($route, array('identifier' => $identifier))));
     $em = $this->getDoctrine()->getManager();
     $admins = $em->getRepository('ActsCamdramSecurityBundle:User')->getEntityOwners($org);
     $pending_admins = $em->getRepository('ActsCamdramSecurityBundle:PendingAccess')->findByResource($org);
     return $this->view($form, 200)->setData(array('entity' => $org, 'admins' => $admins, 'pending_admins' => $pending_admins, 'form' => $form->createView()))->setTemplate('ActsCamdramSecurityBundle:PendingAccess:edit.html.twig');
 }