Plugin.LimitFunction
--------------------

Limits a function.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Plugin](component_Plugin.md) | [5.4](newinversion54.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Plugin.LimitFunction"; Name { ; privilegeSets; AccountNames; ScriptNames; FileNames } ) 

**MBS**( **"Plugin.LimitFunction";** /\* Limits a function. \*/  
**$Name**; /\* A function name like [RemoteControl.ClickMouse](RemoteControlClickMouse.md).e.g. "RemoteControl.ClickMouse" \*/   
**$privilegeSets**; /\* Optional; List of privilege set names. \*/   
**$AccountNames**; /\* Optional; List of account names.e.g. "admin" \*/   
**$ScriptNames**; /\* Optional; List of script names. Each entry contains the name fo the file followed with ":" and the script name.e.g. "Kontakte:TestScript" \*/   
**$FileNames**) /\* Optional; List of file names allowed.  
Must be same name as returned by Get(FileName).e.g. "Kontakte" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Name | A function name like [RemoteControl.ClickMouse](RemoteControlClickMouse.md). | "RemoteControl.ClickMouse" |  |
| privilegeSets | List of privilege set names. |  | Optional |
| AccountNames | List of account names. | "admin" | Optional |
| ScriptNames | List of script names. Each entry contains the name fo the file followed with ":" and the script name. | "Kontakte:TestScript" | Optional |
| FileNames | List of file names allowed.   Must be same name as returned by Get(FileName). | "Kontakte" | Optional      Added in version **15.0**. |

### Result

Returns OK or error.

### Description

Limits a function.  
Once limited, the function can only be called if current privilege set, account name and script name match those in the list. Lists can be empty if not needed.  
  
For FileMaker hosting of several clients with one server, we highly recommend to limit the available plugin functions via [Plugin.SetFunctions](PluginSetFunctions.md) function. You also should limit some functions like [Files.Delete](FilesDelete.md) or [System.Shutdown](SystemShutdown.md) to be only called by certain user accounts and/or script.  
### Examples

Limit a function to be called only from a certain script:

 MBS ("Plugin.LimitFunction"; "Version"; ""; ""; "test.fmp12:test")  
Limit a function to be called only from a certain account name:

 MBS ("Plugin.LimitFunction"; "[Text.WriteTextFile](TextWriteTextFile.md)"; "Backup"; ""; "")  
Limit [Shell.Execute](ShellExecute.md) to Exports file:

 MBS ( "Plugin.LimitFunction"; "[Shell.Execute](ShellExecute.md)"; ""; ""; ""; "Exports" )  
### See also

- [Files.Delete](FilesDelete.md)
- [Plugin.LockFunction](PluginLockFunction.md)
- [Plugin.SetFunctions](PluginSetFunctions.md)
- [RemoteControl.ClickMouse](RemoteControlClickMouse.md)
- [Shell.Execute](ShellExecute.md)
- [System.Shutdown](SystemShutdown.md)
- [Text.WriteTextFile](TextWriteTextFile.md)
- [Version](Version.md)

### Release notes

- **Version 15.0**
    - Added FileNames parameter for [Plugin.LimitFunction](https://www.mbsplugins.eu/PluginLimitFunction.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 14.6pr4](https://www.mbsplugins.de/archive/2024-12-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Trigger scripts via plugin and fmplugin extended privilege](https://www.mbsplugins.de/archive/2021-08-21/Trigger_scripts_via_plugin_and/monkeybreadsoftware_blog_filemaker)
- [Shared FileMaker Server Hosting and Plugin Security](https://www.mbsplugins.de/archive/2015-10-23/Shared_FileMaker_Server_Hostin/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 20th October 2015 , last changed 12nd December 2024

  
[Plugin.LicenseeName](PluginLicenseeName.md) - [Plugin.LimitToFile](PluginLimitToFile.md)

[HTML Version](PluginLimitFunction.shtml)