Let the platform do the work

FileAccessControlMap

Overview

The FileAccessControlMap extension restricts specific view actions from users of the system.

Note: This is only applicable to modules running in backward compatibility mode.

Properties

The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Module
Sugar Variable $file_access_control_map
Extension Directory ./custom/Extension/modules/<module>/Ext/FileAccessControlMap/
Compiled Extension File ./custom/modules/<module>/Ext/FileAccessControlMap/file_access_control_map.ext.php
Manifest Installdef $installdefs['file_access']

Implementation

The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/modules/<module>/Ext/FileAccessControlMap/ to restrict a view of a module. The following example will create a new restriction for the detail view:

./custom/Extension/modules/<module>/Ext/FileAccessControlMap/<file>.php

<?php

$file_access_control_map['modules']['<lowercase module>']['actions'] = array(
    'detailview',
);

Navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and compile your customization into ./custom/modules/<module>/Ext/FileAccessControlMap/file_access_control_map.ext.php

Module Loadable Package

When building a module loadable package, you can use the $installdefs['file_access'] index to install the extension file.

Installdef Properties

Name Type Description
from String The base path of the file to be installed
to_module String The key of the module the file is to be installed to

The example below demonstrates the proper install definition that should be used in the ./manifest.php file, in order to add the File Access Control Map file to a specific module. You should note that when using this approach, Sugar will automatically execute Rebuild Extensions to reflect the new Action in the system.

./manifest.php

<?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'ActionRemap_Example',
    'file_access' => array(
        array(
            'from' => '<basepath>/Files/custom/Extension/modules/<module>/Ext/FileAccessControlMap/<file>.php',
            'to_module' => '<module>',
        )
    )
);

Alternatively, you may use the $installdefs['copy'] index for the File Access Control Map Extension file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module-loadable packages, please refer to the Introduction to the Manifest page.