/** * Returns true if a user is in any of a form's form groups, false if not. * * @param Form $form * @return bool */ public function inAFormGroup(Form $form) { if ($this->admin) { return true; } if ($this->isProjectAdmin(ProjectController::getProject($form->pid))) { return true; } $formGroups = $form->groups()->get(); foreach ($formGroups as $formGroup) { if ($formGroup->hasUser($this)) { return true; } } return false; }