Bewerken

Delen via


AppSourceCop Warning AS0094

Permission Sets should not be defined in XML files.

Description

Permission sets should not be defined in XML. Instead, use the dedicated AL object for 'PermissionSet'.

Example of XML file triggering the rule

<?xml version="1.0" encoding=""utf-8""?>
<PermissionSets>
  <PermissionSet RoleID="TestProjectPermissionSet" RoleName="Default">
    <Permission>
      <ObjectType>8</ObjectType>
      <ObjectID>70001</ObjectID>
      <ReadPermission>1</ReadPermission>
      <InsertPermission>1</InsertPermission>
      <ModifyPermission>1</ModifyPermission>
      <DeletePermission>1</DeletePermission>
      <ExecutePermission>0</ExecutePermission>
      <SecurityFilter />
    </Permission>
  </PermissionSet>
</PermissionSets>

Converted into a PermissionSet object

For a table called "Floor Manager" with object ID 70001, we can convert the above permissions defined in XML into a permission set object defined in AL as shown below:

permissionset 50130 MyPermissionSet 
{ 
    Assignable = true;
    Caption = 'My PermissionSet';

    Permissions = 
        tabledata "Floor Manager" = RIMD;
} 

The RIMD access allows access to Read, Insert, Modify, and Delete entries in the table. This can be modified by adding and removing letters corresponding to the first letter of the permission that you want to (dis)allow. This permission set can then be assigned to users/roles.

How to fix this diagnostic?

You can convert XML permission sets to AL objects. For more information, see Upgrading Permissions Sets and Permissions.

PermissionSet Object AppSourceCop Analyzer
Get Started with AL
Developing Extensions