From 3fa9752f685e8be2f039d7385d7da56babd2c4af Mon Sep 17 00:00:00 2001 From: megachriz <megachriz@654114.no-reply.drupal.org> Date: Wed, 11 Jun 2014 23:56:09 -0700 Subject: [PATCH] Issue #2175525 by MegaChriz | Max2505: Added User admin is not authorized to create content type. --- plugins/FeedsEntityProcessor.inc | 12 +++++++----- plugins/FeedsNodeProcessor.inc | 11 +++++++++-- tests/feeds_processor_node.test | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/FeedsEntityProcessor.inc b/plugins/FeedsEntityProcessor.inc index e5f924d9..833800f9 100644 --- a/plugins/FeedsEntityProcessor.inc +++ b/plugins/FeedsEntityProcessor.inc @@ -97,13 +97,15 @@ class FeedsEntityProcessor extends FeedsProcessor { } if (!$access) { - $message = 'User %name is not authorized to %op entity %entity.'; - $args = array( + $message = t('The user %name is not authorized to %op entity %entity_type. To import this item, the user "@name" (owner of the item) must be given the permission to @op entity @entity_type.', array( '%name' => $author->name, '%op' => $op, - '%entity' => $this->entityType(), - ); - throw new FeedsAccessException(t($message, $args)); + '%entity_type' => $this->entityType(), + '@name' => $author->name, + '@op' => $op, + '@entity_type' => $this->entityType(), + )); + throw new FeedsAccessException($message); } } } diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index 203685aa..8b63c533 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -104,8 +104,15 @@ class FeedsNodeProcessor extends FeedsProcessor { } if (!$access) { - $message = 'User %name is not authorized to %op content type %content_type.'; - throw new FeedsAccessException(t($message, array('%name' => $author->name, '%op' => $op, '%content_type' => $entity->type))); + $message = t('The user %name is not authorized to %op content of type %content_type. To import this item, either the user "@name" (author of the item) must be given the permission to @op content of type @content_type, or the option "Authorize" on the Node processor settings must be turned off.', array( + '%name' => $author->name, + '%op' => $op, + '%content_type' => $entity->type, + '@name' => $author->name, + '@op' => $op, + '@content_type' => $entity->type, + )); + throw new FeedsAccessException($message); } } } diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test index cc514b8c..fb5491fe 100644 --- a/tests/feeds_processor_node.test +++ b/tests/feeds_processor_node.test @@ -437,7 +437,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $nid = $this->createFeedNode(); $this->assertText('Failed importing 10 nodes.'); - $this->assertText('User ' . $account->name . ' is not authorized to create content type article.'); + $this->assertText('The user ' . $account->name . ' is not authorized to create content of type article.'); $node_count = db_query("SELECT COUNT(*) FROM {node}")->fetchField(); // We should have 1 node, the feed node. -- GitLab