cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable the create button in product cockpit.

Former Member
0 Kudos

Hi Experts,

How can we disable the create (+) button to prevent user to create a record for a specific entity.

Regards, Janhavi

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member674342
Active Participant
0 Kudos

Hello ,

You could override the DefaultProductSearchBrowserModel:

 <alias alias="DefaultProductSearchBrowserModel" name="sampleProductSearchBrowserModel"/>
      <bean id="sampleProductSearchBrowserModel" class="sample.extension.sampleProductSearchBrowserModel"
            scope="prototype" parent="AbstractPageableBrowserModel">
      </bean>

and then the method (for example):

  public boolean isShowCreateButton()
      {
          if (userService.isAdmin(userService.getCurrentUser())) //optional if
              return true;
 
          return false;
      }

If you want to leave this button active for the admin - use the optional if. Else just return false

Hope it helps,

Former Member
0 Kudos

Hi Janhavi,

With the corresponding configuration of Access Rights you can restrict particular users/usergroups from item creation. It won't make (+) button disabled but it won't allow a user to create an item as shown in the image below

If you really want to customize the (+) button rendering than you can start with overriding

 de.hybris.platform.cockpit.components.contentbrowser.DefaultSearchContentBrowser.createCreateNewComponent()
Former Member
0 Kudos

Hi ,

I have 2 “+” create new Item button, I want to keep the one that I’ve customized (the items that will be created extends Product) and to disable the other one, what shall I do? I don’t need it for any user/usergroup. I’ve tried in the access rights impex, but if I restrict create Product, both are disabled.

Thank you!

mpern
Employee
Employee
0 Kudos

You are working with the new backoffice framework, the answers in this question don't apply. Maybe you should post a new question?

Former Member
0 Kudos

Hi

I suppose the easiest way would be to remove this button which can be done through yourbackofficeextension-backoffice-config.xml like follows

 <context merge-by="principal" type="YourType" component="listviewactions" principal="YourRole">
     <y:actions>
         <y:group qualifier="common">
             <y:action action-id="com.hybris.cockpitng.action.create" merge-mode="REMOVE" />
         </y:group>
     </y:actions>
 </context>