Skip to content
Snippets Groups Projects
Commit 55fe6211 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Topic/1163-adminApi' into 'Product/1119-quotaAdminPage'

Topic/1163 admin api

See merge request coscine/cs/action!59
parents fc327ec3 65ae902c
No related branches found
No related tags found
3 merge requests!61Product/1119 quota admin page,!60Sprint/2020 22,!59Topic/1163 admin api
......@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Action.Tests is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Action.Tests")]
[assembly: AssemblyVersion("1.16.0")]
[assembly: AssemblyFileVersion("1.16.0")]
[assembly: AssemblyInformationalVersion("1.16.0-topic-1062-pidpa0009")]
[assembly: AssemblyVersion("1.17.0")]
[assembly: AssemblyFileVersion("1.17.0")]
[assembly: AssemblyInformationalVersion("1.17.0-topic-1163-admin0001")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
......@@ -109,12 +109,14 @@
<ItemGroup>
<Compile Include="Emitter.cs" />
<Compile Include="EventArgs\ActionEventArgs.cs" />
<Compile Include="EventArgs\AdminEventArgs.cs" />
<Compile Include="EventArgs\ProjectEventArgs.cs" />
<Compile Include="EventArgs\PIDEventArgs.cs" />
<Compile Include="EventArgs\ResourceEventArgs.cs" />
<Compile Include="EventArgs\UserEventArgs.cs" />
<Compile Include="Exceptions\ActionException.cs" />
<Compile Include="IAction.cs" />
<Compile Include="Implementations\Admin\NotificationAction.cs" />
<Compile Include="Implementations\PID\NotificationAction.cs" />
<Compile Include="Implementations\Project\NotificationAction.cs" />
<Compile Include="Implementations\Project\PIDAction.cs" />
......@@ -124,6 +126,7 @@
<Compile Include="Implementations\Resource\PIDAction.cs" />
<Compile Include="Implementations\User\NotificationAction.cs" />
<Compile Include="Implementations\User\SPGroupAction.cs" />
<Compile Include="IAdminAction.cs" />
<Compile Include="IProjectAction.cs" />
<Compile Include="IPIDAction.cs" />
<Compile Include="IResourceAction.cs" />
......
......@@ -14,6 +14,7 @@ namespace Coscine.Action
private readonly List<IUserAction> userActions = new List<IUserAction>();
private readonly List<IResourceAction> resourceActions = new List<IResourceAction>();
private readonly List<IPIDAction> pidActions = new List<IPIDAction>();
private readonly List<IAdminAction> adminActions = new List<IAdminAction>();
public IConfiguration Configuration { get; }
......@@ -38,6 +39,9 @@ namespace Coscine.Action
var pida = InstantiateAllImplementations<IPIDAction>(assembly);
pidActions.AddRange(pida);
var adminA = InstantiateAllImplementations<IAdminAction>(assembly);
adminActions.AddRange(adminA);
}
private static IEnumerable<T> InstantiateAllImplementations<T>(System.Reflection.Assembly assembly) where T : IAction
......@@ -105,6 +109,12 @@ namespace Coscine.Action
a.OnPIDOwnerContact(args);
}
}
public void EmitQuotaChanged(AdminEventArgs args)
{
foreach (var a in adminActions)
{
a.OnQutaChanged(args);
}
}
}
}
using Coscine.Configuration;
using System;
namespace Coscine.Action.EventArgs
{
public class AdminEventArgs : ActionEventArgs
{
public IConfiguration Configuration { get; set; }
public Guid ProjectId { get; set; }
public AdminEventArgs(IConfiguration configuration, object[] args) : base(args)
{
Configuration = configuration;
}
public AdminEventArgs(IConfiguration configuration) : this(configuration, new object[0])
{
}
}
}
using Coscine.Action.EventArgs;
namespace Coscine.Action
{
public interface IAdminAction : IAction
{
void OnQutaChanged(AdminEventArgs pidEventArgs);
}
}
using Coscine.Action.EventArgs;
using Coscine.Action.Utils;
namespace Coscine.Action.Implementations.Admin
{
public class NotificationAction : IAdminAction
{
public int Priority => 1;
public bool Enabled => true;
public void OnQutaChanged(AdminEventArgs adminEventArgs)
{
NotificationBusUtil.SendAsync(adminEventArgs.Configuration, "quota_changed", NotificationBusUtil.GetAllOwnersForProjectId(adminEventArgs.ProjectId), adminEventArgs.ProjectId.ToString(), new Newtonsoft.Json.Linq.JObject());
}
}
}
......@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Action is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Action")]
[assembly: AssemblyVersion("1.16.0")]
[assembly: AssemblyFileVersion("1.16.0")]
[assembly: AssemblyInformationalVersion("1.16.0-topic-1062-pidpa0009")]
[assembly: AssemblyVersion("1.17.0")]
[assembly: AssemblyFileVersion("1.17.0")]
[assembly: AssemblyInformationalVersion("1.17.0-topic-1163-admin0001")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment