checkPermission method
Checks if the current request has the required permissions.
The auth
parameter is an optional WaAuthController used for permission checking.
Returns a Future<bool> indicating whether the permission check was successful.
Implementation
Future<bool> checkPermission(WaAuthController? auth) async {
if (auth == null) {
return true;
}
var res = await auth.checkPermission();
if (!res) {
rq.renderError(403, message: 'Access denied!', toData: rq.isApiEndpoint);
}
return res;
}