diff --git a/sdk b/sdk
index c1628df..6f00d65 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit c1628df47438a3bd54300abf0b9d6ca345417302
+Subproject commit 6f00d65bb59fa9cd9fd84d2f8a801f44c6ad3dc2
diff --git a/src/Commands/Publisher/ChildPublishers/AddChildPublisherCommand.cs b/src/Commands/Publisher/ChildPublishers/AddChildPublisherCommand.cs
index df24b46..17b7264 100644
--- a/src/Commands/Publisher/ChildPublishers/AddChildPublisherCommand.cs
+++ b/src/Commands/Publisher/ChildPublishers/AddChildPublisherCommand.cs
@@ -15,20 +15,23 @@ public class AddChildPublisherCommand : Command
///
/// Initializes a new instance of the class.
///
- public AddChildPublisherCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption)
+ public AddChildPublisherCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption, Option roleIdOption, Option roleNameOption, Option roleDescriptionOption)
: base("add", "Adds a child publisher to the Publisher.")
{
AddOption(repoOption);
AddOption(idOption);
AddOption(publisherIdOption);
+ AddOption(roleIdOption);
+ AddOption(roleNameOption);
+ AddOption(roleDescriptionOption);
- this.SetHandler(InvokeAsync, repoOption, idOption, publisherIdOption);
+ this.SetHandler(InvokeAsync, repoOption, idOption, publisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption);
this.Config = config;
}
protected WacsdkCommandConfig Config { get; init; }
- public async Task InvokeAsync(string repo, string id, string publisherId)
+ public async Task InvokeAsync(string repo, string id, string publisherId, string roleId, string roleName, string roleDescription)
{
Guard.IsNotNullOrWhiteSpace(publisherId);
@@ -43,8 +46,19 @@ public async Task InvokeAsync(string repo, string id, string publisherId)
var childPublisher = await GetPublisherByIdAsync(repo, publisherId, cancellationToken);
Logger.LogInformation($"Got {nameof(childPublisher.Id)}: {childPublisher.Id}");
+ var role = new Role
+ {
+ Id = roleId,
+ Name = roleName,
+ Description = roleDescription
+ };
+
+ var readOnlyPublisher = childPublisher is ModifiablePublisher modifiablePublisher ? modifiablePublisher.InnerPublisher : (ReadOnlyPublisher)childPublisher;
+
+ var publisherRole = new ReadOnlyPublisherRole { Role = role, InnerPublisher = readOnlyPublisher };
+
Logger.LogInformation($"Adding child publisher to collection");
- await publisher.ChildPublishers.AddPublisherAsync(childPublisher, cancellationToken);
+ await publisher.ChildPublishers.AddPublisherAsync(publisherRole, cancellationToken);
Logger.LogInformation($"Publishing changes");
await PublishAsync(publisher, cancellationToken);
diff --git a/src/Commands/Publisher/ChildPublishers/ChildPublishersCommand.cs b/src/Commands/Publisher/ChildPublishers/ChildPublishersCommand.cs
index 0a70b48..b3f52ec 100644
--- a/src/Commands/Publisher/ChildPublishers/ChildPublishersCommand.cs
+++ b/src/Commands/Publisher/ChildPublishers/ChildPublishersCommand.cs
@@ -10,11 +10,11 @@ public class ChildPublishersCommand : Command
///
/// Initializes a new instance of the class.
///
- public ChildPublishersCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption)
+ public ChildPublishersCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption, Option roleIdOption, Option roleNameOption, Option roleDescriptionOption)
: base("child-publishers", "Manages the child publishers of the Publisher.")
{
AddCommand(new GetChildPublishersCommand(config, repoOption, idOption));
- AddCommand(new AddChildPublisherCommand(config, repoOption, idOption, publisherIdOption));
+ AddCommand(new AddChildPublisherCommand(config, repoOption, idOption, publisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption));
AddCommand(new RemoveChildPublisherCommand(config, repoOption, idOption, publisherIdOption));
}
}
\ No newline at end of file
diff --git a/src/Commands/Publisher/ChildPublishers/RemoveChildPublisherCommand.cs b/src/Commands/Publisher/ChildPublishers/RemoveChildPublisherCommand.cs
index 41a418e..30060e4 100644
--- a/src/Commands/Publisher/ChildPublishers/RemoveChildPublisherCommand.cs
+++ b/src/Commands/Publisher/ChildPublishers/RemoveChildPublisherCommand.cs
@@ -40,7 +40,7 @@ public async Task InvokeAsync(string repo, string id, string publisherId)
Logger.LogInformation($"Got {nameof(publisher.Id)}: {publisher.Id}");
Logger.LogInformation($"Getting child publisher to remove");
- var childPublisher = await GetPublisherByIdAsync(repo, publisherId, cancellationToken);
+ var childPublisher = await publisher.ChildPublishers.GetPublishersAsync(cancellationToken).FirstAsync(p => p.Id == publisherId, cancellationToken);
Logger.LogInformation($"Got {nameof(childPublisher.Id)}: {childPublisher.Id}");
Logger.LogInformation($"Removing child publisher from collection");
diff --git a/src/Commands/Publisher/ParentPublishers/AddParentPublisherCommand.cs b/src/Commands/Publisher/ParentPublishers/AddParentPublisherCommand.cs
index 1e79dc3..bf52467 100644
--- a/src/Commands/Publisher/ParentPublishers/AddParentPublisherCommand.cs
+++ b/src/Commands/Publisher/ParentPublishers/AddParentPublisherCommand.cs
@@ -15,20 +15,23 @@ public class AddParentPublisherCommand : Command
///
/// Initializes a new instance of the class.
///
- public AddParentPublisherCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption)
+ public AddParentPublisherCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption, Option roleIdOption, Option roleNameOption, Option roleDescriptionOption)
: base("add", "Adds a parent publisher to the Publisher.")
{
AddOption(repoOption);
AddOption(idOption);
AddOption(publisherIdOption);
+ AddOption(roleIdOption);
+ AddOption(roleNameOption);
+ AddOption(roleDescriptionOption);
- this.SetHandler(InvokeAsync, repoOption, idOption, publisherIdOption);
+ this.SetHandler(InvokeAsync, repoOption, idOption, publisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption);
this.Config = config;
}
protected WacsdkCommandConfig Config { get; init; }
- public async Task InvokeAsync(string repo, string id, string publisherId)
+ public async Task InvokeAsync(string repo, string id, string publisherId, string roleId, string roleName, string roleDescription)
{
Guard.IsNotNullOrWhiteSpace(publisherId);
@@ -40,11 +43,22 @@ public async Task InvokeAsync(string repo, string id, string publisherId)
Logger.LogInformation($"Got {nameof(publisher.Id)}: {publisher.Id}");
Logger.LogInformation($"Getting parent publisher");
- var parentPublisher = await GetPublisherByIdAsync(repo, publisherId, cancellationToken);
- Logger.LogInformation($"Got {nameof(parentPublisher.Id)}: {parentPublisher.Id}");
+ var childPublisher = await GetPublisherByIdAsync(repo, publisherId, cancellationToken);
+ Logger.LogInformation($"Got {nameof(childPublisher.Id)}: {childPublisher.Id}");
+
+ var role = new Role
+ {
+ Id = roleId,
+ Name = roleName,
+ Description = roleDescription
+ };
+
+ var readOnlyPublisher = childPublisher is ModifiablePublisher modifiablePublisher ? modifiablePublisher.InnerPublisher : (ReadOnlyPublisher)childPublisher;
+
+ var publisherRole = new ReadOnlyPublisherRole { Role = role, InnerPublisher = readOnlyPublisher };
Logger.LogInformation($"Adding parent publisher to collection");
- await publisher.ParentPublishers.AddPublisherAsync(parentPublisher, cancellationToken);
+ await publisher.ParentPublishers.AddPublisherAsync(publisherRole, cancellationToken);
Logger.LogInformation($"Publishing changes");
await PublishAsync(publisher, cancellationToken);
diff --git a/src/Commands/Publisher/ParentPublishers/ParentPublishersCommand.cs b/src/Commands/Publisher/ParentPublishers/ParentPublishersCommand.cs
index 215e37d..159404b 100644
--- a/src/Commands/Publisher/ParentPublishers/ParentPublishersCommand.cs
+++ b/src/Commands/Publisher/ParentPublishers/ParentPublishersCommand.cs
@@ -10,11 +10,11 @@ public class ParentPublishersCommand : Command
///
/// Initializes a new instance of the class.
///
- public ParentPublishersCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption)
+ public ParentPublishersCommand(WacsdkCommandConfig config, Option repoOption, Option idOption, Option publisherIdOption, Option roleIdOption, Option roleNameOption, Option roleDescriptionOption)
: base("parent-publishers", "Manages the parent publishers of the Publisher.")
{
AddCommand(new GetParentPublishersCommand(config, repoOption, idOption));
- AddCommand(new AddParentPublisherCommand(config, repoOption, idOption, publisherIdOption));
+ AddCommand(new AddParentPublisherCommand(config, repoOption, idOption, publisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption));
AddCommand(new RemoveParentPublisherCommand(config, repoOption, idOption, publisherIdOption));
}
}
\ No newline at end of file
diff --git a/src/Commands/Publisher/ParentPublishers/RemoveParentPublisherCommand.cs b/src/Commands/Publisher/ParentPublishers/RemoveParentPublisherCommand.cs
index 77b4eb2..2b1bd64 100644
--- a/src/Commands/Publisher/ParentPublishers/RemoveParentPublisherCommand.cs
+++ b/src/Commands/Publisher/ParentPublishers/RemoveParentPublisherCommand.cs
@@ -40,7 +40,7 @@ public async Task InvokeAsync(string repo, string id, string publisherId)
Logger.LogInformation($"Got {nameof(publisher.Id)}: {publisher.Id}");
Logger.LogInformation($"Getting parent publisher to remove");
- var parentPublisher = await GetPublisherByIdAsync(repo, publisherId, cancellationToken);
+ var parentPublisher = await publisher.ParentPublishers.GetPublishersAsync(cancellationToken).FirstAsync(p => p.Id == publisherId, cancellationToken);
Logger.LogInformation($"Got {nameof(parentPublisher.Id)}: {parentPublisher.Id}");
Logger.LogInformation($"Removing parent publisher from collection");
diff --git a/src/Commands/Publisher/WacsdkPublisherCommands.cs b/src/Commands/Publisher/WacsdkPublisherCommands.cs
index e8c024f..aec8706 100644
--- a/src/Commands/Publisher/WacsdkPublisherCommands.cs
+++ b/src/Commands/Publisher/WacsdkPublisherCommands.cs
@@ -74,8 +74,8 @@ public WacsdkPublisherCommands(WacsdkCommandConfig config, Option repoOp
// Add publisher-specific collection commands
AddCommand(new ProjectsCommand(config, repoOption, publisherIdOption, projectIdOption));
- AddCommand(new ChildPublishersCommand(config, repoOption, parentPublisherIdOption, childPublisherIdOption));
- AddCommand(new ParentPublishersCommand(config, repoOption, childPublisherIdOption, parentPublisherIdOption));
+ AddCommand(new ChildPublishersCommand(config, repoOption, parentPublisherIdOption, childPublisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption));
+ AddCommand(new ParentPublishersCommand(config, repoOption, childPublisherIdOption, parentPublisherIdOption, roleIdOption, roleNameOption, roleDescriptionOption));
}
}
}