Closed dennismeissner closed 4 years ago
Thanks for reporting, I’ll look into this one tomorrow (nz time). If it can’t be resolved, I’ll see if I can get a refund issued!
On Tue, 3 Dec 2019 at 11:02 PM, dennismeissner notifications@github.com wrote:
When running jobs in background using the config setting: runQueueAutomatically i receive an error upon resaving elements:
Argument 3 passed to thejoshsmith\fabpermissions\services\Fab::canViewField() must be an instance of craft\web\User, instance of craft\console\User given, called in /application/vendor/thejoshsmith/craft-fab-permissions/src/services/Fields.php on line 32
This makes the plugin, i just bought, useless for me at the moment =/
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thejoshsmith/craft-fab-permissions/issues/12?email_source=notifications&email_token=ABKCPK727MH6ASQHMY22V33QWYVBRA5CNFSM4JUVG6R2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5TTSLQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKCPKYRXXG26TQWRDH4QKLQWYVBRANCNFSM4JUVG6RQ .
Thanks for your reply and also thank for the nice work with this plugin.
i think it could be easily fixed by removing the User type in the Method head. the Console User is a component, but they provide the same functions a web user provides. And i checked, that you aren't using anything else which isn't provided by both.
Hi @dennismeissner, unfortunately I'm having a hard time replicating this issue. I'm currently using the following versions of Craft and the plugin:
Craft CMS: 3.3.16.3 Field and Tab Permissions: 1.2.3
I've set runQueueAutomatically
to false in general.php
, and have tried re-saving entries via CLI using ./craft resave/entries
and ./craft queue/run
but this didn't trigger an error.
Could you please give me a little more detail on how you've setup your entry types and how you're running background jobs? Cheers!
hi @thejoshsmith
i am running ./craft queue/listen
in the background for testing purposes.
What i do is, i call Craft::$app->getCache()->flush();
on Elements::EVENT_AFTER_SAVE_ELEMENT
The queue starts and fails instantly with this error message:
Argument 3 passed to thejoshsmith\fabpermissions\services\Fab::canViewField() must be an instance of craft\web\User, instance of craft\console\User given, called in /application/vendor/thejoshsmith/craft-fab-permissions/src/services/Fields.php on line 32
I tried setting no permissions on any element and also setting a few permissions. Nothing worked using the workflow described above.
if i manually replace this:
public function canViewTab(FieldLayoutTab $tab, User $user, $currentSite = null)
by this:
public function canViewTab(FieldLayoutTab $tab, $user, $currentSite = null)
it works.
Hi @dennismeissner, I'd like to retain the type hinted User $user
argument as it enforces that a craft\web\User
object is passed. The craft\console\User
varies slightly and there's no interface that guarantees methods exist between the two.
I'm actually thinking you're on an older version of the plugin. Could you please check and make sure you're on version 1.2.3, as I did some work around console requests on version 1.2.2.
hey @thejoshsmith,
there is no release newer than version 1.2.1 under releases. Where can i find version 1.2.3?
🤦♂ looks like I didn't push the tags for the last two versions. Sorry about that!! I've pushed the tags up so they should be under releases now.
@thejoshsmith good news. seems to work now :)
Thanks!
Brilliant, apologies once again for not having those release tags pushed!
When running jobs in background using the config setting:
runQueueAutomatically
i receive an error upon resaving elements:Argument 3 passed to thejoshsmith\fabpermissions\services\Fab::canViewField() must be an instance of craft\web\User, instance of craft\console\User given, called in /application/vendor/thejoshsmith/craft-fab-permissions/src/services/Fields.php on line 32
This makes the plugin, i just bought, useless for me at the moment =/