moacode / craft-fab-permissions

Restrict access to fields and tabs for particular user groups across your Craft elements.
Other
16 stars 9 forks source link

Error: Call to a member function isInGroup() on null when assigning permission to Field #7

Closed godwinajit closed 5 years ago

godwinajit commented 5 years ago

Call to a member function isInGroup() on null when assigning permission to Field tried this with multiple field types.

PHP version 7.3.6 OS version WINNT 10.0 Database driver & version MySQL 5.5.5 Image driver & version GD 7.3.6 Craft edition & version Craft Pro 3.2.9 Yii version 2.0.21 Field and Tab Permissions | 1.1.3 Error Log below:

2019-09-10 14:11:12 [-][-][-][error][Error] Error: Call to a member function isInGroup() on null in \vendor\thejoshsmith\craft-fab-permissions\src\services\Fab.php:114 Stack trace:

0 \vendor\thejoshsmith\craft-fab-permissions\src\services\Fields.php(32): thejoshsmith\fabpermissions\services\Fab->canViewField(1, Object(craft\fields\Lightswitch), Object(craft\web\User))

1 \vendor\craftcms\cms\src\models\FieldLayout.php(171): thejoshsmith\fabpermissions\services\Fields->getFieldsByLayoutId(1)

2 \vendor\nystudio107\craft-seomatic\src\helpers\Field.php(122): craft\models\FieldLayout->getFields()

3 \vendor\nystudio107\craft-seomatic\src\helpers\Field.php(160): nystudio107\seomatic\helpers\Field::fieldsOfTypeFromLayout('seo', Object(craft\models\FieldLayout), true)

4 \vendor\nystudio107\craft-seomatic\src\services\MetaContainers.php(772): nystudio107\seomatic\helpers\Field::fieldsOfTypeFromElement(Object(craft\elements\Entry), 'seo', true)

5 \vendor\nystudio107\craft-seomatic\src\services\MetaContainers.php(214): nystudio107\seomatic\services\MetaContainers->loadFieldMetaContainers()

6 [internal function]: nystudio107\seomatic\services\MetaContainers->nystudio107\seomatic\services{closure}(Object(yii\caching\FileCache))

7 \vendor\yiisoft\yii2\caching\Cache.php(597): call_user_func(Object(Closure), Object(yii\caching\FileCache))

8 \vendor\nystudio107\craft-seomatic\src\services\MetaContainers.php(206): yii\caching\Cache->getOrSet('seomatic_metaco...', Object(Closure), 30, Object(yii\caching\TagDependency))

9 \vendor\nystudio107\craft-seomatic\src\twigextensions\SeomaticTwigExtension.php(53): nystudio107\seomatic\services\MetaContainers->loadMetaContainers('', '1')

10 \vendor\twig\twig\src\ExtensionSet.php(329): nystudio107\seomatic\twigextensions\SeomaticTwigExtension->getGlobals()

11 \vendor\twig\twig\src\Environment.php(928): Twig\ExtensionSet->getGlobals()

12 \vendor\twig\twig\src\Environment.php(948): Twig\Environment->getGlobals()

13 \vendor\twig\twig\src\Template.php(380): Twig\Environment->mergeGlobals(Array)

14 \vendor\craftcms\cms\src\web\twig\Template.php(34): Twig\Template->display(Array, Array)

15 \vendor\twig\twig\src\Template.php(392): craft\web\twig\Template->display(Array)

16 \vendor\twig\twig\src\TemplateWrapper.php(45): Twig\Template->render(Array, Array)

17 \vendor\twig\twig\src\Environment.php(318): Twig\TemplateWrapper->render(Array)

18 \vendor\craftcms\cms\src\web\View.php(344): Twig\Environment->render('index.html', Array)

19 \vendor\craftcms\cms\src\web\View.php(394): craft\web\View->renderTemplate('index.html', Array)

20 \vendor\craftcms\cms\src\web\Controller.php(243): craft\web\View->renderPageTemplate('index.html', Array)

21 \vendor\craftcms\cms\src\controllers\TemplatesController.php(95): craft\web\Controller->renderTemplate('index.html', Array)

22 [internal function]: craft\controllers\TemplatesController->actionRender('index.html', Array)

23 \vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)

24 \vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)

25 \vendor\craftcms\cms\src\web\Controller.php(187): yii\base\Controller->runAction('render', Array)

26 \vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller->runAction('render', Array)

27 \vendor\craftcms\cms\src\web\Application.php(299): yii\base\Module->runAction('templates/rende...', Array)

28 \vendor\yiisoft\yii2\web\Application.php(103): craft\web\Application->runAction('templates/rende...', Array)

29 \vendor\craftcms\cms\src\web\Application.php(284): yii\web\Application->handleRequest(Object(craft\web\Request))

30 \vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))

31 \web\index.php(21): yii\base\Application->run()

32 {main}

moacode commented 5 years ago

Hi @godwinajit, this should now be resolved on 1.1.4 so I'll close this issue. Feel free to open another if you spot anything else.