Feature #26: User Flags

Flags can be associated with Users. Includes minor updates to Job Queues
and improved visibility of user information.
This commit is contained in:
Gary Sharp
2014-06-10 17:16:24 +10:00
parent b64ac3b16f
commit 4c3a68da30
104 changed files with 8112 additions and 1623 deletions
+8 -1
View File
@@ -139,6 +139,10 @@
<Compile Include="Migrations\201404080227546_DBv13.Designer.cs">
<DependentUpon>201404080227546_DBv13.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201406090652547_DBv14.cs" />
<Compile Include="Migrations\201406090652547_DBv14.Designer.cs">
<DependentUpon>201406090652547_DBv14.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Migrations\DiscoDataMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -193,6 +197,9 @@
<EmbeddedResource Include="Migrations\201404080227546_DBv13.resx">
<DependentUpon>201404080227546_DBv13.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201406090652547_DBv14.resx">
<DependentUpon>201406090652547_DBv14.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -206,7 +213,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+27
View File
@@ -0,0 +1,27 @@
// <auto-generated />
namespace Disco.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
public sealed partial class DBv14 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv14));
string IMigrationMetadata.Id
{
get { return "201406090652547_DBv14"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,61 @@
namespace Disco.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DBv14 : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.UserFlagAssignments",
c => new
{
Id = c.Int(nullable: false, identity: true),
UserFlagId = c.Int(nullable: false),
UserId = c.String(nullable: false, maxLength: 50),
AddedDate = c.DateTime(nullable: false),
AddedUserId = c.String(nullable: false, maxLength: 50),
RemovedDate = c.DateTime(),
RemovedUserId = c.String(maxLength: 50),
Comments = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.UserFlags", t => t.UserFlagId)
.ForeignKey("dbo.Users", t => t.UserId)
.ForeignKey("dbo.Users", t => t.AddedUserId)
.ForeignKey("dbo.Users", t => t.RemovedUserId)
.Index(t => t.UserFlagId)
.Index(t => t.UserId)
.Index(t => t.AddedUserId)
.Index(t => t.RemovedUserId);
CreateTable(
"dbo.UserFlags",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 100),
Description = c.String(maxLength: 500),
Icon = c.String(nullable: false, maxLength: 25),
IconColour = c.String(nullable: false, maxLength: 10),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropIndex("dbo.UserFlagAssignments", new[] { "RemovedUserId" });
DropIndex("dbo.UserFlagAssignments", new[] { "AddedUserId" });
DropIndex("dbo.UserFlagAssignments", new[] { "UserId" });
DropIndex("dbo.UserFlagAssignments", new[] { "UserFlagId" });
DropForeignKey("dbo.UserFlagAssignments", "RemovedUserId", "dbo.Users");
DropForeignKey("dbo.UserFlagAssignments", "AddedUserId", "dbo.Users");
DropForeignKey("dbo.UserFlagAssignments", "UserId", "dbo.Users");
DropForeignKey("dbo.UserFlagAssignments", "UserFlagId", "dbo.UserFlags");
DropTable("dbo.UserFlags");
DropTable("dbo.UserFlagAssignments");
}
}
}
File diff suppressed because one or more lines are too long
@@ -23,6 +23,8 @@ namespace Disco.Data.Repository
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<UserAttachment> UserAttachments { get; set; }
public virtual DbSet<UserFlag> UserFlags { get; set; }
public virtual DbSet<UserFlagAssignment> UserFlagAssignments { get; set; }
public virtual DbSet<AuthorizationRole> AuthorizationRoles { get; set; }
public virtual DbSet<DeviceUserAssignment> DeviceUserAssignments { get; set; }
@@ -177,6 +177,11 @@ namespace Disco.Data.Repository.Monitor
{
key["UserId"] = ((UserAttachment)entryState.Entity).UserId;
}
if (entryState.Entity is UserFlagAssignment)
{
key["UserFlagId"] = ((UserFlagAssignment)entryState.Entity).UserFlagId;
key["UserId"] = ((UserFlagAssignment)entryState.Entity).UserId;
}
return key;
}