From 8080af49e110deca5f8b7a13d66dbe001ce548e0 Mon Sep 17 00:00:00 2001 From: Warren Parad Date: Wed, 14 Feb 2024 11:59:25 +0100 Subject: [PATCH] Fix usage of invite statements. --- CHANGELOG.md | 1 + .../Model/AccessRecordStatements.cs | 16 ++++++++++ src/Authress.SDK/Model/Invite.cs | 31 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e98a0e8..9d81e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This is the changelog for [Authress SDK](readme.md). ## 1.5 ## * Fix `DateTimeOffset` type assignments, properties that were incorrectly defined as `DateTime` are now correctly `DateTimeOffsets`. * Add in `VerifyToken()` method to `AuthressClient`.. +* Fix `Invite` Statement usage to use dedicated InviteStatement. ## 1.4 ## * Support exponential back-off retries on unexpected failures. diff --git a/src/Authress.SDK/Model/AccessRecordStatements.cs b/src/Authress.SDK/Model/AccessRecordStatements.cs index 0d4dc02..cad23bf 100644 --- a/src/Authress.SDK/Model/AccessRecordStatements.cs +++ b/src/Authress.SDK/Model/AccessRecordStatements.cs @@ -23,5 +23,21 @@ public class AccessRecordStatements [DataMember(Name = "resources", EmitDefaultValue = false)] [JsonProperty(PropertyName = "resources")] public List Resources { get; set; } + + /// + /// The list of users this record statement applies to + /// + /// The list of users this record statement applies to + [DataMember(Name = "users", EmitDefaultValue = false)] + [JsonProperty(PropertyName = "users")] + public List Users { get; set; } + + /// + /// The list of groups this record statement applies to. Users in these groups will be receive access to the resources listed. + /// + /// The list of groups this record statement applies to. Users in these groups will be receive access to the resources listed. + [DataMember(Name = "groups", EmitDefaultValue = false)] + [JsonProperty(PropertyName = "groups")] + public List Groups { get; set; } = new List(); } } diff --git a/src/Authress.SDK/Model/Invite.cs b/src/Authress.SDK/Model/Invite.cs index 97e6df8..f4213b9 100644 --- a/src/Authress.SDK/Model/Invite.cs +++ b/src/Authress.SDK/Model/Invite.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Runtime.Serialization; +using Newtonsoft.Json; namespace Authress.SDK.DTO { @@ -16,12 +17,19 @@ public class Invite [DataMember(Name="inviteId", EmitDefaultValue=false)] public string InviteId { get; private set; } + /// + /// Specify the tenant associated with the invite. The invited user must use this tenant's connection configuration to log in. + /// + /// Specify the tenant associated with the invite. The invited user must use this tenant's connection configuration to log in. + [DataMember(Name="tenantId", EmitDefaultValue=false)] + public string TenantId { get; private set; } + /// /// A list of statements which match roles to resources. The invited user will all statements apply to them /// /// A list of statements which match roles to resources. The invited user will all statements apply to them [DataMember(Name="statements", EmitDefaultValue=false)] - public List Statements { get; set; } + public List Statements { get; set; } /// /// Gets or Sets Links @@ -29,4 +37,25 @@ public class Invite [DataMember(Name="links", EmitDefaultValue=false)] public Links Links { get; set; } } + + /// + /// + /// + [DataContract] + public class InviteStatement + { + /// + /// Gets or Sets Roles + /// + [DataMember(Name = "roles", EmitDefaultValue = false)] + [JsonProperty(PropertyName = "roles")] + public List Roles { get; set; } + + /// + /// Gets or Sets Resources + /// + [DataMember(Name = "resources", EmitDefaultValue = false)] + [JsonProperty(PropertyName = "resources")] + public List Resources { get; set; } + } }