-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added IsAdmin bit to user entity to prepare for data migration (wip #4)
- Loading branch information
Showing
3 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
half-ogre
Author
Contributor
|
||
public virtual ICollection<EmailMessage> Messages { get; set; } | ||
public string Username { get; set; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. :)