public final class PolicyScope implements AutoClosable
Authorized lexical view of one EntityManager with one policy disabled.
Repositories and queries created through this scope retain its lifetime token and fail after close(); they cannot escape the authorized lexical block.
try privileged = manager.withoutPolicy(TenantPolicy.type, authorization):
allCustomers = privileged.repository<Customer>().asQuery().toList()| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void |
Invalidates retained privileged queries and emits the closing audit event. |
| public | findfind<T, TId>(id as TId) as T |
Finds by identity with exactly the authorized policy omitted. |
| public | repositoryrepository<T, TId>() as Repository<T, TId> |
Returns a repository with exactly the authorized policy omitted. |
| public | sqlExecutesqlExecute(
sql as String,
parameters as klyn.data.sql.SQLParameters = klyn.data.sql.SQLParameters()
) as Long |
Executes one privileged SQL mutation in the active transaction. |
| public | sqlQuerysqlQuery<T>(
sql as String,
parameters as klyn.data.sql.SQLParameters = klyn.data.sql.SQLParameters()
) as klyn.data.sql.SQLQuery<T> |
Creates a typed raw SQL query when no other active policy applies. |