How can we block users from creating records with the Accounts module? 

The users need to see all accounts but not have the ability to creating new records. Is there a setting I'm missing? It doesn't seem possible to do in roles.

Parents Reply Children
  • hi ,

    If we try to restrict create using Role Management so it will restrict both edit as well as create. So better is that we should restrict account creation throught override the CurrentUserAPI.

    -BPATEL

  • Hello John Harr,

    I hope you doing good.

    I have override the CurrentUserApi.Follow the below steps.

    1. /<projectname>/clients/base/api/CurrentUserApi.php To/<projectname>/custom/clients/base/api/CustomCurrentUserApi.php

    2. Add below code in the file CustomCurrentUserApi.php

    <?php  
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');  
    require_once("clients/base/api/CurrentUserApi.php");  
    class CustomCurrentUserApi extends CurrentUserApi  
    {  
       public function registerApiRest()  
       {  
           return parent::registerApiRest();  
       }  
        public function retrieveCurrentUser($api, $args)  
       {  
           $result = parent::retrieveCurrentUser($api, $args);  
                  $result['current_user']['acl']['Accounts']['create'] = 'no';     
           return $result;  
       }  
    }
    

    3. Do Quick Repair and Rebuild.

    Hope it will help you.

    Let me know if you need more help.

    -BPATEL

  • Thank you!  I figured it was something simple I was overlooking.