Skip to content

Commit

Permalink
better error message when trying to generate a migration for the crea…
Browse files Browse the repository at this point in the history
…tion of a Role fails
  • Loading branch information
gggeek committed Nov 11, 2017
1 parent 91c2e2c commit a9c4cbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Core/Executor/RepositoryExecutor.php
Expand Up @@ -135,13 +135,17 @@ protected function getUserContentType($step)
return isset($step->dsl['user_content_type']) ? $step->dsl['user_content_type'] : $this->getUserContentTypeFromContext($step->context);
}

/**
* @param array $context
* @return string
*/
protected function getUserContentTypeFromContext($context)
{
return isset($context['userContentType']) ? $context['userContentType'] : self::USER_CONTENT_TYPE;
}

/**
* @param $context we have to return FALSE if that is set as adminUserLogin, whereas if NULL is set, we return the default admin
* @param array $context we have to return FALSE if that is set as adminUserLogin, whereas if NULL is set, we return the default admin
* @return int|string|false
*/
protected function getAdminUserIdentifierFromContext($context)
Expand Down
3 changes: 3 additions & 0 deletions Core/Executor/RoleManager.php
Expand Up @@ -246,6 +246,9 @@ public function generateMigration(array $matchCondition, $mode, array $context =
$limitations = array();

foreach ($policy->getLimitations() as $limitation) {
if ($limitation === null) {
throw new \Exception("The role contains NULL as limitation for policy {$policy->module}/{$policy->function}, we can not reliably generate its definition.");
}
$limitations[] = $this->limitationConverter->getLimitationArrayWithIdentifiers($limitation);
}

Expand Down
3 changes: 3 additions & 0 deletions WHATSNEW.md
Expand Up @@ -13,6 +13,9 @@ Version 4.4 (unreleased)
* New: support the value '*' for the `remove_attributes` parameter in ContentType definitions. This allows to remove all
the attributes which already exist in the ContentType, except for the ones defined in the `attributes` parameter

* Improved: better error message when trying to generate a migration for the creation of a Role which has Policies with
limitations that can not be exported


Version 4.3
===========
Expand Down

0 comments on commit a9c4cbb

Please sign in to comment.