Skip to content
Browse files

testing mailing testing mailing

  • Loading branch information...
1 parent f186ebf commit 1cedea116e2209763eb891d187fd462f93e60959 @wodor committed Jan 29, 2012
View
2 app/autoload.php
@@ -30,7 +30,7 @@
'Behat\Mink' => __DIR__ . '/../vendor/behat/mink/src',
'Behat\MinkBundle' => __DIR__ . '/../vendor/bundles',
'Behat\Behat' => __DIR__ . '/../vendor/behat/behat/src',
- // 'Behat\Behat' => __DIR__.'/../vendor/BehatCommonContexts',
+ 'Behat\CommonContexts' => __DIR__ . '/../vendor/BehatCommonContexts',
'Behat\BehatBundle' => __DIR__ . '/../vendor/bundles',
'Behat\SahiClient' => __DIR__ . '/../vendor/behat/sahi/src',
View
2 app/config/config_dev.yml
@@ -24,4 +24,4 @@ assetic:
swiftmailer:
delivery_address: wodorw@gmail.com
- disable_delivery: true
+ disable_delivery: false
View
1 app/config/config_test.yml
@@ -13,6 +13,7 @@ web_profiler:
swiftmailer:
disable_delivery: true
+
mink:
base_url: http://motowypady.tyr/app_test.php
show_cmd: google-chrome %s
View
21 src/WodorNet/MotoTripBundle/Controller/TripSignupController.php
@@ -143,34 +143,37 @@ public function signupListAction(Trip $trip)
*/
public function signupAction(Trip $trip)
{
- $signup = new TripSignup();
+ $tripSignup = new TripSignup();
- $user = $this->get('security.context')->getToken()->getUser();
- $signup->setTrip($trip);
- $signup->setUser($user);
- $signup->setSignupType('join');
+ $user = $this->get('security.context')->getToken()->getUser();
+ $tripSignup->setTrip($trip);
+ $tripSignup->setUser($user);
+ $tripSignup->setSignupType('join');
$request = $this->getRequest();
- $form = $this->createForm(new TripSignupType(), $signup);
+ $form = $this->createForm(new TripSignupType(), $tripSignup);
if ($request->getMethod() === "POST") {
$form->bindRequest($request);
if ($form->isValid()) {
- $signup->setSignupDate(new \DateTime());
+ $tripSignup->setSignupDate(new \DateTime());
$em = $this->getDoctrine()->getEntityManager();
- $em->persist($signup);
+ $em->persist($tripSignup);
$em->flush();
+ $event = new \WodorNet\MotoTripBundle\Event\TripSignupEvent($tripSignup);
+ $this->get('event_dispatcher')->dispatch(\WodorNet\MotoTripBundle\MotoTripEvents::onTripSignupCreate, $event);
+
return $this->redirect($this->generateUrl('trip_show', array('id' => $trip->getId())));
}
}
return array(
- 'entity' => $signup,
+ 'entity' => $tripSignup,
'form' => $form->createView()
);
}
View
2 src/WodorNet/MotoTripBundle/Entity/TripSignup.php
@@ -41,7 +41,7 @@ class TripSignup implements OwnerAware
*
* @ORM\Column(name="signupType", type="string", length=255)
*/
- private $signupType;
+ private $signupType = 'join';
/**
* @var object $trip
View
35 src/WodorNet/MotoTripBundle/Entity/TripSignupRepository.php
@@ -3,7 +3,9 @@
namespace WodorNet\MotoTripBundle\Entity;
use Doctrine\ORM\EntityRepository,
- WodorNet\MotoTripBundle\Entity\Trip;
+WodorNet\MotoTripBundle\Entity\Trip,
+WodorNet\MotoTripBundle\Entity\User;
+
/**
* TripSignupRepository
*
@@ -14,7 +16,8 @@ class TripSignupRepository extends EntityRepository
{
- private function findByTrip(Trip $trip){
+ private function findByTrip(Trip $trip)
+ {
$qb = $this->createQueryBuilder('ts');
@@ -23,7 +26,7 @@ private function findByTrip(Trip $trip){
$qb->expr()->eq('ts.trip', ':trip')
);
- $qb->add('where', $where);
+ $qb->add('where', $where);
$qb->add('orderBy', "ts.signupDate asc");
@@ -33,21 +36,41 @@ private function findByTrip(Trip $trip){
}
- public function findCandidatesByTrip(Trip $trip) {
+ public function findCandidatesByTrip(Trip $trip)
+ {
$qb = $this->findByTrip($trip);
$qb->setParameter('status', 'new');
return $qb;
}
- public function findApprovedByTrip(Trip $trip) {
+ public function findApprovedByTrip(Trip $trip)
+ {
$qb = $this->findByTrip($trip);
$qb->setParameter('status', 'approved');
return $qb;
-
}
+ /**
+ * Finds signup to $trip by $user
+ */
+ public function getByTripAndUser(Trip $trip, User $user)
+ {
+ $qb = $this->createQueryBuilder('ts');
+
+ $where = $qb->expr()->andx(
+ $qb->expr()->eq('ts.trip', ':trip'),
+ $qb->expr()->eq('ts.user', ':user')
+ );
+
+ $qb->add('where', $where);
+
+ $qb->setParameter('trip', $trip);
+ $qb->setParameter('user', $user);
+
+ return current($qb->getQuery()->getResult());
+ }
}
View
33 src/WodorNet/MotoTripBundle/Features/Context/AclContext.php
@@ -5,7 +5,6 @@
use Behat\BehatBundle\Context\BehatContext;
use Symfony\Bundle\SecurityBundle\Command\InitAclCommand;
use Symfony\Component\Console\Input\ArrayInput;
-use Symfony\Component\Security\Acl\Permission\MaskBuilder;
/**
* Feature context.
@@ -44,6 +43,38 @@ public function iHavePermissionForTrip($permission, $tripTitle)
}
/**
+ * @Given /^"([^"]*)" has "([^"]*)" permission for "([^"]*)"$/
+ */
+ public function hasPermissionFor($userName, $permission, $tripTitle)
+ {
+ /** @var $trip \WodorNet\MotoTripBundle\Entity\Trip */
+ $trip = current($this->getEntityManager()->getRepository('WodorNetMotoTripBundle:Trip')->findByTitle($tripTitle));
+
+ if (!$trip instanceof \WodorNet\MotoTripBundle\Entity\Trip) {
+ throw new \InvalidArgumentException('Trip titled "' . $tripTitle . '" does not exist');
+ }
+
+ $candidate = current($this->getEntityManager()->getRepository('WodorNetMotoTripBundle:User')->findByUsername($userName));
+ $securityIdentity = \Symfony\Component\Security\Acl\Domain\UserSecurityIdentity::fromAccount($candidate);
+
+ $mask = constant("\\Symfony\\Component\\Security\\Acl\\Permission\\MaskBuilder::MASK_" . $permission);
+
+ $aclProvider = $this->getContainer()->get('security.acl.provider');
+ foreach ($aclProvider->findAcl($trip->getObjectIdentity(), array($trip->getObjectIdentity()))->getObjectAces() as $entry) {
+ /** @var $entry \Symfony\Component\Security\Acl\Domain\Entry */
+ $granted = $entry->getAcl()->isGranted(array($mask), array($securityIdentity));
+
+ if ($granted) {
+ return true;
+ }
+ }
+
+ throw new \RuntimeException("OWNER of trip $tripTitle is not set properly");
+
+ }
+
+
+ /**
* @param \Behat\Behat\Event\ScenarioEvent|\Behat\Behat\Event\OutlineExampleEvent $event
*
* @BeforeScenario
View
26 src/WodorNet/MotoTripBundle/Features/Context/FeatureContext.php
@@ -4,12 +4,12 @@
namespace WodorNet\MotoTripBundle\Features\Context;
use Behat\BehatBundle\Context\BehatContext,
- Behat\BehatBundle\Context\MinkContext;
+Behat\BehatBundle\Context\MinkContext;
use Behat\Behat\Context\ClosuredContextInterface,
- Behat\Behat\Context\TranslatedContextInterface,
- Behat\Behat\Exception\PendingException;
+Behat\Behat\Context\TranslatedContextInterface,
+Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
- Behat\Gherkin\Node\TableNode;
+Behat\Gherkin\Node\TableNode;
use Behat\Behat\Context\Step;
use WodorNet\MotoTripBundle\Entity;
@@ -26,9 +26,9 @@ public function __construct($kernel)
{
$this->useContext('acl', new \WodorNet\MotoTripBundle\Features\Context\AclContext($kernel));
$this->useContext('symfony_doctrine', new \Behat\CommonContexts\SymfonyDoctrineContext($kernel));
- $this->useContext('web_extra', new \Behat\CommonContexts\WebExtraContext($kernel));
- $this->useContext('symfony_extra', new \Behat\CommonContexts\SymfonyExtraContext($kernel));
- $this->useContext('redirect', new \Behat\CommonContexts\RedirectContext($kernel));
+ $this->useContext('web_extra', new \Behat\CommonContexts\MinkExtraContext($kernel));
+ $this->useContext('symfony_extra', new \Behat\CommonContexts\SymfonyMailerContext($kernel));
+ $this->useContext('redirect', new \Behat\CommonContexts\MinkRedirectContext($kernel));
$this->useContext('trip', new \WodorNet\MotoTripBundle\Features\Context\TripContext($kernel));
parent::__construct($kernel);
}
@@ -70,7 +70,7 @@ public function iClickOnThe($argument1)
/** @var $page \Behat\Mink\Element\DocumentElement */
$page = $this->getSession()->getPage();
- $el = $page->find('css','#map_canvas div div div');
+ $el = $page->find('css', '#map_canvas div div div');
$el->click();
}
@@ -93,15 +93,14 @@ public function iAmLoggedInAsWithPassword($login, $pass)
return array(
new Step\Given('I am "' . $login . '"'),
new Step\When('I go to "/login"'),
- new Step\When('I fill in "Nazwa użytkownika:" with "'.$login.'"'),
- new Step\When('I fill in "Hasło:" with "'.$pass.'"'),
+ new Step\When('I fill in "Nazwa użytkownika:" with "' . $login . '"'),
+ new Step\When('I fill in "Hasło:" with "' . $pass . '"'),
new Step\When('I press "Zaloguj"'),
- // new Step\Then('I should be on "/"'),
+ // new Step\Then('I should be on "/"'),
);
}
-
/**
* Returns entity manager
*
@@ -140,7 +139,8 @@ public function getMyLogin()
return $this->myLogin;
}
- public function getMe() {
+ public function getMe()
+ {
return current($this->getEntityManager()->getRepository('WodorNetMotoTripBundle:User')->findByUsername($this->getMyLogin()));
}
View
41 src/WodorNet/MotoTripBundle/Features/Context/TripContext.php
@@ -36,6 +36,47 @@ public function theSiteHasFollowingTrips(TableNode $table)
}
/**
+ * @Given /^the "([^"]*)" trip has the following signups:$/
+ */
+ public function theTripHasTheFollowingSignups($tripTitle, TableNode $table)
+ {
+
+ $hash = $table->getHash();
+ $em = $this->getEntityManager();
+ echo "\n\n" . $tripTitle;
+ $trip = current($em->getRepository('WodorNetMotoTripBundle:Trip')->findByTitle($tripTitle));
+ foreach ($hash as $row) {
+ $user = current($em->getRepository('WodorNetMotoTripBundle:User')->findByUsername($row['user']));
+ $tripSignup = new \WodorNet\MotoTripBundle\Entity\TripSignup();
+ $tripSignup->setTrip($trip);
+ $tripSignup->setUser($user);
+ $tripSignup->setStatus($row['status']);
+ $tripSignup->setSignupDate(new \DateTime());
+ $tripSignup->setDescription('Mane tekel fares');
+
+ $em->persist($tripSignup);
+
+ }
+ $em->flush();
+ }
+
+ /**
+ * @When /^signup of "([^"]*)" for "([^"]*)" is approved$/
+ */
+ public function signupOfForIsApproved($userName, $tripTitle)
+ {
+ $em = $this->getEntityManager();
+ $candidate = current($em->getRepository('WodorNetMotoTripBundle:User')->findByUsername($userName));
+ $trip = current($em->getRepository('WodorNetMotoTripBundle:Trip')->findByTitle($tripTitle));
+
+ $manager = $this->getContainer()->get('wodor_net_moto_trip.tripsignups');
+
+ $tripSignup = $em->getRepository('WodorNetMotoTripBundle:TripSignup')->getByTripAndUser($trip, $candidate);
+ $manager->approve($tripSignup);
+ }
+
+
+ /**
* @Given /^User "([^"]*)" should be in trip candiates for trip "([^"]*)"$/
*/
public function UserShouldBeInTripCandiatesOf($userName, $tripId)
View
48 src/WodorNet/MotoTripBundle/Features/permissions.feature
@@ -9,32 +9,54 @@ Background:
| Konsumer | 22@222 | wod.orw@gmail.com |
Given the site has following trips:
| creator | title |
- | Kreator | wypad w góry |
+ | Kreator | wypad w góry |
Scenario: Join trip when you're allowed
Given I am logged in as "Konsumer" with "22@222" password
Given I go to "/tripsignup/signup/1"
And I fill in "wodornet_mototripbundle_tripsignuptype[description]" with "Hi I'm beria"
+ When I do not follow redirects
And I press "Wyślij"
- Then I should be on "trip/1/show"
And User "Konsumer" should be in trip candiates for trip "1"
And email with subject "Nowa osoba chce dołączyć do Twojego wypadu" should have been sent to "wodor@wodor.net"
+ When I am redirected
+ Then I should be on "trip/1/show"
+Scenario: When user is not logged he's not allowed to join trip
+ I should not be allowed to go to "/tripsignup/signup/1"
+
+@noweb
+Scenario: As a OwnerOfTheTrip I can approve a Candidate to my trip, to let him became Attendee and see the details.
+ Given the "wypad w góry" trip has the following signups:
+ | user | status |
+ | Konsumer | new |
+ When signup of "Konsumer" for "wypad w góry" is approved
+ And "Konsumer" has "VIEW" permission for "wypad w góry"
+ And email with subject "Kreator zgodził się na Twój udział w wypadzie 'wypad w góry'" should have been sent to "wod.orw@gmail.com"
-Scenario: Creator aquires OwNER permission and edits it
- Given I am "Kreator"
- And I create trip "Mr Kreator's Trip to hell and back"
- Then I have "OWNER" permission for "Mr Kreator's Trip to hell and back" trip
- And I edit trip "Mr Kreator's Trip to hell and back"
- Then I have "OWNER" permission for "Mr Kreator's Trip to hell and back" trip
-Scenario: Candidate obtains VIEW permission after beind approved by owner
- Given I am "Konsumer"
- And I Join trip "wypad w gory"
- And Owner approves "Konsumer" for trip "wypad w gory"
- Then I have "VIEW" permission for "wypad w gory"
+Scenario: As a OwnerOfTheTrip I can see the list of candidates
+ Given the "wypad w góry" trip has the following signups:
+ | user | status |
+ | Konsumer | new |
+ And I am logged in as "Kreator" with "123456" password
+ When I go to "trip/1/show"
+ Then I should see "Konsumer"
+Scenario: As an Attendee i can see private information of the trip
+Scenario: As an Candidate I cannot see private information
+Scenario: As an User (which is not owner of the trip) I cannot see candidates
+
+
+
+@noweb
+Scenario: Creator aquires OWNER permission and edits it
+ Given I am "Kreator"
+ And I create trip "Mr Kreator's Trip to hell and back"
+ Then I have "OWNER" permission for "Mr Kreator's Trip to hell and back" trip
+ And I edit trip "Mr Kreator's Trip to hell and back"
+ Then I have "OWNER" permission for "Mr Kreator's Trip to hell and back" trip
View
20 src/WodorNet/MotoTripBundle/Mailing/Sender.php
@@ -41,12 +41,12 @@ public function __construct(\Swift_Mailer $mailer, TwigEngine $templating, Trans
*/
public function sendSingnupApprove(TripSignup $tripSignup)
{
-
$message = \Swift_Message::newInstance()
->setSubject($this->translator->trans('mail.subject.trip_signup.approve'))
- ->setFrom('wodor@wodor.net')
- ->setTo($tripSignup->getTrip()->getUser()->getEmail())
- ->setBody($this->templating->render('WodorNetMotoTripBundle:Email:tripSignup.html.twig', array('name' => 'dupa')), 'text/html');
+ ->setFrom($tripSignup->getTrip()->getCreator()->getEmail())
+ ->setReplyTo($tripSignup->getTrip()->getCreator()->getEmail())
+ ->setTo($tripSignup->getUser()->getEmail())
+ ->setBody($this->templating->render('WodorNetMotoTripBundle:Email:tripSignupApprove.html.twig', array('name' => 'dupa')), 'text/html');
return $this->mailer->send($message);
}
@@ -71,4 +71,16 @@ public function sendSingnupReject(TripSignup $tripSignup)
return $this->mailer->send($message);
}
+ public function sendSingnupCreate(TripSignup $tripSignup)
+ {
+ $message = \Swift_Message::newInstance()
+ ->setSubject($this->translator->trans('mail.subject.trip_signup.create'))
+ ->setFrom($tripSignup->getUser()->getEmail())
+ ->setReplyTo($tripSignup->getUser()->getEmail())
+ ->setTo($tripSignup->getTrip()->getCreator()->getEmail())
+ ->setBody($this->templating->render('WodorNetMotoTripBundle:Email:tripSignupCreate.html.twig', array('name' => 'dupa')), 'text/html');
+ return $this->mailer->send($message);
+
+ }
+
}
View
53 src/WodorNet/MotoTripBundle/Mailing/TripSignupsSubscriber.php
@@ -1,5 +1,6 @@
<?php
namespace WodorNet\MotoTripBundle\Mailing;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use WodorNet\MotoTripBundle\Event\TripSignupEvent;
use WodorNet\MotoTripBundle\MotoTripEvents;
use WodorNet\MotoTripBundle\Mailing\Sender;
@@ -10,7 +11,7 @@
* < Stof> wodor: no, subscribers are registered lazily too
* < Stof> well, in 2.1
*/
-class TripSignupsSubscriber implements \Doctrine\Common\EventSubscriber
+class TripSignupsSubscriber implements EventSubscriberInterface
{
/**
* @var \WodorNet\MotoTripBundle\Mailing\Sender
@@ -20,49 +21,31 @@ class TripSignupsSubscriber implements \Doctrine\Common\EventSubscriber
/**
* @param \WodorNet\MotoTripBundle\Mailing\Sender $sender
*/
- public function __construct(\Symfony\Component\DependencyInjection\Container $container)
+ public function __construct(Sender $sender)
{
- //$container->get('wodor_net_moto_trip.mailing.sender');
- // $this->sender = $sender;
+ $this->sender = $sender;
}
- public function getSubscribedEvents()
+ /**
+ * @static
+ * @return array
+ */
+ static public function getSubscribedEvents()
{
- return array('postPersist', 'postUpdate');
+ return array(
+ MotoTripEvents::onTripSignupCreate => 'onTripSignupCreate',
+ MotoTripEvents::onTripSignupApprove => 'onTripSignupApprove',
+ MotoTripEvents::onTripSignupDisapprove => 'onTripSignupDisapprove',
+ MotoTripEvents::onTripSignupReject => 'onTripSignupReject',
+ MotoTripEvents::onTripSignupResign => 'onTripSignupResign',
+ );
}
- public function postPersist(\Doctrine\ORM\Event\LifecycleEventArgs $args)
+ public function onTripSignupCreate(TripSignupEvent $event)
{
- /**
- * @var $tripSignup TripSignup
- */
- $tripSignup = $args->getEntity();
-
- if ($tripSignup instanceof \WodorNet\MotoTripBundle\Entity\TripSignup) {
-
- }
-
+ return $this->sender->sendSingnupCreate($event->getTripSignup());
}
- public function postUpdate(\Doctrine\ORM\Event\LifecycleEventArgs $args)
- {
- echo "XXXXXXDXXXXXXXX";
- }
-
-// /**
-// * @static
-// * @return array
-// */
-// static public function getSubscribedEvents()
-// {
-// return array(
-// MotoTripEvents::onTripSignupApprove => 'onTripSignupApprove',
-// MotoTripEvents::onTripSignupDisapprove => 'onTripSignupDisapprove',
-// MotoTripEvents::onTripSignupReject => 'onTripSignupReject',
-// MotoTripEvents::onTripSignupResign => 'onTripSignupResign',
-// );
-// }
-
/**
* @param \WodorNet\MotoTripBundle\Event\TripSignupEvent $event
*/
View
1 src/WodorNet/MotoTripBundle/MotoTripEvents.php
@@ -9,6 +9,7 @@ class MotoTripEvents
// const onTripSignupCreate = 'tripSignup.create';
+ const onTripSignupCreate = 'tripSignup.create';
const onTripSignupApprove = 'tripSignup.approve';
const onTripSignupDisapprove = 'tripSignup.disapprove';
const onTripSignupReject = 'tripSignup.reject';
View
4 src/WodorNet/MotoTripBundle/Resources/config/events.xml
@@ -8,8 +8,8 @@
<service id="wodor_net_moto_trip.mailing_subscriber_tripsignup"
class="WodorNet\MotoTripBundle\Mailing\TripSignupsSubscriber">
- <tag name="doctrine.event_subscriber" connection="default"/>
- <argument type="service" id="service_container"/>
+ <tag name="wodor_net_moto_trip.subscriber"/>
+ <argument type="service" id="wodor_net_moto_trip.mailing.sender"/>
</service>
<service id="wodor_net_moto_trip.security_subscriber_tripsignup"
View
1 src/WodorNet/MotoTripBundle/Resources/translations/messages.pl.yml
@@ -29,3 +29,4 @@ Bad credentials: "Podane hasło jest niepoprawne"
Logout: Wyloguj
Start at: Początek
End at: Koniec
+mail.subject.trip_signup.create: Nowa osoba chce dołączyć do Twojego wypadu
View
4 src/WodorNet/MotoTripBundle/Resources/views/Email/tripSignup.html.twig
@@ -1,3 +1,5 @@
-<h1>Sedes , {{name}}</h1>
+{% block body %}
+{% endblock %}
+zespół Motowypady.pl
View
7 src/WodorNet/MotoTripBundle/Resources/views/Email/tripSignupApprove.html.twig
@@ -0,0 +1,7 @@
+{% extends 'WodorNetMotoTripBundle:Email:tripSignup.html.twig' %}
+{% block body %}
+<h1>Sedes , {{name}}</h1>
+{% endblock %}
+
+
+
View
6 src/WodorNet/MotoTripBundle/Resources/views/Email/tripSignupCreate.html.twig
@@ -0,0 +1,6 @@
+{% extends 'WodorNetMotoTripBundle:Email:tripSignup.html.twig' %}
+{% block body %}
+<h1>Sedes , {{name}}</h1>
+{% endblock %}
+
+
View
52 src/WodorNet/MotoTripBundle/Security/TripSignupsSubscriber.php
@@ -1,12 +1,19 @@
<?php
namespace WodorNet\MotoTripBundle\Security;
use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
+use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
+use Symfony\Component\Security\Acl\Permission\MaskBuilder;
+
+
+use \Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use \WodorNet\MotoTripBundle\Entity\TripSignup;
+
/**
* Manages Events commited on trip signups
*/
-class TripSignupsSubscriber implements \Doctrine\Common\EventSubscriber {
+class TripSignupsSubscriber implements \Doctrine\Common\EventSubscriber
+{
/**
@@ -30,52 +37,53 @@ public function getSubscribedEvents()
*/
public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
{
+ $tripSignup = $args->getEntity();
/**
* @var $tripSignup \WodorNet\MotoTripBundle\Entity\TripSignup
*/
-// if ($tripSignup instanceof TripSignup) {
-// if ($args->hasChangedField('status')) {
-//
-// $this->onStatusChange($args);
-// }
-// }
+ if ($tripSignup instanceof TripSignup) {
+ if ($args->hasChangedField('status')) {
+
+ $this->onStatusChange($args);
+ }
+ }
}
/**
- * @param \Doctrine\ORM\Event\PreUpdateEventArgs $args
+ * @param \Doctrine\ORM\Event\PreUpdateEventArgs $args
*/
- public function onStatusChange( \Doctrine\ORM\Event\PreUpdateEventArgs $args)
+ public function onStatusChange(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
{
-
- // TODO manage all statuses
-
$tripSignup = $args->getEntity();
// maybe dispatch an tripsignupEvent ?
- $methodName = 'on'.$tripSignup->getStatus().'Status';
- if(method_exists($this, $methodName)) {
+ $methodName = 'on' . $tripSignup->getStatus() . 'Status';
+ if (method_exists($this, $methodName)) {
$this->$methodName($args);
- };
+ }
+ ;
}
- public function onApprovedStatus( \Doctrine\ORM\Event\PreUpdateEventArgs $args) {
+ public function onApprovedStatus(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
+ {
$tripSignup = $args->getEntity();
$trip = $tripSignup->getTrip();
$acl = $this->aclProvider->findAcl(ObjectIdentity::fromDomainObject($trip));
$securityIdentity = UserSecurityIdentity::fromAccount($tripSignup->getUser());
$acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_VIEW);
}
- public function onDissapprovedStatus(\Doctrine\ORM\Event\PreUpdateEventArgs $args) {
+ public function onDissapprovedStatus(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
+ {
// TODO ususniecie uprawnienia
-// $tripSignup = $args->getEntity();
-// $trip = $tripSignup->getTrip();
-// $acl = $this->aclProvider->findAcl(ObjectIdentity::fromDomainObject($trip));
-// $securityIdentity = UserSecurityIdentity::fromAccount($tripSignup->getUser());
-// $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_VIEW);
+ // $tripSignup = $args->getEntity();
+ // $trip = $tripSignup->getTrip();
+ // $acl = $this->aclProvider->findAcl(ObjectIdentity::fromDomainObject($trip));
+ // $securityIdentity = UserSecurityIdentity::fromAccount($tripSignup->getUser());
+ // $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_VIEW);
}
//public function

0 comments on commit 1cedea1

Please sign in to comment.
Something went wrong with that request. Please try again.