Enable bounded operations with inherent permissions

Completed

Permission sets package normal access, but some extension-owned operations need a narrow data permission only while trusted code runs. You now evaluate InherentPermissions as a bounded runtime mechanism rather than as a shortcut around caller authorization.

Distinguish three permission mechanisms

User-assigned permission sets establish the operations that a user can perform directly or indirectly. An object's Permissions property supplies permissions while that object executes. The InherentPermissions attribute applies to a specific method or event and supplies its declared permission only during that attributed scope. These mechanisms don't have interchangeable reach.

InherentPermissions accepts a PermissionObjectType, an object ID or name, a permission text value, and an optional scope. The scope is Permissions, Entitlements, or Both, with Both as the default. The target object must belong to the same extension as the attributed method or event. The attribute doesn't propagate to unrelated methods, callers, or later operations after execution leaves the attributed scope.

For example, this method receives insert permission for an app-owned table only while its body runs:

[InherentPermissions(PermissionObjectType::TableData, Database::"Feature Buffer", 'i', InherentPermissionsScope::Both)]
procedure AddBufferEntry()
var
    FeatureBuffer: Record "Feature Buffer";
begin
    FeatureBuffer.Insert(true);
end;

The lowercase i expresses indirect insert in the attribute's permission text. Its bounded execution context is what makes the operation available to this code path. The attribute doesn't give the caller general insert access to the table.

An object's Permissions property has a wider object-execution boundary. It can support procedures throughout that object when the object executes, subject to the declared permissions and authorization path. A method attribute is more precise when one operation, rather than an entire object, needs the elevation. Direct or indirect permissions assigned to the user remain separate inputs to effective access.

Preserve caller authorization

An inherent permission doesn't make a page, codeunit, method, or event callable. The user still needs normal access to open the page and execute the codeunit that exposes the attributed method. Only after Business Central authorizes that entry path does the method receive its temporary permission.

This distinction supports a two-gate model:

  1. The caller's entitlement and assigned permissions authorize entry to the page, codeunit, or other exposed object.
  2. The attributed method receives the narrow permission needed for its app-owned operation while it executes.

If the caller lacks execute access to the service codeunit, the first gate fails. If the method targets an object in another extension, the same-extension requirement fails. If code outside the attributed method attempts the same table operation, that code doesn't inherit the method's permission.

The scope argument also deserves a deliberate choice. Permissions affects the assigned-permission side, Entitlements affects the entitlement side, and Both addresses both checks for the declared operation. Use the narrowest scope that matches the documented boundary. Don't infer that one scope expands access to other objects or code paths.

Choose a bounded operation

Applying inherent permissions removes the declared permission from administrator control for that code path. Every authorized caller of the method receives that operation while the method runs. Use the attribute only when the method itself enforces a stable, narrow business boundary.

Good candidates include app-owned support tables, staging records, or buffer data that callers shouldn't manipulate directly. A small method that inserts one audit or queue record from validated inputs is easier to reason about than a general method that accepts arbitrary table names, record references, filters, or field values.

Avoid inherent permissions for broad business-data authorization. A method that updates customer, vendor, ledger, or document data based on caller-supplied records can bypass the separation that administrators expect from permission assignments. Prefer explicit assigned permissions and established application authorization for those operations.

Before you add the attribute, ask these questions:

  • Does the extension own the target object?
  • Does the method perform one constrained operation with validated inputs?
  • Does the caller already have normal access to enter this code path?
  • Can an administrator still control access by granting or withholding execute permission to the exposed object?
  • Does a representative nonadministrator fail when attempting the same data operation outside the attributed method?

The exercise applies this model to an app-owned note table. One role can read the page but can't execute the bounded service. Another role gains service execution through a permission set extension, yet still lacks direct insert permission. That contrast demonstrates where the inherent permission starts and stops.

For more information, see Inherent Permissions and Entitlements and permission sets overview.