错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Access Control and Permissions

  • Konstantin Kapitanov

摘要

In Apex, there are two types of execution contexts such as system execution context and user execution context. User execution context is when a user clicks a button or link, for example, that executes Apex code. When a system event or process executes Apex code, a system execution context is created. Apex does not enforce object-level and field-level permissions in system mode by default, but the new AccessLevel class represents the two modes in which Apex runs database operations. You can use this class to define the execution mode as user mode or system mode. The key difference between the previously used WITH SECURITY_ENFORCED keyword and the new AccessLevel class is that the AccessLevel class allows you to specify the mode of execution as either user mode or system mode. In user mode, the code respects the field-level security (FLS), object permissions, and sharing rules of the running user. On the other hand, in system mode, the class sharing keywords control the sharing rules.