Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation > The given role or permission should use guard ` instead of web`. #106

Open
ayhanbaris opened this issue Mar 20, 2021 · 31 comments
Assignees

Comments

@ayhanbaris
Copy link

Role name [admin]:

admin

User '[email protected]' has been created (id: 1)

Konekt\Acl\Exceptions\GuardDoesNotMatch

The given role or permission should use guard `` instead of web.

at vendor/konekt/acl/src/Exceptions/GuardDoesNotMatch.php:12
8▕ class GuardDoesNotMatch extends InvalidArgumentException
9▕ {
10▕ public static function create(string $givenGuard, Collection $expectedGuards)
11▕ {
➜ 12▕ return new static("The given role or permission should use guard {$expectedGuards->implode(', ')} instead of {$givenGuard}.");
13▕ }
14▕ }
15▕

  +18 vendor frames

19 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

image

@ayhanbaris
Copy link
Author

image

@fulopattila122
Copy link
Member

Did you do this?

composer require laravel/ui
php artisan ui:auth

https://vanilo.io/docs/2.x/installation#laravel-auth-support

@ayhanbaris
Copy link
Author

yes i did.

@tzdigital
Copy link

tzdigital commented Apr 6, 2021

same problem here :/ have any solutions ? thx

composer.json file :
"require": { "php": "^7.3|^8.0", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.12", "laravel/tinker": "^2.5", "laravel/ui": "^3.2", "vanilo/framework": "^2.1" },

@fulopattila122
Copy link
Member

Could you please paste the output of these commands?

php -v
composer --version
composer show 

Thx!

@ayhanbaris
Copy link
Author

ayhanbaris commented Apr 7, 2021

ayhan@mvk ~ % php -v
PHP 7.4.16 (cli) (built: Mar 4 2021 20:52:51) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

ayhan@mvk ~ % composer --version
Composer version 2.0.8 2020-12-03 17:20:38

ayhan@mvk ~ % composer show
doctrine/inflector 2.0.3 PHP Doctrine Inflector is a small ...
illuminate/console v7.29.3 The Illuminate Console package.
illuminate/contracts v7.29.3 The Illuminate Contracts package.
illuminate/filesystem v7.29.3 The Illuminate Filesystem package.
illuminate/support v7.29.3 The Illuminate Support package.
laravel/ui v2.4.1 Laravel UI utilities and presets.
nesbot/carbon 2.41.5 An API extension for DateTime that...
psr/container 1.0.0 Common Container Interface (PHP FI...
psr/simple-cache 1.0.1 Common interfaces for simple caching
symfony/console v5.1.8 Symfony Console Component
symfony/finder v5.1.8 Symfony Finder Component
symfony/polyfill-ctype v1.20.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme v1.20.0 Symfony polyfill for intl's graphe...
symfony/polyfill-intl-normalizer v1.20.0 Symfony polyfill for intl's Normal...
symfony/polyfill-mbstring v1.20.0 Symfony polyfill for the Mbstring ...
symfony/polyfill-php73 v1.20.0 Symfony polyfill backporting some ...
symfony/polyfill-php80 v1.20.0 Symfony polyfill backporting some ...
symfony/process v5.1.8 Symfony Process Component
symfony/service-contracts v2.2.0 Generic abstractions related to wr...
symfony/string v5.1.8 Symfony String component
symfony/translation v5.1.8 Symfony Translation Component
symfony/translation-contracts v2.3.0 Generic abstractions related to tr...
voku/portable-ascii 1.5.3 Portable ASCII library - performan...

@fulopattila122
Copy link
Member

@ayhanbaris is it the complete list of composer packages? I don't see laravel/framework in the list of packages 🤔

@ayhanbaris
Copy link
Author

ayhan@mvk vaniloapp % composer show
asm89/stack-cors v2.0.3 Cross-origin resource sharing library a...
brick/math 0.9.2 Arbitrary-precision arithmetic library
cocur/slugify v4.0.0 Converts a string into a slug.
cviebrock/eloquent-sluggable 8.0.5 Easy creation of slugs for your Eloquen...
diglactic/laravel-breadcrumbs v6.1.0 A simple Laravel-style way to create br...
dnoegel/php-xdg-base-dir v0.1.1 implementation of xdg base directory sp...
doctrine/cache 1.10.2 PHP Doctrine Cache library is a popular...
doctrine/dbal 2.12.1 Powerful PHP database abstraction layer...
doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple ...
doctrine/inflector 2.0.3 PHP Doctrine Inflector is a small libra...
doctrine/instantiator 1.4.0 A small, lightweight utility to instant...
doctrine/lexer 1.2.1 PHP Doctrine Lexer parser library that ...
dragonmantank/cron-expression v3.1.0 CRON for PHP: Calculate the next or pre...
egulias/email-validator 2.1.25 A library for validating emails against...
facade/flare-client-php 1.4.0 Send PHP errors to Flare
facade/ignition 2.5.14 A beautiful error page for Laravel appl...
facade/ignition-contracts 1.0.2 Solution contracts for Ignition
fakerphp/faker v1.13.0 Faker is a PHP library that generates f...
fideloper/proxy 4.4.1 Set trusted proxies for Laravel
filp/whoops 2.11.0 php error handling for cool kids
fruitcake/laravel-cors v2.0.3 Adds CORS (Cross-Origin Resource Sharin...
graham-campbell/result-type v1.0.1 An Implementation Of The Result Type
guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.4.1 Guzzle promises library
guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also ...
hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers
intervention/image 2.5.1 Image handling and manipulation library...
konekt/acl 1.5.0 Concord Module for Permission handling ...
konekt/address 2.1.0 Laravel module for handling countries, ...
konekt/appshell 2.2.0 Foundation for Laravel business applica...
konekt/concord 1.10.1 Concord is a Laravel Extension for buil...
konekt/customer 2.1.0 Customer handling library for Laravel (...
konekt/enum 3.1.0 SPL inspired PHP enum class implementation
konekt/enum-eloquent 1.7.0 Enum attribute casting for Eloquent models
konekt/gears 1.7.0 Settings and User Preferences library f...
konekt/laravel-migration-compatibility 1.4.1 Library to help migrations to figure ou...
konekt/menu 1.8.2 Menus in Laravel 6 - 8
konekt/user 2.3.0 User handling module for Laravel applic...
laracasts/flash 3.2 Easy flash notifications
laravel/framework v8.33.1 The Laravel Framework.
laravel/sail v1.4.8 Docker files for running a basic Larave...
laravel/tinker v2.6.1 Powerful REPL for the Laravel framework.
laravel/ui v3.2.0 Laravel UI utilities and presets.
laravelcollective/html v6.2.1 HTML and Form Builders for the Laravel ...
league/commonmark 1.5.7 Highly-extensible PHP Markdown parser w...
league/flysystem 1.1.3 Filesystem abstraction: Many filesystem...
league/glide 1.7.0 Wonderfully easy on-demand image manipu...
league/mime-type-detection 1.7.0 Mime-type detection for Flysystem
maennchen/zipstream-php 2.1.0 ZipStream is a library for dynamically ...
mockery/mockery 1.4.3 Mockery is a simple yet flexible PHP mo...
monolog/monolog 2.2.0 Sends your logs to files, sockets, inbo...
myclabs/deep-copy 1.10.2 Create deep copies (clones) of your obj...
myclabs/php-enum 1.8.0 PHP Enum implementation
nesbot/carbon 2.46.0 An API extension for DateTime that supp...
nikic/php-parser v4.10.4 A PHP parser written in PHP
nunomaduro/collision v5.3.0 Cli error handling for console/command-...
opis/closure 3.6.1 A library that can be used to serialize...
phar-io/manifest 2.0.1 Component for reading phar.io manifest ...
phar-io/version 3.1.0 Library for handling version informatio...
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdo...
phpdocumentor/reflection-docblock 5.2.2 With this component, a library can prov...
phpdocumentor/type-resolver 1.4.0 A PSR-5 based resolver of Class names, ...
phpoption/phpoption 1.7.5 Option Type for PHP
phpspec/prophecy 1.13.0 Highly opinionated mocking framework fo...
phpunit/php-code-coverage 9.2.5 Library that provides collection, proce...
phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filt...
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.5.3 The PHP Unit Testing framework.
psr/container 1.1.1 Common Container Interface (PHP FIG PSR...
psr/event-dispatcher 1.0.0 Standard interfaces for event handling.
psr/http-client 1.0.1 Common interface for HTTP clients
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.3 Common interface for logging libraries
psr/simple-cache 1.0.1 Common interfaces for simple caching
psy/psysh v0.10.7 An interactive shell for modern PHP.
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
ramsey/collection 1.1.3 A PHP 7.2+ library for representing and...
ramsey/uuid 4.1.1 A PHP library for generating and workin...
sebastian/cli-parser 1.0.1 Library for parsing CLI options
sebastian/code-unit 1.0.8 Collection of value objects that repres...
sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a lin...
sebastian/comparator 4.0.6 Provides the functionality to compare P...
sebastian/complexity 2.0.2 Library for calculating the complexity ...
sebastian/diff 4.0.4 Diff implementation
sebastian/environment 5.1.3 Provides functionality to handle HHVM/P...
sebastian/exporter 4.0.3 Provides the functionality to export PH...
sebastian/global-state 5.0.2 Snapshotting of global state
sebastian/lines-of-code 1.0.3 Library for counting the lines of code ...
sebastian/object-enumerator 4.0.4 Traverses array structures and object g...
sebastian/object-reflector 2.0.4 Allows reflection of object attributes,...
sebastian/recursion-context 4.0.4 Provides functionality to recursively p...
sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functio...
sebastian/type 2.3.1 Collection of value objects that repres...
sebastian/version 3.0.2 Library that helps with managing the ve...
spatie/image 1.10.4 Manipulate images with an expressive API
spatie/image-optimizer 1.3.2 Easily optimize images using PHP
spatie/laravel-medialibrary 9.4.4 Associate files with Eloquent models
spatie/temporary-directory 1.3.0 Easily create, use and destroy temporar...
swiftmailer/swiftmailer v6.2.7 Swiftmailer, free feature-rich PHP mailer
symfony/console v5.2.5 Eases the creation of beautiful and tes...
symfony/css-selector v5.2.4 Converts CSS selectors to XPath express...
symfony/deprecation-contracts v2.2.0 A generic function and convention to tr...
symfony/error-handler v5.2.4 Provides tools to manage errors and eas...
symfony/event-dispatcher v5.2.4 Provides tools that allow your applicat...
symfony/event-dispatcher-contracts v2.2.0 Generic abstractions related to dispatc...
symfony/finder v5.2.4 Finds files and directories via an intu...
symfony/http-client-contracts v2.3.1 Generic abstractions related to HTTP cl...
symfony/http-foundation v5.2.4 Defines an object-oriented layer for th...
symfony/http-kernel v5.2.5 Provides a structured process for conve...
symfony/mime v5.2.5 Allows manipulating MIME messages
symfony/polyfill-ctype v1.22.1 Symfony polyfill for ctype functions
symfony/polyfill-iconv v1.22.1 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme v1.22.1 Symfony polyfill for intl's grapheme_* ...
symfony/polyfill-intl-idn v1.22.1 Symfony polyfill for intl's idn_to_asci...
symfony/polyfill-intl-normalizer v1.22.1 Symfony polyfill for intl's Normalizer ...
symfony/polyfill-mbstring v1.22.1 Symfony polyfill for the Mbstring exten...
symfony/polyfill-php72 v1.22.1 Symfony polyfill backporting some PHP 7...
symfony/polyfill-php73 v1.22.1 Symfony polyfill backporting some PHP 7...
symfony/polyfill-php80 v1.22.1 Symfony polyfill backporting some PHP 8...
symfony/process v5.2.4 Executes commands in sub-processes
symfony/routing v5.2.4 Maps an HTTP request to a set of config...
symfony/service-contracts v2.2.0 Generic abstractions related to writing...
symfony/string v5.2.4 Provides an object-oriented API to stri...
symfony/translation v5.2.5 Provides tools to internationalize your...
symfony/translation-contracts v2.3.0 Generic abstractions related to transla...
symfony/var-dumper v5.2.5 Provides mechanisms for walking through...
theseer/tokenizer 1.2.0 A small library for converting tokenize...
tijsverkoyen/css-to-inline-styles 2.2.3 CssToInlineStyles is a class that enabl...
vanilo/cart 2.1.1 Vanilo Cart Module
vanilo/category 2.1.0 Vanilo Category Module
vanilo/channel 2.1.0 Vanilo Channel Module
vanilo/checkout 2.1.0 Vanilo Checkout Module
vanilo/contracts 2.1.0 Common set of Vanilo Contracts (Interfa...
vanilo/framework 2.1.1 E-commerce Framework for Laravel
vanilo/order 2.2.0 Vanilo Order Module
vanilo/payment 2.1.1 Vanilo Payment Module
vanilo/product 2.1.0 Vanilo Product Module
vanilo/properties 2.1.1 Vanilo Properties (Attributes) Module
vanilo/support 2.1.1 Common Vanilo functions, traits, helpers
vlucas/phpdotenv v5.3.0 Loads environment variables from .env...
voku/portable-ascii 1.5.6 Portable ASCII library - performance op...
webmozart/assert 1.10.0 Assertions to validate method input/out...

@fulopattila122
Copy link
Member

Looks good now. Can you add a superuser yet?

@ayhanbaris
Copy link
Author

image

@fulopattila122
Copy link
Member

What's the content of config/auth.php?

@fulopattila122
Copy link
Member

this is config/app.php 🙂 I need config/auth.php 😉 thx!

@ayhanbaris
Copy link
Author

of :)

@ayhanbaris
Copy link
Author

ayhanbaris commented Apr 7, 2021

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Guards
    |--------------------------------------------------------------------------
    |
    | Next, you may define every authentication guard for your application.
    | Of course, a great default configuration has been defined for you
    | here which uses session storage and the Eloquent user provider.
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | Supported: "session", "token"
    |
    */

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
            'hash' => false,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | User Providers
    |--------------------------------------------------------------------------
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | If you have multiple user tables or models you may configure multiple
    | sources which represent each model / table. These sources may then
    | be assigned to any extra authentication guards you have defined.
    |
    | Supported: "database", "eloquent"
    |
    */

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],

        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Resetting Passwords
    |--------------------------------------------------------------------------
    |
    | You may specify multiple password reset configurations if you have more
    | than one user table or model in the application and you want to have
    | separate password reset settings based on the specific user types.
    |
    | The expire time is the number of minutes that the reset token should be
    | considered valid. This security feature keeps tokens short-lived so
    | they have less time to be guessed. You may change this as needed.
    |
    */

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Password Confirmation Timeout
    |--------------------------------------------------------------------------
    |
    | Here you may define the amount of seconds before a password confirmation
    | times out and the user is prompted to re-enter their password via the
    | confirmation screen. By default, the timeout lasts for three hours.
    |
    */

    'password_timeout' => 10800,

];

@fulopattila122
Copy link
Member

Do you have App\Models\User or App\User class? or both?

@ayhanbaris
Copy link
Author

App\Models\User

image

@fulopattila122
Copy link
Member

How do you do this part: https://vanilo.io/docs/2.x/installation#step-3-register-the-model in the AppServiceProvider class?

@ayhanbaris
Copy link
Author

ayhanbaris commented Apr 7, 2021

    public function register()
    {
        $this->app->concord->registerModel(\Konekt\User\Contracts\User::class, \App\Models\User::class);
    }

@fulopattila122
Copy link
Member

What's the content of app/Models/User.php?

@ayhanbaris
Copy link
Author

ayhanbaris commented Apr 7, 2021

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;

class User extends \Konekt\AppShell\Models\User
{
}

@fulopattila122
Copy link
Member

Everything looks good 😳
as I'm out of ideas, what's the output of

php artisan concord:modules -a

?

@ayhanbaris
Copy link
Author

ayhanbaris commented Apr 7, 2021

ayhan@mvk vaniloapp % php artisan concord:modules -a
+-----+--------------------------+--------+---------+-------------------+-------------------+
| #   | Name                     | Kind   | Version | Id                | Namespace         |
+-----+--------------------------+--------+---------+-------------------+-------------------+
| 1.  | Konekt Address Module    | Module | 2.1.0   | konekt.address    | Konekt\Address    |
| 2.  | Konekt Customer Module   | Module | 2.1.0   | konekt.customer   | Konekt\Customer   |
| 3.  | Konekt User Module       | Module | 2.3.0   | konekt.user       | Konekt\User       |
| 4.  | Konekt Acl Module        | Module | 1.5.0   | konekt.acl        | Konekt\Acl        |
| 5.  | Konekt AppShell Box      | Box    | 2.2.0   | konekt.app_shell  | Konekt\AppShell   |
| 6.  | Vanilo Category Module   | Module | 2.1.0   | vanilo.category   | Vanilo\Category   |
| 7.  | Vanilo Product Module    | Module | 2.1.0   | vanilo.product    | Vanilo\Product    |
| 8.  | Vanilo Properties Module | Module | 2.1.1   | vanilo.properties | Vanilo\Properties |
| 9.  | Vanilo Channel Module    | Module | 2.1.0   | vanilo.channel    | Vanilo\Channel    |
| 10. | Vanilo Cart Module       | Module | 2.1.1   | vanilo.cart       | Vanilo\Cart       |
| 11. | Vanilo Checkout Module   | Module | 2.1.0   | vanilo.checkout   | Vanilo\Checkout   |
| 12. | Vanilo Order Module      | Module | 2.2.0   | vanilo.order      | Vanilo\Order      |
| 13. | Vanilo Payment Module    | Module | 2.1.1   | vanilo.payment    | Vanilo\Payment    |
| 14. | Vanilo Framework         | Box    | 2.1.1   | vanilo.framework  | Vanilo\Framework  |
+-----+--------------------------+--------+---------+-------------------+-------------------+

@fulopattila122
Copy link
Member

Is it possible for you to delete and recreate the entire database with php artisan migrate:refresh?

I have no better ideas left...

@tzdigital
Copy link

I also redid the installation several times, using the recommendations mentioned above, but still the same problem

image

i have same config as @ayhanbaris

thx

@fulopattila122
Copy link
Member

Is there any chance to pack the entire application along with vendor and everything + a db dump and pass the zip link to me?
I'm out of ideas otherwise

@tzdigital
Copy link

I advance!

in config/auth.php I changed the user model to that of konekt like this:

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => Konekt\AppShell\Models\User::class,
        ],
    ],

and the superadmin registration is ok !

I think the problem comes from the filters on the models in Guard::getNames() of Konect Acl module

I don't have time to investigate more, I will if I have free time 👍

@fulopattila122
Copy link
Member

Thanks for the update. I'll take a look when I'll have free time :)

@noud
Copy link

noud commented Apr 19, 2021

i have the same problem and the change in auth.php to Konekt\AppShell\Models\User::class does not solve it for me.

In the db however an admin user is created. (do not know if other tables should have added tupels)

after the whole install if i login i get:
http://127.0.0.1:8002/admin/customer
403
FORBIDDEN

but i am logged in.
http://127.0.0.1:8002/home
Laravel 
Admin
Logout
Dashboard
You are logged in!

@fulopattila122
Copy link
Member

@ayhanbaris, have you ever solved this issue?

@yasirmturk
Copy link

I have same issue with laravel breeze

@parse-code
Copy link

parse-code commented Jul 20, 2023

I have the same problem and maybe I know the reason.
please check the config/concord.php file, if you delete the previous ModuleServiceProvider when follow the admin installation

<?php

return [
    'modules'               => [
        Vanilo\Foundation\Providers\ModuleServiceProvider::class, // <------- DO NOT DELETE THIS LINE !
        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,
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants