diff --git a/src/Oro/Bridge/CalendarCRM/Migrations/Data/Demo/ORM/LoadUsersCalendarData.php b/src/Oro/Bridge/CalendarCRM/Migrations/Data/Demo/ORM/LoadUsersCalendarData.php index ff4211bd2bf..6736b4c11f4 100644 --- a/src/Oro/Bridge/CalendarCRM/Migrations/Data/Demo/ORM/LoadUsersCalendarData.php +++ b/src/Oro/Bridge/CalendarCRM/Migrations/Data/Demo/ORM/LoadUsersCalendarData.php @@ -188,7 +188,13 @@ protected function connectCalendars() { // first user is admin, often /** @var \Oro\Bundle\UserBundle\Entity\User $admin */ - $admin = $this->user->find(1); + $admin = $this->em->getRepository('OroUserBundle:User') + ->createQueryBuilder('u') + ->select('u') + ->orderBy('u.id') + ->getQuery() + ->setMaxResults(1) + ->getSingleResult(); /** @var Calendar $calendarAdmin */ $calendarAdmin = $this->calendar->findDefaultCalendar($admin->getId(), $admin->getOrganization()->getId()); diff --git a/src/Oro/Bundle/DemoDataBundle/Migrations/Data/Demo/ORM/LoadTagsData.php b/src/Oro/Bundle/DemoDataBundle/Migrations/Data/Demo/ORM/LoadTagsData.php index 97f0a7c8f62..5bc86ca8d19 100644 --- a/src/Oro/Bundle/DemoDataBundle/Migrations/Data/Demo/ORM/LoadTagsData.php +++ b/src/Oro/Bundle/DemoDataBundle/Migrations/Data/Demo/ORM/LoadTagsData.php @@ -99,7 +99,13 @@ protected function initSupportingEntities(ObjectManager $manager = null) $this->organization = $this->getReference('default_organization'); /** @var User $adminUser */ - $adminUser = $this->em->getRepository('OroUserBundle:User')->find(1); + $adminUser = $this->em->getRepository('OroUserBundle:User') + ->createQueryBuilder('u') + ->select('u') + ->orderBy('u.id') + ->getQuery() + ->setMaxResults(1) + ->getSingleResult(); $token = new UsernamePasswordOrganizationToken( $adminUser, $adminUser->getUsername(), diff --git a/src/Oro/Bundle/DemoDataBundle/Migrations/Data/ORM/UpdateEmailAccessLevels.php b/src/Oro/Bundle/DemoDataBundle/Migrations/Data/ORM/UpdateEmailAccessLevels.php index 4778bfaecae..65c8d7f0f86 100644 --- a/src/Oro/Bundle/DemoDataBundle/Migrations/Data/ORM/UpdateEmailAccessLevels.php +++ b/src/Oro/Bundle/DemoDataBundle/Migrations/Data/ORM/UpdateEmailAccessLevels.php @@ -65,17 +65,19 @@ protected function updateUserRole(AclManager $manager) 'ROLE_MARKETING_MANAGER', 'ROLE_LEADS_DEVELOPMENT_REP', ]; + $oid = $manager->getOid('entity:Oro\Bundle\EmailBundle\Entity\EmailUser'); + foreach ($roles as $roleName) { $role = $this->getRole($roleName); if ($role) { $sid = $manager->getSid($role); - - $oid = $manager->getOid('entity:Oro\Bundle\EmailBundle\Entity\EmailUser'); - $maskBuilder = $manager->getMaskBuilder($oid) - ->add('VIEW_BASIC') - ->add('CREATE_BASIC') - ->add('EDIT_BASIC'); - $manager->setPermission($sid, $oid, $maskBuilder->get()); + $mask = 0; + foreach (['VIEW', 'CREATE', 'EDIT'] as $permission) { + $maskBuilder = $manager->getMaskBuilder($oid, $permission); + $maskBuilder->add($permission . '_BASIC'); + $mask |= $maskBuilder->get(); + } + $manager->setPermission($sid, $oid, $mask); } } }