/** * @param \TYPO3\Flow\Security\Policy\Role $role * @throws \InvalidArgumentException * @return \Ag\Login\Domain\Model\Role $role */ protected function flowRoleToRole($role) { if (strpos($role->__toString(), '|') === FALSE) { return new Role($role->__toString()); } else { $role = explode('|', $role->__toString()); if (count($role) === 2) { return new Role($role[0], $role[1]); } else { throw new \InvalidArgumentException('Could not succesfully parse the Flow role for account ' . $this->login->getAccountIdentifier()); } } }