How to disable quick create menu entry for a specific module in mobile view ?

hi,

i've have to disable create for account in mobile view only.

i'already set an ACL wich works great. but i see, it remains create button in subpanel and quick create menu.

how can i do to remove them in mobile view ?

  • For sure you need to build a custom app from sugar-mobile-sdk.

    You need to create customization for modules Search and that specific module and type "right-menu-list". So you can extend the js controller accordingly.

    We had done something similar.

    Let me know if you would like to get that job done asap.

    Cheers

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi  , André Lopes' answer is correct. The following lines are an example of how to obtain the result.

    1 .- create the next file "custom/views/right-menu/right-menu-view.js"

    2 .- Add the following lines:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    const customization = require('%app.core%/customization.js');
    const RightMenuView = require('%app.views%/right-menu/right-menu-view');
    const componentManager = require('%app.core%/component-manager');
    const CustomRightMenuView = customization.extend(RightMenuView,
    {
    refillMenu() {
    this.availableActions = this.getAvailableActions();
    this.availableActions = _.filter(this.availableActions, function (item) {
    let isValidCreate = true;
    switch (item.module) {
    case "RevenueLineItems":
    case "Accounts":
    isValidCreate = false;
    break;
    }
    return isValidCreate;
    });
    this.render();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    This code avoid creating RevenueLineItems and Accounts from Quick Create.

    I hope to be helpful. 

    Nice day.

  • Oops! I forgot to put the reference to the guide. Mobile SDK Quick Start Guide

  • unfortunately it's not the mobile app, but  sugar /mobile view



    sorry for not been clear

  • So you mean to render Sugar interface in mobile mode in the browser?

    Unfortunately it is not possible. Mobile code is not editable in a Sugar instance.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi ,

    thanks for your answers and your time


  • i solved my problem by overriding the enforceModuleACLs() function from CurrentUserApi like this : 

    custom/clients/mobile/api/CustomCurrentUserMobileApi.php

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    /**
    * Enforces module specific ACLs for mobile
    *
    * @param array $acls
    * @return array
    */
    protected function enforceModuleACLs(Array $acls)
    {
    $readOnlyModules = ['Accounts'];
    foreach ($acls as $modName => $modAcls) {
    if (in_array($modName, $readOnlyModules)) {
    $acls[$modName]['edit'] = 'no';
    $acls[$modName]['massupdate'] = 'no';
    $acls[$modName]['create'] = 'no';
    }
    }
    return $acls;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    but i don't understand, why the first ACL i've made on Account which denied action edit,save in checkAccesFunction allows mobile view to display "create button" in some case.



    what is the difference between acl ( SugarACLStrategy ) and $ACL in my function enforceModuleACLs. Slight smile



  • Glad to know you fixed it frachet! Good job!!

    I do know the method enforceModuleACLs and, indeed, I override it sometimes for approaches like yours, but I forgot to consider it in my previous comment.

    As far I know data returned from enforceModuleACLs is sent to metadata endpoint so client (mobile app) is able to set acl configs into templates. In other hand, SugarACLStrategy is loaded and evaluated on accessing a specific module, view, field.

    Cheers

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Don't worry, it's a shame not being able to do something else.