@punks/backend-entity-manager 0.0.195 → 0.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -2835,11 +2835,18 @@ class QueryClauseBuilder {
2835
2835
  }
2836
2836
  }
2837
2837
 
2838
+ class PermissionsChecker {
2839
+ hasPermission(context, permissions) {
2840
+ return (context.userPermissions?.some((p) => permissions.includes(p.uid)) ?? false);
2841
+ }
2842
+ }
2843
+
2838
2844
  class TypeOrmQueryBuilder extends QueryBuilderBase {
2839
2845
  constructor(services) {
2840
2846
  super();
2841
2847
  this.services = services;
2842
2848
  this.clause = new QueryClauseBuilder();
2849
+ this.permissions = new PermissionsChecker();
2843
2850
  }
2844
2851
  async get(id, context) {
2845
2852
  return await this.getRepository().get(id, {