Skip to content

Commit 70d5f7b

Browse files
committed
Dynamic Entitiy flags
1 parent 9a2bf92 commit 70d5f7b

2 files changed

Lines changed: 118 additions & 5 deletions

File tree

src/routes/(protected)/dynamic-entities/system/[id]/+page.svelte

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@
230230
entity_name: entityName,
231231
schema: schema,
232232
has_personal_entity: entity.has_personal_entity || false,
233+
has_public_access: entity.has_public_access || false,
234+
has_community_access: entity.has_community_access || false,
233235
};
234236
}
235237
@@ -447,6 +449,52 @@
447449
{/if}
448450
</dd>
449451
</div>
452+
<div>
453+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
454+
Has Public Access
455+
</dt>
456+
<dd class="mt-1 text-sm">
457+
{#if entity.has_public_access}
458+
<span
459+
class="inline-flex items-center rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200"
460+
>
461+
Yes
462+
</span>
463+
<p class="mt-1 font-mono text-xs text-blue-600 dark:text-blue-400">
464+
GET /obp/dynamic-entity/public/{entityName}
465+
</p>
466+
{:else}
467+
<span
468+
class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-200"
469+
>
470+
No
471+
</span>
472+
{/if}
473+
</dd>
474+
</div>
475+
<div>
476+
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
477+
Has Community Access
478+
</dt>
479+
<dd class="mt-1 text-sm">
480+
{#if entity.has_community_access}
481+
<span
482+
class="inline-flex items-center rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200"
483+
>
484+
Yes
485+
</span>
486+
<p class="mt-1 font-mono text-xs text-blue-600 dark:text-blue-400">
487+
GET /obp/dynamic-entity/community/{entityName}
488+
</p>
489+
{:else}
490+
<span
491+
class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-200"
492+
>
493+
No
494+
</span>
495+
{/if}
496+
</dd>
497+
</div>
450498
<div class="sm:col-span-2">
451499
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">
452500
Description

src/routes/(protected)/dynamic-entities/system/create/+page.svelte

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"required": ["name"]
3535
}`);
3636
let hasPersonalEntity = $state(false);
37+
let hasPublicAccess = $state(false);
38+
let hasCommunityAccess = $state(false);
3739
let isSubmitting = $state(false);
3840
let schemaError = $state("");
3941
@@ -89,6 +91,8 @@
8991
properties: schema.properties,
9092
},
9193
has_personal_entity: hasPersonalEntity,
94+
has_public_access: hasPublicAccess,
95+
has_community_access: hasCommunityAccess,
9296
};
9397
9498
const response = await fetch(`/api/dynamic-entities/system/create`, {
@@ -232,6 +236,58 @@
232236
</div>
233237
</div>
234238

239+
<!-- Has Public Access -->
240+
<div>
241+
<div class="flex items-start">
242+
<div class="flex h-6 items-center">
243+
<input
244+
type="checkbox"
245+
id="hasPublicAccess"
246+
bind:checked={hasPublicAccess}
247+
class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
248+
/>
249+
</div>
250+
<div class="ml-3">
251+
<label
252+
for="hasPublicAccess"
253+
class="text-sm font-medium text-gray-700 dark:text-gray-300"
254+
>
255+
Has Public Access
256+
</label>
257+
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
258+
When enabled, records of this entity type can be accessed publicly
259+
without authentication.
260+
</p>
261+
</div>
262+
</div>
263+
</div>
264+
265+
<!-- Has Community Access -->
266+
<div>
267+
<div class="flex items-start">
268+
<div class="flex h-6 items-center">
269+
<input
270+
type="checkbox"
271+
id="hasCommunityAccess"
272+
bind:checked={hasCommunityAccess}
273+
class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
274+
/>
275+
</div>
276+
<div class="ml-3">
277+
<label
278+
for="hasCommunityAccess"
279+
class="text-sm font-medium text-gray-700 dark:text-gray-300"
280+
>
281+
Has Community Access
282+
</label>
283+
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
284+
When enabled, records of this entity type can be accessed by any
285+
authenticated user (community member).
286+
</p>
287+
</div>
288+
</div>
289+
</div>
290+
235291
<!-- Schema JSON -->
236292
<div>
237293
<label
@@ -271,20 +327,29 @@
271327
</li>
272328
<li>
273329
<strong>type:</strong> Can be "string", "number", "integer", "boolean",
274-
"json", "DATE_WITH_DAY"
275-
</li>
276-
<li>
277-
<strong>required:</strong> Array of required field names (optional)
330+
"json", "DATE_WITH_DAY" (also "reference:..." types)
278331
</li>
279332
<li>
280-
<strong>minimum/maximum:</strong> For numeric validation (optional)
333+
<strong>required:</strong> Array of required field names (must be present, can be empty [])
281334
</li>
282335
<li>
283336
<strong>minLength/maxLength:</strong> For string validation (optional)
284337
</li>
285338
<li>
286339
<strong>example:</strong> Example value for the field (required)
287340
</li>
341+
<li>
342+
<strong>description:</strong> Human-readable description of the field (optional)
343+
</li>
344+
<li>
345+
<strong>has_personal_entity:</strong> Allow each user to create their own private records (optional, default true)
346+
</li>
347+
<li>
348+
<strong>has_public_access:</strong> Allow unauthenticated public access to records (optional, default false)
349+
</li>
350+
<li>
351+
<strong>has_community_access:</strong> Allow any authenticated user with CanGet role to access ALL records (optional, default false)
352+
</li>
288353
</ul>
289354
{#if data.externalLinks?.API_EXPLORER_URL}
290355
<div class="mt-3 border-t border-blue-300 pt-3 dark:border-blue-700">

0 commit comments

Comments
 (0)