With a fresh installation of Vanilo 3.1, the superuser can't access admin panel. Some troubleshooting revealed it's likely not authorized properly. Here's the story:
After following the standard installation steps from
https://vanilo.io/docs/3.x/installation
https://vanilo.io/docs/3.x/admin-installation
I create a superuser successfully, but don't have access to the admin dashboard.
Some troubleshooting I did
php artisan tinker \App\Models\User::find(1)->can('edit products'); = false
user with id 1 is the superuser and the role is properly assigned in DB, role permissions are also properly assigned in DB.
Decided to test an old Vanilo 3.0 project I have where the issue is not present.
Then attached the new Vanilo 3.1 project to the old one's DB to test permissions, because they work there.
php artisan tinker \App\Models\User::find(2)->can('edit products'); = false
User with ID 2 is the superuser on the old project.
The new installation's test returned false, indicating the admin user there wasnt properly authorized, keeping in mind that the old project would authorize the same user successfully.
Here is my concord.php, user.php and appservice provider.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->app->concord->registerModel(\Konekt\User\Contracts\User::class, \App\Models\User::class);
}
}
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends \Konekt\AppShell\Models\User
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
<?php
return [
'modules' => [
Vanilo\Foundation\Providers\ModuleServiceProvider::class => [
// Currency settings
'currency' => [
'format' => '%1$g%2$s',
'code' => 'BGN',
'sign' => 'лв.',
],
// product images size variants
'image' => [
'product' => [
'variants' => [
'thumbnail' => [
'width' => 450,
'height' => 270,
'fit' => 'crop'
],
'medium' => [
'width' => 900,
'height' => 540,
'fit' => 'crop'
]
]
]
],
],
Konekt\AppShell\Providers\ModuleServiceProvider::class => [
'ui' => [
'name' => 'Shop Admin', // Your app's name to display on admin
'url' => '/admin/product', // Base/Home URL after login (eg. dashboard)
],
],
Vanilo\Admin\Providers\ModuleServiceProvider::class,
],
'register_route_models' => true,
];