OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions How do I remove the "owner" dropdown

This topic contains 5 replies, has 4 voices, and was last updated by  andesk 4 years, 12 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #36018

    Bernhard Kau

    I created a new entity with the ownership set tp “user”. I want a new item of this entity being owned by the current user. But currently, the user can set/change the owner of the entity on creation or update.

    I want to hide the owner dropdown and rather set the owner always to the currently logged in user. Unfortunately I haven’t find a way to hide the owner dropdown, as it is not set in the twig template through the dataBlocks.subblocks.data array. It seems that it gets automatically prepended in some twig macro or something else, but I haven’t found anything in the code of the UIBunlde.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #36019


    This should be handled automatically based on the user permissions.

    The OwnerFormSubscriber creates the field you are talking about and which can be found in Oro\Bundle\OrganizationBundle\Form\EventListener\OwnerFormSubscriber this subscriber is constructed with an isAssignGranted permission which is checked in extension where the subscriber is registered (Oro\Bundle\OrganizationBundle\Form\Extension\OwnerFormExtension).

    The best way to handle this would be to check if the user is allowed to assign this element to another user and validate for the ASSIGN permission that way only users with the permission to assign the entity will see the owner field.


    Yurii Muratov

    Hi, @bernhard_kau.
    If you want to hide user select box in case if your user have User access level to create, you should rewrite addUserOwnerField method of OwnerFormExtension class in your project.
    So, your addUserOwnerField method should looks something like:

    Change Create permission to Assign is not a good idea because Assign permission was created to be able to limit users list during edit some entities.
    When you create some record, Create permission should limit this list.


    Bernhard Kau

    And how would I use such a modified class in my project? Or are you telling me, I have to modify the class in the vendors folder? Can I somehow tell the OrganisationBundle to use my custom class?

    But I stikk don’t see, how the current implementation is correct. Why should a user be allowed to assign an entity to someone else on creation but not when he is editing the item?

    There might be entities on shich a user should not be able to assign a newly created item to some other user. I am trying to build a groupware with ORO platform and things like files, notes and others should not be assignable to another user as otherwise the creating user could no longer see it.


    Bernhard Kau

    OK, I think I found it. This is how I’ve done it:
    – Created a new custom OrganizationBundle
    – Added a Custom Form\Extension\OwnerFormExtension class extending the original one (as BaseOwnerFormExtension)
    – Registered the new Bundle using the Resources/condif/oro/bundles.yml file
    – Implemented a OrganizationBundle\DependencyInjection\AcmeOrganizationExtension class
    – Loading the Resources/config/service.yml file in this DI class
    – Overwriting the oro_organization.form.extension.owner.class parameter in this settings.yml file

    Was this the correct way to overwrite the service/OwnerFormExtension?

    Thanks a lot for your help so far @yurio and @marc-roberts!



    That’s definetly the Symfony way of doing it :)

Viewing 5 replies - 1 through 5 (of 5 total)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No