Restrict regular user to edit Profile

Hello,

We need to restrict regular users (non-admin) from editing their Profile (remove/disable Edit button at all https://www.screencast.com/t/tLx0dXxRszNg). Please advise if there is a way to.

Thanks,
Kate

  • Hi Kate Gozak 

    You can disable access to edit any User profile for non admin users.

    Create a custom controller for Users (custom/modules/Users/controller.php) with this content:

    <?php

    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

     

    require_once('modules/Users/controller.php');

     

    class CustomUsersController extends UsersController

    {

        protected function action_editview() {

            $this->view = (is_admin($GLOBALS['current_user'])) ? 'edit' : 'noaccess';

        }

    }

    This code enable edit for admin only. Remember to run Quick Repair and Rebuild.

    Kind regards