Hi, Readers.
Today I want to discuss a question I’ve been asked recently: do users really need permissions for Temporary Tables? Here is the specific question.
Is it necessary to give any permissions to a user for a table that is only used as temporary? I understand that temporary tables are only stored in memory hence making no modifications to a database but in terms of restrictions does business central treat temporary and non-temporary tables the same?
First, in Business Central, to open a page, you need at least three types of permissions: Table Data, Table, and Page.
Table Data: The Table Data refers to the data stored in the table.
You can set Read, Insert, Modify, Delete permission for Table Data. But cannot set Execute permission in Permissions page.

Table: Table is the same as other object types such as Report, Codeunit, XMLPort, etc. referring to the Table Object themselves. For example, the definition of the tables, the triggers, functions, and the keys of the table.

So, in contrast to Table Data, you can set Execute permission, but cannot set Read, Insert, Modify, Delete permission for Table.

But if you want users to access data on the UI, you need to set at least add the Execute permission of Page, Table object and the Read permission of Table Data. Otherwise users will not be able to search and open the page.

For example, if I exclude the permission for Table Data 289 Payment Method, the user will not be able to search for this page.



If the user forces open this page via the URL, a permission error will be prompted.

What if the source table is a temporary table, or we set the SourceTableTemporary property to true? Can the user still open it? Let me do a quick test.
PS: How to check if a record/table is temporary via AL
I copied the standard page to create a new Payment Methods page and set the SourceTableTemporary property to true.

At this point, the user can search for this page, open it, and add, modify, or delete data.



PS: Users with permissions can see both the standard page and the new page.

Therefore, as long as it’s a temporary table, the user does not need Table Data permissions for that table. This is also mentioned in the Microsoft documentation below. More details: Permissions and temporary tables
Temporary tables don’t require the user to have permissions on the underlying table. Because temporary table data is held only in memory and never read from or written to the database, the permission system doesn’t apply. A user can create, read, modify, and delete records in a temporary table even if they have no permissions defined for that table.

Great, give it a try!!!😁
PS:
1. Creating Report with temporary table
2. TableType Property = Temporary
3. IntelliSense indicator for temporary tables and IntelliSense suggestion for enum ordinal value
4. Difference between Table Data and Table in Permissions
END
Hope this will help.
Thanks for reading.
ZHU




コメント