예제 #1
0
 /**
  * Add workspace
  * @Route("", name="add_workspace")
  * @Method({"POST"})
  * @ApiDoc
  */
 public function postWorkspaceAction()
 {
     $data = $this->getRequest()->request;
     $workspace = new Workspace();
     $workspace->setTitle($data->get('title'));
     $em = $this->get('doctrine')->getManager();
     $em->persist($workspace);
     $em->flush();
     // creating the ACL
     $aclProvider = $this->get('security.acl.provider');
     $acl = $aclProvider->createAcl(ObjectIdentity::fromDomainObject($workspace));
     // retrieving the security identity of the currently logged-in user
     $securityContext = $this->get('security.context');
     $securityIdentity = UserSecurityIdentity::fromAccount($securityContext->getToken()->getUser());
     // grant owner access
     $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
     $aclProvider->updateAcl($acl);
     return RouteRedirectView::create('get_workspace', array('id' => $workspace->getId()), HttpCodes::HTTP_CREATED);
 }
예제 #2
0
파일: Widget.php 프로젝트: rommsen/plesynd
 public function setWorkspace(Workspace $workspace)
 {
     $this->workspace = $workspace;
     $this->workspace->addWidget($this);
 }