How to give admin panel access to additional user group

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

How to give admin panel access to additional user group

Post by VirtualSpy » 31 Mar 2023, 10:45

laravel version 9.48.0 , Aimeos version 2022.10.4 and PHP version 8.1.3 (Win)

i have created two additional group one for catalog management and one for order management , i know about permission for group https://github.com/aimeos/ai-admin-jqad ... source.php but i didn't get how to give access to additional groups.
Last edited by VirtualSpy on 03 Apr 2023, 14:28, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: How to give admin panel access to addition user group

Post by aimeos » 02 Apr 2023, 12:14

Access to panels is checked here:
https://github.com/aimeos/ai-admin-jqad ... hp#L45-L47

Just add the names of your additional groups in your ./config/shop.php for order and user panels:
- https://github.com/aimeos/ai-admin-jqad ... hp#L30-L55
- https://github.com/aimeos/ai-admin-jqad ... p#L73-L115
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: How to give admin panel access to additional user group

Post by VirtualSpy » 03 Apr 2023, 06:52

aimeos wrote: 02 Apr 2023, 12:14 Access to panels is checked here:
https://github.com/aimeos/ai-admin-jqad ... hp#L45-L47

Just add the names of your additional groups in your ./config/shop.php for order and user panels:
- https://github.com/aimeos/ai-admin-jqad ... hp#L30-L55
- https://github.com/aimeos/ai-admin-jqad ... p#L73-L115
Thanks for your response, I understood this, but I am not able to login in admin panel by additional customer group's email, I checked with SHOP_PERMISSION in env by adding an additional customer group code, but it is showing This action is unauthorized.

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: How to give admin panel access to additional user group

Post by VirtualSpy » 04 Apr 2023, 05:20

VirtualSpy wrote: 03 Apr 2023, 06:52
aimeos wrote: 02 Apr 2023, 12:14 Access to panels is checked here:
https://github.com/aimeos/ai-admin-jqad ... hp#L45-L47

Just add the names of your additional groups in your ./config/shop.php for order and user panels:
- https://github.com/aimeos/ai-admin-jqad ... hp#L30-L55
- https://github.com/aimeos/ai-admin-jqad ... p#L73-L115
Thanks for your response, I understood this, but I am not able to login in admin panel by additional customer group's email, I checked with SHOP_PERMISSION in env by adding an additional customer group code, but it is showing This action is unauthorized.

Aimeos ! Did you understand my problem?

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: How to give admin panel access to additional user group

Post by VirtualSpy » 06 Apr 2023, 06:38

Aimeos ! Will you reply? Thanks in Advance

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: How to give admin panel access to additional user group

Post by aimeos » 07 Apr 2023, 07:53

Guess, the problem is the fixed list of groups here:
https://github.com/aimeos/aimeos-larave ... er.php#L36

If it would be configurable, you can log in with users having different groups.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: How to give admin panel access to additional user group

Post by VirtualSpy » 10 Apr 2023, 08:08

aimeos wrote: 07 Apr 2023, 07:53 Guess, the problem is the fixed list of groups here:
https://github.com/aimeos/aimeos-larave ... er.php#L36

If it would be configurable, you can log in with users having different groups.
It was helpful, and because of this, I knew more. https://github.com/aimeos/aimeos-larave ... roller.php in this controller one configuration is using

Code: Select all

if( config( 'shop.authorize', true ) ) {
			$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
		}
Because of this config it was showing This action is unauthorized. so, I used this config in config/shop.php .
but now I want to know the best way to overwrite the controllers because I want to overwrite https://github.com/aimeos/aimeos-larave ... er.php#L36 this controller.

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: How to give admin panel access to additional user group

Post by VirtualSpy » 10 Apr 2023, 10:23

VirtualSpy wrote: 10 Apr 2023, 08:08
aimeos wrote: 07 Apr 2023, 07:53 Guess, the problem is the fixed list of groups here:
https://github.com/aimeos/aimeos-larave ... er.php#L36

If it would be configurable, you can log in with users having different groups.
It was helpful, and because of this, I knew more. https://github.com/aimeos/aimeos-larave ... roller.php in this controller one configuration is using

Code: Select all

if( config( 'shop.authorize', true ) ) {
			$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
		}
Because of this config it was showing This action is unauthorized. so, I used this config in config/shop.php .
but now I want to know the best way to overwrite the controllers because I want to overwrite https://github.com/aimeos/aimeos-larave ... er.php#L36 this controller.
I have overwritten the controller and route from Laravel, if you have any other way to overwrite it please share.

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: How to give admin panel access to additional user group

Post by aimeos » 11 Apr 2023, 08:10

It would be best if the roles in the AdminController could be configured like in the JqadmController with:

Code: Select all

config( 'shop.roles', ['admin', 'editor'] )
Then, you can configure which roles can be used for the backend. If you can create a PR, we will be happy to merge it and port it back to 2022.10 :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply