@vendure/admin-ui 1.5.0 → 1.5.1

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.
@@ -2467,6 +2467,31 @@
2467
2467
  * Permissions for administrators and customers. Used to control access to
2468
2468
  * GraphQL resolvers via the {@link Allow} decorator.
2469
2469
  *
2470
+ * ## Understanding Permission.Owner
2471
+ *
2472
+ * `Permission.Owner` is a special permission which is used in some of the Vendure resolvers to indicate that that resolver should only
2473
+ * be accessible to the "owner" of that resource.
2474
+ *
2475
+ * For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
2476
+ * based on the activeUserId of the current session. As a result, the resolver code looks like this:
2477
+ *
2478
+ * @example
2479
+ * ```TypeScript
2480
+ * \@Query()
2481
+ * \@Allow(Permission.Owner)
2482
+ * async activeCustomer(\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
2483
+ * const userId = ctx.activeUserId;
2484
+ * if (userId) {
2485
+ * return this.customerService.findOneByUserId(ctx, userId);
2486
+ * }
2487
+ * }
2488
+ * ```
2489
+ *
2490
+ * Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
2491
+ * nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner
2492
+ * of the resource has access. If not, then it is the equivalent of using `Permission.Public`.
2493
+ *
2494
+ *
2470
2495
  * @docsCategory common
2471
2496
  */
2472
2497
  exports.Permission = void 0;
@@ -14061,7 +14086,7 @@
14061
14086
  }
14062
14087
 
14063
14088
  // Auto-generated by the set-version.js script.
14064
- var ADMIN_UI_VERSION = '1.5.0';
14089
+ var ADMIN_UI_VERSION = '1.5.1';
14065
14090
 
14066
14091
  /**
14067
14092
  * Responsible for registering dashboard widget components and querying for layouts.