Notes
WITH SECURITY_ENFORCED applies field- and object-level security checks only to fields and objects referenced in SELECT or FROM SOQL clauses and not clauses like WHERE or ORDER BY. In other words, security is enforced on what the SOQL SELECT query returns, not on all the elements that go into running the query.
If any fields or objects referenced in the SOQL SELECT query using WITH SECURITY_ENFORCED are inaccessible to the user, a System.QueryException is thrown, and no data is returned.
List<Account> act1 = [SELECT Id, (SELECT LastName FROM Contacts),
(SELECT Description FROM Opportunities)
FROM Account WITH SECURITY_ENFORCED]
If field access for either LastName or Description is hidden, this query throws an exception indicating insufficient permissions.
List<Account> act2 = [SELECT Id, parent.Name, parent.Website
FROM Account WITH SECURITY_ENFORCED]
If field access for Website is hidden, this query throws an exception indicating insufficient permissions.
List<AggregateResult> agr1 = [SELECT GROUPING(Type)
FROM Opportunity WITH SECURITY_ENFORCED
GROUP BY Type]
If field access for Type is hidden, this aggregate function query throws an exception indicating insufficient permissions.
Video
Video does not exists.