get method
Future<Map<String, dynamic> >
get(
- String key,
- DbPrincipal principal, {
- SearchPolicy? searchPolicy,
- RepositoryTransaction? transaction,
Retrieves an entity from the collection identified by the key
parameter.
This method expects a principal
parameter, which
identifies the user performing the request. Implementations
are advised to confirm if the entity being returned belongs to
a tenant related to the principal
.
If a non-empty value is passed to the permission
parameter,
the implementation of this method is expected to validate
if the user represented by the principal
does have the
permission before actually returning the entity. Otherwise,
an error is thrown.
Implementation
@override
Future<Map<String, dynamic>> get(
String key,
DbPrincipal principal, {
SearchPolicy? searchPolicy,
RepositoryTransaction? transaction,
}) async {
final map = await _get(
key,
principal,
transaction: transaction,
filterByTenant: searchPolicy?.filterByTenant ?? true,
);
searchPolicy ??= this.searchPolicy;
handleMetaForGet(map, principal, searchPolicy);
_authorize(map, principal, searchPolicy);
return map;
}