MCPcopy
hub / github.com/directus/directus / createOne

Method createOne

api/src/services/access.ts:19–33  ·  view source on GitHub ↗
(data: Partial<Item>, opts: MutationOptions = {})

Source from the content-addressed store, hash-verified

17 }
18
19 override async createOne(data: Partial<Item>, opts: MutationOptions = {}): Promise<PrimaryKey> {
20 // Creating a new policy attachments affects the number of admin/app/api users.
21 // But it can only add app or admin users, so no need to check the remaining admin users.
22 opts.userIntegrityCheckFlags =
23 (opts.userIntegrityCheckFlags ?? UserIntegrityCheckFlag.None) | UserIntegrityCheckFlag.UserLimits;
24
25 opts.onRequireUserIntegrityCheck?.(opts.userIntegrityCheckFlags);
26
27 const result = await super.createOne(data, opts);
28
29 // A new policy has been attached to a user or a role, clear the caches
30 await this.clearCaches();
31
32 return result;
33 }
34
35 override async updateMany(
36 keys: PrimaryKey[],

Callers 2

createAdminFunction · 0.95
rolesCreateFunction · 0.95

Calls 2

clearCachesMethod · 0.95
createOneMethod · 0.65

Tested by

no test coverage detected