/** * @param CurriculumInventoryReportInterface $report * @param UserInterface $user * @return bool */ protected function isCreateGranted($report, $user) { // Only grant CREATE, permissions to users with at least one of // 'Course Director' and 'Developer' roles. // - and - // the user must be associated with the school owning the report's program // either by its primary school attribute // - or - by WRITE rights for the school // via the permissions system. return $this->userHasRole($user, ['Course Director', 'Developer']) && ($this->schoolsAreIdentical($user->getSchool(), $report->getSchool()) || $this->permissionManager->userHasWritePermissionToSchool($user, $report->getSchool()->getId())); }