@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.
@@ -3129,6 +3129,31 @@ export declare type PaymentStateTransitionError = ErrorResult & {
3129
3129
  * Permissions for administrators and customers. Used to control access to
3130
3130
  * GraphQL resolvers via the {@link Allow} decorator.
3131
3131
  *
3132
+ * ## Understanding Permission.Owner
3133
+ *
3134
+ * `Permission.Owner` is a special permission which is used in some of the Vendure resolvers to indicate that that resolver should only
3135
+ * be accessible to the "owner" of that resource.
3136
+ *
3137
+ * For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
3138
+ * based on the activeUserId of the current session. As a result, the resolver code looks like this:
3139
+ *
3140
+ * @example
3141
+ * ```TypeScript
3142
+ * \@Query()
3143
+ * \@Allow(Permission.Owner)
3144
+ * async activeCustomer(\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
3145
+ * const userId = ctx.activeUserId;
3146
+ * if (userId) {
3147
+ * return this.customerService.findOneByUserId(ctx, userId);
3148
+ * }
3149
+ * }
3150
+ * ```
3151
+ *
3152
+ * Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
3153
+ * nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner
3154
+ * of the resource has access. If not, then it is the equivalent of using `Permission.Public`.
3155
+ *
3156
+ *
3132
3157
  * @docsCategory common
3133
3158
  */
3134
3159
  export declare enum Permission {
@@ -1 +1 @@
1
- export declare const ADMIN_UI_VERSION = "1.5.0";
1
+ export declare const ADMIN_UI_VERSION = "1.5.1";