Skip to content

Commit

Permalink
added IsAdmin bit to user entity to prepare for data migration (wip #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
half-ogre committed Aug 16, 2011
1 parent 37fd12b commit 758db62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Website/Entities/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public User(
public Guid ApiKey { get; set; }
public string EmailAddress { get; set; }
public string HashedPassword { get; set; }
public bool IsAdmin { get; set; }

This comment has been minimized.

Copy link
@haacked

haacked Aug 16, 2011

Contributor

I assume we'll then properly add all users with the IsAdmin bit set to true to the "Administrators" role so we can actually make authorization work like it's supposed to, right? :)

That'll make it easier to make Elmah actually accessibly publicly but locked down to just admins. :)

This comment has been minimized.

Copy link
@half-ogre

half-ogre Aug 16, 2011

Author Contributor

Created issue #49 to track adding the role to the principal.

public virtual ICollection<EmailMessage> Messages { get; set; }
public string Username { get; set; }
}
Expand Down
15 changes: 15 additions & 0 deletions Website/Migrations/20110816113000_AddIsAdminColumn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Data;
using Migrator.Framework;

namespace NuGetGallery.Data.Migrations {
[Migration(20110816113000)]
public class AddIsAdminColumnMigration : Migration {
public override void Up() {
Database.AddColumn("Users", "IsAdmin", DbType.Boolean, false);
}

public override void Down() {
Database.RemoveColumn("Users", "IsAdmin");
}
}
}
1 change: 1 addition & 0 deletions Website/Website.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<Compile Include="Controllers\UsersController.cs" />
<Compile Include="DataServices\PackageExtensions.cs" />
<Compile Include="Entities\PackageReview.cs" />
<Compile Include="Migrations\20110816113000_AddIsAdminColumn.cs" />
<Compile Include="PackagesController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
Expand Down

0 comments on commit 758db62

Please sign in to comment.