Closed werner-h closed 3 months ago
Hey @werner-h,
Spatie has known incompatibility with this package
Please see https://github.com/DirectoryTree/LdapRecord-Laravel/issues/150#issuecomment-632943856
Why is there no interest in solving the problem? It does not only seem to lead to problems with Spatie, the Actionable Trait also does not work on Laravel Nova, as it always leads to the error "The LDAP connection [mysql] does not exist".
Update: It seems that I have found a solution at least for Spatie Soft by using the function from https://github.com/serenysoft/nova-permissions:
->resolveModelForGuardUsing(function() {
$guard = config('nova.guard') ?: config('auth.defaults.guard');
$provider = config("auth.guards.{$guard}.provider");
return config("auth.providers.{$provider}.database.model");
})
I also need to use custom Role and Permission Nova Model to overwrite the User Model resolution. Would be awesome if Nova is gonna have a look onto your request: #https://github.com/laravel/nova-issues/discussions/4082
Why is there no interest in solving the problem?
This isn't the case. What you're encountering here are incompatibilities between packages -- not a uni-directional incompatibility with LdapRecord-Laravel itself. And with all due respect, I'm not responsible for how Spatie Permission works or integrates with other packages. I also don't use Spatie Permission, but if you would like to submit a PR that provides that compatibility in a non-BC way, then I'd gladly take a look at getting it merged.
the Actionable Trait also does not work on Laravel Nova, as it always leads to the error "The LDAP connection [mysql] does not exist".
The Actionable
trait cannot be applied to LdapRecord models. It contains an Eloquent relationship method designed only to be used with Eloquent. LdapRecord and Eloquent models are designed to interact with two entirely different technology backends (SQL vs LDAP). These models cannot be used interchangeably.
Environment:
Describe the bug:
I have been experiencing problems with Spatie Permissions v6 and Laravel Nova v4 in connection with the LdapRecord User Model LdapRecord\Models\ActiveDirectory\User::class for the last few days
As soon as the Actionable trait is used, for example, I get the error message:
Spatie Permissions with Sereny Nova Permissions package:
Here the lines from line 101:
The lines from Resource.php
The trait for the resolution:
The helper function from spatie for the resolution:
With regard to the Nova Permissions Package, I can help myself with my own role and permissions model so that I can skip the functions shown above.
But somehow it keeps catching me up with the message "The LDAP connection [mysql] does not exist.".
If I temporarily revert to the Eloquent model, I do not receive any error messages. How can I pass on the Eloquent relevant methods with a custom LDAP user model so that they are resolved correctly?