Skip to content

Commit

Permalink
Merge branch 'dev' into ascott/audit-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 authored Oct 30, 2023
2 parents 70343f5 + 9cd153e commit 7919c8a
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ IDataSourceParameters parameters
/// <summary>
/// Maps the incoming DTO's properties to the item that will be saved to the database.
/// </summary>
/// <param name="kind">Descriminator between a create and a update operation.</param>
/// <param name="kind">Discriminator between a create and a update operation.</param>
/// <param name="item">The item that will be saved to the database.</param>
/// <param name="dto">The incoming item from the client.</param>
/// <param name="parameters">The additional parameters sent by the client.</param>
Expand Down
7 changes: 5 additions & 2 deletions src/IntelliTect.Coalesce/DataAnnotations/CreateAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
namespace IntelliTect.Coalesce.DataAnnotations
{
/// <summary>
/// Should users be allowed to create an entity via the API/button.
/// </summary>
/// <para>
/// When placed on an entity or custom <see cref="IClassDto{T}"/> class exposed by Coalesce,
/// controls the permissions for saving new instances of the model via the /save or /bulkSave endpoints.
/// </para>
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public sealed class CreateAttribute : SecurityAttribute
{
Expand Down
7 changes: 5 additions & 2 deletions src/IntelliTect.Coalesce/DataAnnotations/DeleteAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
namespace IntelliTect.Coalesce.DataAnnotations
{
/// <summary>
/// Should users be allowed to delete an entity via the API/button.
/// </summary>
/// <para>
/// When placed on an entity or custom <see cref="IClassDto{T}"/> class exposed by Coalesce,
/// controls the permissions for the deleting existing instances of the model via the /delete or /bulkSave endpoints.
/// </para>
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class DeleteAttribute : SecurityAttribute
{
Expand Down
12 changes: 10 additions & 2 deletions src/IntelliTect.Coalesce/DataAnnotations/EditAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
namespace IntelliTect.Coalesce.DataAnnotations
{
/// <summary>
/// The Class or Property is read/write for the users and groups and not accessible to others.
/// <para>
/// When placed on an entity or custom <see cref="IClassDto{T}"/> class exposed by Coalesce,
/// controls the permissions for modifying existing instances of the model via the /save or /bulkSave endpoints.
/// </para>
/// <para>
/// When placed on a property exposed by Coalesce, controls the roles that are allowed
/// to send data from the client to the server for that property for any purpose,
/// including the /save and /bulkSave APIs, and method parameters.
/// </para>
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
public class EditAttribute: SecurityAttribute
public class EditAttribute : SecurityAttribute
{
public EditAttribute()
{
Expand Down
11 changes: 9 additions & 2 deletions src/IntelliTect.Coalesce/DataAnnotations/ReadAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@

namespace IntelliTect.Coalesce.DataAnnotations
{

/// <summary>
/// <para>
/// The Class or Property is read only for the users and groups and not accessible to others.
/// If no roles are specified, the target is readable by anyone.
/// When placed on an entity or custom <see cref="IClassDto{T}"/> class exposed by Coalesce,
/// controls the permissions for fetching existing instances of the model from
/// the /get, /list, and /count endpoints.
/// </para>
/// <para>
/// When placed on a property exposed by Coalesce, controls the roles that are allowed
/// to read data from that property for any usage of the parent model,
/// including when the model is a custom method result or a nested child of another model.
/// </para>
/// <para>If specified on a property with no <see cref="EditAttribute"/>, the property is read-only.</para>
/// </summary>
Expand Down
13 changes: 8 additions & 5 deletions src/coalesce-vue-vuetify3/src/components/input/c-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
:item="internalModelValue"
:search="search"
>
<slot name="item" :item="internalModelValue" :search="search">
<span style="overflow: hidden">
<c-display :model="internalModelValue" />
</span>
</slot>
<span class="v-select__selection">
<slot name="item" :item="internalModelValue" :search="search">
<c-display
class="v-select__selection-text"
:model="internalModelValue"
/>
</slot>
</span>
</slot>

<input
Expand Down
7 changes: 7 additions & 0 deletions src/coalesce-vue/src/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2007,3 +2007,10 @@ declare module "@vue/reactivity" {
coalesceApiModels: ApiState<any, any> | ApiClient<any>;
}
}

// The vue2 version of this interface:
declare module "vue" {
export interface RefUnwrapBailTypes {
coalesceApiModels: ApiState<any, any> | ApiClient<any>;
}
}
10 changes: 5 additions & 5 deletions src/coalesce-vue/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function isNullOrWhitespace(value: string | null | undefined) {
}

const iso8601DateRegex =
/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?)?/;
/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:(Z)|(.)(\d{2}):?(\d{2})?)?)?/;
const iso8601TimeRegex =
/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?$/;

Expand Down Expand Up @@ -90,17 +90,17 @@ export function parseJSONDate(argument: string, kind: DateKind = "datetime") {

var parts = argument.match(iso8601DateRegex) || [];

const part9 = parts[9]; // TZ offset
const partTzOffset = parts[8] == "Z" ? 0 : parts[10]; // TZ offset

if (part9 !== undefined) {
if (partTzOffset !== undefined) {
// Date+Time, with offset specifier
return new Date(
Date.UTC(
+parts[1],
+parts[2] - 1,
+parts[3],
+parts[4] - (+part9 || 0) * (parts[8] == "-" ? -1 : 1),
+parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1),
+parts[4] - (+partTzOffset || 0) * (parts[9] == "-" ? -1 : 1),
+parts[5] - (+parts[11] || 0) * (parts[9] == "-" ? -1 : 1),
+parts[6],
+((parts[7] || "0") + "00").substring(0, 3)
)
Expand Down
7 changes: 7 additions & 0 deletions src/coalesce-vue/src/viewmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2219,3 +2219,10 @@ declare module "@vue/reactivity" {
coalesceViewModels: ViewModel | ListViewModel | ServiceViewModel;
}
}

// The vue2 version of this interface:
declare module "vue" {
export interface RefUnwrapBailTypes {
coalesceViewModels: ViewModel | ListViewModel | ServiceViewModel;
}
}
10 changes: 10 additions & 0 deletions src/coalesce-vue/test/model.toModel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ const dtoToModelMappings = <MappingData[]>[
dto: "2020-06-10T21:00:00+00:00",
model: new Date(1591822800000),
},
{
meta: studentProps.birthDate,
dto: "2020-06-10T21:00:00-00:30",
model: new Date(1591824600000),
},
{
// Dates without timezone should be assumed to be local time.
meta: studentProps.birthDate,
Expand All @@ -86,6 +91,11 @@ const dtoToModelMappings = <MappingData[]>[
dto: "2020-06-10",
model: new Date(2020, 5, 10, 0, 0, 0, 0),
},
{
meta: { ...studentProps.birthDate, dateKind: "date" },
dto: "2020-06-10T14:00:00Z",
model: new Date(1591797600000),
},
{
meta: { ...studentProps.birthDate, dateKind: "time" },
dto: "12:34:56",
Expand Down

0 comments on commit 7919c8a

Please sign in to comment.