Applies the user's security filter to a Record variable.
Record.SETPERMISSIONFILTER
|
Remarks
The security filter is combined with other filters that are placed on the Record variable with the SETFILTER Function (Record) or the SETRANGE Function (Record).
The combined filter will not include any records outside the range of the security filter. This will prevent a run-time permission error from occurring when you read the records. If SETPERMISSIONFILTER is not set and if you attempt to read a record that is outside the range of the user's security filter, a permission error can occur.
This C/AL function only applies to Microsoft Dynamics NAV with Microsoft SQL Server.
Security filters are an essential part of record-level security. Security filters limit the access that a user has so that they can only access the records, in the tables that they have permissions for, that match the criteria specified in the security filter.
For more information about record level security, see Supporting Record-Level Security.
Example
This example finds the first record within your read permission security filter. This example requires that you create the following variable in the C/AL Globals window.
Variable name | DataType | Subtype |
---|---|---|
CustomerRec |
Record |
Customer |
Copy Code | |
---|---|
CustomerRec.SETPERMISSIONFILTER; CustomerRec.FIND('-'); |
This example determines whether you have any read permission by setting the current filter as your security filter. This example requires that you create the following variable in the C/AL Globals window.
Variable name | DataType | Subtype |
---|---|---|
CustomerRec |
Record |
Customer |
Copy Code | |
---|---|
CustomerRec.SETPERMISSIONFILTER; If CustomerRec.READPERMISSION THEN MESSAGE('You have some read permissions to Customer.') ELSE MESSAGE('You have no read permission to Customer.'); |
See Also
© 2010 Microsoft Corporation. All rights reserved.