Encompass Plugin for Persona-Based Loan File Saving Restriction

Encompass Plugin for Persona-Based Loan File Saving Restriction

This plugin aims to restrict users from saving a loan file in Encompass based on their assigned persona. You can define specific personas that are allowed or disallowed from saving loan files.

Core Functionality:

The plugin will intercept the “Save” action within Encompass and perform the following checks:

  1. Identify the Current User: Determine the logged-in Encompass user.

  2. Retrieve User’s Persona: Access the user’s assigned persona information within Encompass. This might involve querying user profiles, group memberships, or a custom field.

  3. Define Restriction Rules: Configure the plugin with rules that specify which personas are allowed or disallowed from saving loan files. This could be done through:

    • Plugin Settings: A configuration interface within Encompass Plugin Settings.

    • External Configuration File: Reading rules from an XML or JSON file.

    • Custom Encompass Data Object (EDO): Storing rules in a dedicated EDO.

  4. Evaluate the Rules: Compare the user’s persona against the defined restriction rules.

  5. Implement Restriction:

    • Block Saving: If the user’s persona is not allowed to save, prevent the save operation.

    • Display Message: Show a user-friendly message explaining why the save operation was blocked.

    • Log Activity (Optional): Record the blocked save attempts in an audit log.

 

The plugin will likely involve the following components:

  • Solution File (.sln): The main project container.

  • Plugin Project (.csproj): The core logic of the plugin.

    • Plugin Class (.cs): Implements the EmbracingSolutions.Encompass.PluginSdk.IPlugin interface. This will handle the plugin initialization and event subscription.

    • SaveEventHandler Class (.cs): Subscribes to the DataObjectSavePreActionEventArgs event. This is where the restriction logic will reside.

    • Configuration Class (.cs): Defines the structure for storing the persona restriction rules.

    • ConfigurationService Class (.cs): Handles loading and managing the plugin configuration.

    • Utility Class (.cs) (Optional): Contains helper methods for accessing user information, personas, etc.

  • Setup Project (.wixproj or similar): Used for creating the Encompass plugin installation package.

Implementation Steps (High-Level):

  1. Set up the Development Environment:

    • Install the Encompass SDK.

    • Create a new Encompass Plugin project in Visual Studio.

    • Reference the necessary Encompass SDK assemblies.

  2. Implement Configuration:

    • Design the structure for storing persona restriction rules (e.g., a list of allowed/disallowed personas).

    • Create a Configuration class to represent this structure.

    • Implement a ConfigurationService class to handle loading and saving the configuration (from plugin settings, file, or EDO).

    • Create a user interface within the Encompass Plugin Settings to manage these rules.

  3. Implement the Plugin Class:

    • Implement the IPlugin interface.

    • In the Initialize method, subscribe to the DataObjectSavePreActionEventArgs event for the Loan object.

    • Optionally, handle plugin configuration loading in the Initialize method.

  4. Implement the Save Event Handler:

    • Create a SaveEventHandler class with a method that handles the DataObjectSavePreActionEventArgs event.

    • Inside the event handler:

      • Get the current Encompass user using the Session object from the event arguments.

      • Retrieve the user’s persona. This is a crucial step and might involve:

        • Accessing custom user profile fields (if you store persona there).

        • Checking group memberships.

        • Querying a custom EDO linked to the user.

        • Consulting an external system via API call (if personas are managed externally).

      • Load the persona restriction rules from the ConfigurationService.

      • Evaluate the rules:

        • Check if the user’s persona is in the “disallowed” list (if using a blacklist approach).

        • Check if the user’s persona is in the “allowed” list (if using a whitelist approach). Ensure to handle cases where the list might be empty.

      • If the save is restricted:

        • Set e.Cancel = true; to prevent the save operation.

        • Set e.ErrorMessage = “Saving this loan file is restricted for users with your persona.”; (or a more specific message).

        • Optionally, log the blocked attempt.

  5. Build and Deploy the Plugin:

    • Build the Visual Studio solution.

    • Create a plugin installation package using a Setup Project (e.g., WiX Toolset).

    • Deploy the plugin to your Encompass environment.

    • Configure the plugin settings with the desired persona restriction rules.

You could have settings like:

  • Restriction Mode: (Dropdown: Allow Listed Personas Only / Disallow Listed Personas)

  • Allowed Personas: (Multi-select or comma-separated text field)

  • Disallowed Personas: (Multi-select or comma-separated text field)

Important Considerations:

  • Persona Identification: The most critical part is reliably identifying a user’s persona within Encompass. Determine where this information is stored and how to access it programmatically.

  • Configuration Management: Choose a configuration method that is user-friendly and maintainable. Plugin settings are generally the easiest for Encompass administrators.

  • User Experience: Provide clear and informative error messages when a save is blocked.

  • Error Handling and Logging: Implement proper error handling to catch potential issues and log relevant information for troubleshooting.

  • Testing: Thoroughly test the plugin with different user personas and restriction rules to ensure it functions as expected.

  • Security: Be mindful of security implications when accessing user information and configuration data.

  • Performance: Ensure the plugin’s logic is efficient and doesn’t significantly impact the performance of the save operation.

Code Snippet (Conceptual – SaveEventHandler):

This is a simplified example and would need to be adapted based on your specific implementation details for retrieving the user’s persona and managing configuration.

 

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.