SonataUserBundle icon indicating copy to clipboard operation
SonataUserBundle copied to clipboard

Expose role matrix as standalone component

Open fkrauthan opened this issue 2 years ago • 14 comments

Feature Request

I was trying to just use the role matrix for my sonata admin (but running my own user system). But it seems like I need to setup a lot of things I never use just for that. Is there any chance that the role matrix system can be extracted as standalone component?

fkrauthan avatar Mar 13 '22 03:03 fkrauthan

you mean as still Sonata Admin related Component or as totally standalone one?

Hanmac avatar Mar 13 '22 08:03 Hanmac

Primarily as Sonata Admin related component (as it is directly tied into Sonata Admin's role management).

fkrauthan avatar Mar 13 '22 18:03 fkrauthan

Not sure if that's a completely good idea... I explain:

  • A standalone component won't be so standalone since it requires SonatAdminBundle in the first place, which is a huge dependency
  • That leaves us with only one option is we want to move it outside SonataUserBundle -> move it to the SonataAdminBundle
  • Not sure if we want to add that much code into it, since it is already a big bundle

Other options like move it to form-extensions is a no-go, since that package does not depend on SonataAdminBundle.

Wdyt @VincentLanglet ?

Other things worth knowing:

  • Why don't you use SonataUserBundle full capabilities? Is there something missing for you?
  • Is there a way to simplify this bundle, or atleast required code so you can use this bundle with your custom implementation?

jordisala1991 avatar Mar 13 '22 18:03 jordisala1991

Wdyt @VincentLanglet ?

I don't fully understand the feature request. What is the role matrix system ? Do you mean the RolesMatrixType ? And then if I look at the uses:

  • MatrixRolesBuilderInterface
  • MatrixRolesBuilder
  • ExpandableRolesBuilderInterface
  • PermissionLabelsBuilderInterface
  • AdminRolesBuilderInterface
  • AdminRolesBuilder ... I feel like it's half of the project.

Why don't you use SonataUserBundle full capabilities? Is there something missing for you? Is there a way to simplify this bundle, or atleast required code so you can use this bundle with your custom implementation?

I think the second option could be interesting. Recently someone wanted to use this bundle without sonataAdmin and make it possible. I assume it's not too hard to let people use part of this bundle without configuring everything. I just don't know what are the current blocking point.

But it seems like I need to setup a lot of things I never use just for that.

Which things ?

VincentLanglet avatar Mar 13 '22 19:03 VincentLanglet

Not sure if that's a completely good idea... I explain:

* A standalone component won't be so standalone since it requires SonatAdminBundle in the first place, which is a huge dependency

* That leaves us with only one option is we want to move it outside SonataUserBundle -> move it to the SonataAdminBundle

* Not sure if we want to add that much code into it, since it is already a big bundle

Other options like move it to form-extensions is a no-go, since that package does not depend on SonataAdminBundle.

instead of putting the code into the AdminBundle, we could move that part into a total new one

the only concern is what to do with the parts in this bundle, i mean it wouldn't be a problem to remove the stuff there and let the UserBundle depend on the new Matrix Bundle.

~~The only thing, it is probably too late to do it for the 5.0 release, and i don't see such a BC being done in a 5.* one either, so it probably has to wait til 6.0 release?~~

Edit: i didn't noticed the 5.0 release, i needed it for tomorrow at work

Hanmac avatar Mar 13 '22 20:03 Hanmac

instead of putting the code into the AdminBundle, we could move that part into a total new one

The sonata-project team is small and new repository means extra work. We deprecated many of them, it's not to create new one now IMHO.

VincentLanglet avatar Mar 13 '22 20:03 VincentLanglet

I understand that. But in theory this part could be easily shipped as part of the main admin bundle. The role component (including styling/templates) is not specific to any user implementation. But most people using this (ether with FOSUserBundle which is deprecated, some other user bundle or there own implementation) will need that role selection for any type of more complex admin use-case.

To me really the main point is: I don't need any functionality this bundle offers besides that role selection. So including this bundle. Configuring tons of features (like resetting email) just for that is a bit overkill.

fkrauthan avatar Mar 13 '22 21:03 fkrauthan

I understand that. But in theory this part could be easily shipped as part of the main admin bundle. The role component (including styling/templates) is not specific to any user implementation. But most people using this (ether with FOSUserBundle which is deprecated, some other user bundle or there own implementation) will need that role selection for any type of more complex admin use-case.

I personally doesn't use the SonataUserBundle, so I don't use the roleMatrix things of this bundle. Lot of people are using SonataAdmin without SonataUser ; so I'm not sure we can say that "most people using this will need that role selection".

Configuring tons of features (like resetting email) just for that is a bit overkill.

Like I said, we might make this bundle having less mandatory configuration.

VincentLanglet avatar Mar 13 '22 21:03 VincentLanglet

@VincentLanglet Yeah that is exactly my point. Many people use SonataAdmin without SonataUser and probably build there own role selection :)

Anyways yeah having less mandatory configuration and being able to ignore the SonatUser shipped admin class would definitely solve my feature suggestion.

fkrauthan avatar Mar 13 '22 21:03 fkrauthan

Anyways yeah having less mandatory configuration and being able to ignore the SonatUser shipped admin class would definitely solve my feature suggestion.

@fkrauthan What are the mandatory configuration which blocks you ? We're open to PR to make them optional

VincentLanglet avatar Jul 12 '22 16:07 VincentLanglet

I am no longer using this bundle but I believe the emails setup for example. Pretty much the only thing I was looking to use is this one component which shouldn't require a single config set.

fkrauthan avatar Jul 12 '22 16:07 fkrauthan

I am no longer using this bundle

I will close then, since I don't think someone will do it ; but if someone else has the same issue PR are welcomed.

VincentLanglet avatar Jul 12 '22 16:07 VincentLanglet

Well I still would like to use the RoleMatrix form component. But if you think that this will never be possible closing it is ok.

fkrauthan avatar Jul 12 '22 17:07 fkrauthan

Well I still would like to use the RoleMatrix form component.

It's possible if someone provide a PR to make the configuration optional. But we won't create another repository.

VincentLanglet avatar Jul 12 '22 17:07 VincentLanglet

RoleMatrix form component is the only thing I would need from this bundle. What happens now is that I'm giving the roles manually and it is not optimal.

I'm guessing that people who have maintained some project for long time have built their own user system for Symfony 4 because of FOSUserBundle deprecation. Now that system is only missing this RoleMatrix form component and this is why people are asking for it.

haivala avatar Oct 27 '22 14:10 haivala