Exploring the Plugin.LimitToFile Feature in the MBS FileMaker Plugin 15.1
Exploring the Plugin.LimitToFile Feature in the MBS FileMaker Plugin 15.1
The MBS FileMaker Plugin 15.1 introduces an important functionality for FileMaker developers — Plugin.LimitToFile. This feature enhances control over which files can access and utilize the plugin. It’s a useful tool when creating solutions where limiting plugin access to specific files is essential for security or organizational purposes.
What is Plugin.LimitToFile?
In essence, Plugin.LimitToFile restricts the plugin's functionality to certain files within your FileMaker solution. It ensures that only the specified files are allowed to make use of the plugin. This feature is useful when you want to avoid unauthorized use of the plugin or to limit its operation to a select few files. It adds an extra layer of control over the environment in which your plugin operates.
FileList Parameter
The primary parameter of this function, it’s a list of file names that are authorized to use the plugin. The list must be provided as a case-sensitive string of file names separated by a delimiter (such as ¶). For example, if you want to allow only the files "MyInvoices," "MyContacts," and "MyAssets," your FileList would look like this: "MyInvoices¶MyContacts¶MyAssets"
.
The plugin compares file names using the Get(FileName) function, so it’s crucial that the names are matched exactly, respecting both case and spelling.
Function Behavior
Once this restriction is applied, the plugin is "locked" to the allowed files, meaning no other files can access its features. The limitation is enforced early in the process, so much so that even querying the plugin version is blocked unless the file is listed in the FileList. This makes it highly secure and effective at preventing unauthorized access.
You can also call Plugin.SetFunctions later to disallow someone from modifying the allowed file list after it's been set. This ensures that the restriction remains intact throughout the solution.
Use Cases and Examples
Here are a few examples of how you can use Plugin.LimitToFile in your FileMaker solutions:
Limit to the current file only:
If you only want the plugin to work with the currently open file, use:
Set Variable [ $r ; Value: MBS( "Plugin.LimitToFile"; Get(FileName) ) ]
This will ensure that only the file that is currently active can use the plugin.
Limit to a few files in your solution:
You can specify multiple files that are allowed to use the plugin by listing them in the FileList:
Set Variable [ $r ; Value: MBS( "Plugin.LimitToFile"; "MyInvoices¶MyContacts¶MyAssets") ]
In this example, only these three files will have access to the plugin.
Allow all files:
If you wish to remove any file restrictions and allow all files to use the plugin, simply set the FileList to an empty string:
Set Variable [ $r ; Value: MBS( "Plugin.LimitToFile"; "" ) ]
This effectively disables the file restriction, enabling the plugin across the entire solution.
Additional Considerations
- The limitation set by Plugin.LimitToFile is not permanent. For it to work as intended, the function must be executed in the start script of the solution. This ensures the restriction is applied as soon as the solution is launched.
- If you need to prevent further modifications to the file list once it’s been set, call Plugin.SetFunctions to block changes after the restriction has been applied.
Conclusion
The Plugin.LimitToFile function in the MBS FileMaker Plugin 15.1 offers a straightforward yet powerful way to control plugin access within your FileMaker solution. Whether you're working with a single file or several, this feature provides flexibility in restricting access to only the files you want to use the plugin. Combined with Plugin.SetFunctions, it adds a layer of security and control that enhances the integrity and functionality of your FileMaker solution.
With its addition to MBS FileMaker Plugin 15.1, this feature allows developers to create more secure and tailored FileMaker environments. As always, the feature is free to use, so developers can take full advantage of its capabilities without any additional cost.
For more information about this and other features of MBS FileMaker Plugin 15.1, check out the official documentation and blog entries from MBS.