PolicyScope
classin packageklyn.data
public final class PolicyScope implements AutoClosable:
PolicyScope
All Implemented Interfaces: 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()
Methods
Modifier and Type Member Description
public close
close() as Void:
Invalidates retained privileged queries and emits the closing audit event.
public find
find<T, TId>(id as TId) as T:
Finds by identity with exactly the authorized policy omitted.
public repository
repository<T, TId>() as Repository<T, TId>:
Returns a repository with exactly the authorized policy omitted.
public sqlExecute
sqlExecute( 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 sqlQuery Creates a typed raw SQL query when no other active policy applies.
Inherited Methods
methodInherited Methods from AutoClosable: close