Initial commit (azure deploy test)

This commit is contained in:
Michael 2017-03-20 16:45:17 -04:00
parent d9f475e1f3
commit cdc61eb4ea
239 changed files with 59681 additions and 0 deletions

22
Project-Unite.sln Normal file
View file

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project-Unite", "Project-Unite\Project-Unite.csproj", "{0C571DE1-E76B-4C3E-84A8-00E8938406E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C571DE1-E76B-4C3E-84A8-00E8938406E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C571DE1-E76B-4C3E-84A8-00E8938406E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C571DE1-E76B-4C3E-84A8-00E8938406E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C571DE1-E76B-4C3E-84A8-00E8938406E1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

318
Project-Unite/ACL.cs Normal file
View file

@ -0,0 +1,318 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Project_Unite.Models;
using Microsoft.AspNet.Identity.Owin;
using System.Web.Mvc;
using System.Diagnostics;
using System.Web.Mvc.Html;
using System.Data.Entity;
namespace Project_Unite
{
public static class ACL
{
public static IHtmlString Markdown(this HtmlHelper hpr, string md)
{
return hpr.Raw(CommonMark.CommonMarkConverter.Convert(hpr.Encode(md)));
}
public static IHtmlString UserLink(this HtmlHelper hpr, string userId)
{
using(var db = new ApplicationDbContext())
{
var usr = db.Users.Include(x=>x.Roles).FirstOrDefault(x => x.Id == userId);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
return hpr.ActionLink(usr.DisplayName, "ViewProfile", "Profiles", new { name = usr.UserName }, new { style = @"color: " + userRole.ColorHex });
}
}
public static IHtmlString UserName(this HtmlHelper hpr, string userId)
{
using (var db = new ApplicationDbContext())
{
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(x => x.Id == userId);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
return hpr.Raw($@"<strong style=""color:{userRole.ColorHex}"">{hpr.Encode(usr.DisplayName)}</strong>");
}
}
public static string UserNameRaw(string userId)
{
using (var db = new ApplicationDbContext())
{
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(x => x.Id == userId);
return usr.DisplayName;
}
}
public static string UserNameFromEmailRaw(string userId)
{
using (var db = new ApplicationDbContext())
{
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(x => x.UserName == userId);
return usr.DisplayName;
}
}
public static bool CanSee(string userName, string fId)
{
if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(fId))
return false;
if (!Granted(userName, "CanPostTopics"))
return false; //obviously if this role has a global restraint for this ACL def we shouldn't let them post in ANY forum.
var db = new ApplicationDbContext();
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(u => u.UserName == userName);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
db.Dispose();
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
db = new ApplicationDbContext();
var forums = db.ForumCategories;
var forum = forums.First(x => x.Id == fId);
var perms = forum.Permissions.FirstOrDefault(x => x.RoleId == userRole.Id);
if (perms == null)
{
UpdateACLDefinitions(fId);
return true;
}
return (int)perms.Permissions >= (int)PermissionPreset.CanRead;
}
public static bool UserEmailConfirmed(string username)
{
if (string.IsNullOrWhiteSpace(username))
return true;
return new ApplicationDbContext().Users.FirstOrDefault(x => x.UserName == username).EmailConfirmed;
}
public static Role LowestPriorityRole()
{
var db = new ApplicationDbContext();
var roles = db.Roles;
List<Role> actualRoles = new List<Role>();
foreach (Role r in roles)
{
actualRoles.Add(r);
}
return actualRoles.OrderBy(x => x.Priority).First();
}
public static bool CanReply(string userName, string fId)
{
if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(fId))
return false;
if (!Granted(userName, "CanPostTopics"))
return false; //obviously if this role has a global restraint for this ACL def we shouldn't let them post in ANY forum.
var db = new ApplicationDbContext();
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(u => u.UserName == userName);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
db.Dispose();
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
db = new ApplicationDbContext();
var forums = db.ForumCategories;
var forum = forums.First(x => x.Id == fId);
var perms = forum.Permissions.FirstOrDefault(x => x.RoleId == userRole.Id);
if (perms == null)
{
UpdateACLDefinitions(fId);
return true;
}
return perms.Permissions >= PermissionPreset.CanReply;
}
public static ApplicationUser GetUserInfo(string id)
{
return new ApplicationDbContext().Users.FirstOrDefault(x => x.Id == id);
}
public static bool CanPost(string userName, string fId)
{
if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(fId))
return false;
if (!Granted(userName, "CanPostTopics"))
return false; //obviously if this role has a global restraint for this ACL def we shouldn't let them post in ANY forum.
var db = new ApplicationDbContext();
var usr = db.Users.Include(x => x.Roles).FirstOrDefault(u => u.UserName == userName);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
db.Dispose();
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
db = new ApplicationDbContext();
var forums = db.ForumCategories;
var forum = forums.First(x => x.Id == fId);
var perms = forum.Permissions.FirstOrDefault(x=>x.RoleId==userRole.Id);
if (perms == null)
{
UpdateACLDefinitions(fId);
return true;
}
return perms.Permissions >= PermissionPreset.CanPost;
}
public static void UpdateACLDefinitions(string fid)
{
var db = new ApplicationDbContext();
var forum = db.ForumCategories.FirstOrDefault(x => x.Id == fid);
if (forum == null)
return;
int recordsAdded = 0;
if (forum.Permissions.Length < db.Roles.Count())
{
var rolesToAdd = db.Roles.Where(r => forum.Permissions.FirstOrDefault(p => p.RoleId == r.Id) == null);
foreach(var role in rolesToAdd)
{
var perm = new ForumPermission();
perm.Id = Guid.NewGuid().ToString();
perm.CategoryId = forum.Id;
perm.RoleId = role.Id;
perm.Permissions = PermissionPreset.CanPost;
db.ForumPermissions.Add(perm);
recordsAdded++;
}
db.AuditLogs.Add(new AuditLog("system", AuditLogLevel.Admin, $"Automatic forum ACL update occurred - Forum: {forum.Name}, records added: {recordsAdded}."));
db.SaveChanges();
}
}
public static bool CanManageRole(string userId, string roleId)
{
try
{
if (!Granted(userId, "CanEditRoles"))
return false;
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(u => u.UserName == userId);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
var manageRole = (Role)db.Roles.FirstOrDefault(x => x.Id == roleId);
db.Dispose();
var userRole = (Role)userRoles.OrderByDescending(m => m.Priority).First();
if (manageRole.Priority > userRole.Priority)
return false;
return true;
}
catch
{
return false;
}
}
public static ForumCategory GetForumById(string id)
{
var db = new ApplicationDbContext();
return db.ForumCategories.FirstOrDefault(x => x.Id == id);
}
public static bool Granted(string userName, string prop)
{
if (string.IsNullOrWhiteSpace(prop))
return true;
try
{
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(u => u.UserName == userName);
var userRoles = new List<Role>();
foreach (var usrRole in usr.Roles)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
db.Dispose();
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
var t = userRole.GetType();
foreach (var propInf in t.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance))
{
if (propInf.Name == prop && propInf.PropertyType == typeof(bool))
return (bool)propInf.GetValue(userRole);
}
return false;
}
catch (Exception ex)
{
Debug.Print(ex.ToString());
return false;
}
}
}
}

View file

@ -0,0 +1,31 @@
using System.Web;
using System.Web.Optimization;
namespace Project_Unite
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}

View file

@ -0,0 +1,14 @@
using System.Web;
using System.Web.Mvc;
namespace Project_Unite
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}

View file

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Project_Unite.Models;
namespace Project_Unite
{
public class EmailService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
var smtp = new SmtpClient("in-v3.mailjet.com", 25);
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("fcc885a166c73e91ba6592345f64dfeb", "84b7c56e71b6c9bd1b26a98222494823");
var sMsg = new MailMessage("sys@michaeltheshifter.me", message.Destination);
sMsg.Body = @"<img src=""https://cdn.discordapp.com/attachments/241613675545231360/280020406528901131/unknown.png""/>
<h1>Message from the ShiftOS staff</h1>
<p>" + CommonMark.CommonMarkConverter.Convert(message.Body) + "</p>";
sMsg.Subject = "[ShiftOS (Project: Unite)] " + message.Subject;
sMsg.IsBodyHtml = true;
smtp.Send(sMsg);
return Task.FromResult(0);
}
}
public class SmsService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your SMS service here to send a text message.
return Task.FromResult(0);
}
}
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = false,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = false,
};
// Configure user lockout defaults
manager.UserLockoutEnabledByDefault = true;
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
// You can write your own provider and plug it in here.
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
{
MessageFormat = "Your security code is {0}"
});
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
{
Subject = "Security Code",
BodyFormat = "Your security code is {0}"
});
manager.EmailService = new EmailService();
manager.SmsService = new SmsService();
var dataProtectionProvider = options.DataProtectionProvider;
if (dataProtectionProvider != null)
{
manager.UserTokenProvider =
new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
}
return manager;
}
}
// Configure the application sign-in manager which is used in this application.
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
{
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
: base(userManager, authenticationManager)
{
}
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
{
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
}
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
{
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
}
}
}

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Project_Unite
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}

View file

@ -0,0 +1,70 @@
using System;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.Google;
using Owin;
using Project_Unite.Models;
namespace Project_Unite
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
// Enables the application to remember the second login verification factor such as phone or email.
// Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
// This is similar to the RememberMe option when you log in.
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
//app.UseFacebookAuthentication(
// appId: "",
// appSecret: "");
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "433137899460-02t7aruq56lddf8hckpgad44rhjc4h7d.apps.googleusercontent.com",
ClientSecret = "1TnTKaWFoflG0DFQSrqjUjXP"
});
}
}
}

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector" />
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
Use the following syntax here to collect additional performance counters:
<Counters>
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
...
</Counters>
PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
Counter names may only contain letters, round brackets, forward slashes, hyphens, underscores, spaces and dots.
You may provide an optional ReportAs attribute which will be used as the metric name when reporting counter data.
For the purposes of reporting, metric names will be sanitized by removing all invalid characters from the resulting metric name.
NOTE: performance counters configuration will be lost upon NuGet upgrade.
The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
<Handlers>
<!--
Add entries here to filter out additional handlers:
NOTE: handler configuration will be lost upon NuGet upgrade.
-->
<Add>System.Web.Handlers.TransferRequestHandler</Add>
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
<Add>System.Web.StaticFileHandler</Add>
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
<Add>System.Web.Optimization.BundleHandler</Add>
<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
<Add>System.Web.Handlers.TraceHandler</Add>
<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
<Add>System.Web.HttpDebugHandler</Add>
</Handlers>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web" />
</TelemetryModules>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel" />
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
</Add>
</TelemetryProcessors>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
-->
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DomainNameRoleInstanceTelemetryInitializer, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer" />
<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
<Filters>
<Add Pattern="(YottaaMonitor|BrowserMob|HttpMonitor|YandexBot|BingPreview|PagePeeker|ThumbShotsBot|WebThumb|URL2PNG|ZooShot|GomezA|Catchpoint bot|Willow Internet Crawler|Google SketchUp|Read%20Later|KTXN|Pingdom|AlwaysOn)" />
<Add Pattern="Slurp" SourceName="Yahoo Bot" />
<Add Pattern="(bot|zao|borg|Bot|oegp|silk|Xenu|zeal|^NING|crawl|Crawl|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|^Java/|^JNLP/|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|spider|Spider|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|^voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr\-agent|Squrl Java|A6\-Indexer|netresearch|searchsight|http%20client|Python-urllib|dataparksearch|Screaming Frog|AppEngine-Google|YahooCacheSystem|semanticdiscovery|facebookexternalhit|Google.*/\+/web/snippet|Google-HTTP-Java-Client)" SourceName="Spider" />
</Filters>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web" />
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web" />
</TelemetryInitializers>
<InstrumentationKey>c28af358-114e-400b-a0c9-07e6275d7fa4</InstrumentationKey>
</ApplicationInsights>

View file

@ -0,0 +1,159 @@
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}
/*.modal {
padding-top:10%;
padding-right:50%;
@media only screen and (min-device-width:1024px) {
padding-left:0%; padding-right:0%; padding-top:0%;
}
}*/
.form-control{
width:100%;
background-color:black;
color:white;
width:100%;
max-width:none;
}
/* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript */
/**
* okaidia theme for JavaScript, CSS and HTML
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
* @author ocodia
*/
code[class*="language-"],
pre[class*="language-"] {
color: #f8f8f2;
background: none;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
border-radius: 0.3em;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #272822;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #f8f8f2;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: #f92672;
}
.token.boolean,
.token.number {
color: #ae81ff;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #a6e22e;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: #f8f8f2;
}
.token.atrule,
.token.attr-value,
.token.function {
color: #e6db74;
}
.token.keyword {
color: #66d9ef;
}
.token.regex,
.token.important {
color: #fd971f;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

6278
Project-Unite/Content/bootstrap-theme.css vendored Normal file

File diff suppressed because it is too large Load diff

6816
Project-Unite/Content/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load diff

20
Project-Unite/Content/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,513 @@
using System;
using System.Globalization;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Project_Unite.Models;
namespace Project_Unite.Controllers
{
[Authorize]
public class AccountController : Controller
{
private ApplicationSignInManager _signInManager;
private ApplicationUserManager _userManager;
public AccountController()
{
}
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager )
{
UserManager = userManager;
SignInManager = signInManager;
}
public ApplicationSignInManager SignInManager
{
get
{
return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
}
private set
{
_signInManager = value;
}
}
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}
public async Task<ActionResult> ResendConf()
{
var uid = User.Identity.GetUserId();
var usr = new ApplicationDbContext().Users.FirstOrDefault(x => x.Id == uid);
if (usr == null)
return new HttpStatusCodeResult(404);
if (usr.EmailConfirmed == true)
{
ViewBag.IsConfirmed = true;
return View();
}
string code = await UserManager.GenerateEmailConfirmationTokenAsync(uid);
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = uid, code = code }, protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(uid, "Confirm your account", $@"### Please confirm your account.
A user has registered to the ShiftOS website using this email address as a sign-in address. If this was you, please click [this link]({callbackUrl}).
**If this was not you**:
The addressed used to send this message is not a no-reply address. In fact, my name is Michael, admin of the site. We may have a bit of an identity theft issue, or something, going on here, but there's something I can do to help - all you have to do is reply to this email. I have the IP address, display name and ID of the user who triggered this email - just let me know and I can purge the account for you and ban the user's IP address and you won't have issues anymore. Thanks!
**User ID:** {uid}
**Display name:** {usr.DisplayName}
**Last known IP address:** {usr.LastKnownIPAddress}");
return View();
}
//
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
//
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (!ModelState.IsValid)
{
return View(model);
}
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, change to shouldLockout: true
var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
case SignInStatus.Failure:
default:
ModelState.AddModelError("", "Invalid login attempt.");
return View(model);
}
}
//
// GET: /Account/VerifyCode
[AllowAnonymous]
public async Task<ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
{
// Require that the user has already logged in via username/password or external login
if (!await SignInManager.HasBeenVerifiedAsync())
{
return View("Error");
}
return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe });
}
//
// POST: /Account/VerifyCode
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> VerifyCode(VerifyCodeViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
// The following code protects for brute force attacks against the two factor codes.
// If a user enters incorrect codes for a specified amount of time then the user account
// will be locked out for a specified amount of time.
// You can configure the account lockout settings in IdentityConfig
var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(model.ReturnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.Failure:
default:
ModelState.AddModelError("", "Invalid code.");
return View(model);
}
}
//
// GET: /Account/Register
[AllowAnonymous]
public ActionResult Register()
{
return View();
}
//
// POST: /Account/Register
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, DisplayName = model.Username, Codepoints = 0, JoinedAt = DateTime.Now, MutedAt = DateTime.Now, BannedAt = DateTime.Now, LastLogin = DateTime.Now };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
// Send an email with this link
string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
UserManager.AddToRole(user.Id, ACL.LowestPriorityRole().Id);
return RedirectToAction("Index", "Home");
}
AddErrors(result);
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Account/ConfirmEmail
[AllowAnonymous]
public async Task<ActionResult> ConfirmEmail(string userId, string code)
{
if (userId == null || code == null)
{
return View("Error");
}
var result = await UserManager.ConfirmEmailAsync(userId, code);
return View(result.Succeeded ? "ConfirmEmail" : "Error");
}
//
// GET: /Account/ForgotPassword
[AllowAnonymous]
public ActionResult ForgotPassword()
{
return View();
}
//
// POST: /Account/ForgotPassword
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model)
{
if (ModelState.IsValid)
{
var user = await UserManager.FindByNameAsync(model.Email);
if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
{
// Don't reveal that the user does not exist or is not confirmed
return View("ForgotPasswordConfirmation");
}
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
// Send an email with this link
string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
return RedirectToAction("ForgotPasswordConfirmation", "Account");
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Account/ForgotPasswordConfirmation
[AllowAnonymous]
public ActionResult ForgotPasswordConfirmation()
{
return View();
}
//
// GET: /Account/ResetPassword
[AllowAnonymous]
public ActionResult ResetPassword(string code)
{
return code == null ? View("Error") : View();
}
//
// POST: /Account/ResetPassword
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await UserManager.FindByNameAsync(model.Email);
if (user == null)
{
// Don't reveal that the user does not exist
return RedirectToAction("ResetPasswordConfirmation", "Account");
}
var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
if (result.Succeeded)
{
return RedirectToAction("ResetPasswordConfirmation", "Account");
}
AddErrors(result);
return View();
}
//
// GET: /Account/ResetPasswordConfirmation
[AllowAnonymous]
public ActionResult ResetPasswordConfirmation()
{
return View();
}
//
// POST: /Account/ExternalLogin
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult ExternalLogin(string provider, string returnUrl)
{
// Request a redirect to the external login provider
return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
}
//
// GET: /Account/SendCode
[AllowAnonymous]
public async Task<ActionResult> SendCode(string returnUrl, bool rememberMe)
{
var userId = await SignInManager.GetVerifiedUserIdAsync();
if (userId == null)
{
return View("Error");
}
var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(userId);
var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList();
return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
}
//
// POST: /Account/SendCode
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> SendCode(SendCodeViewModel model)
{
if (!ModelState.IsValid)
{
return View();
}
// Generate the token and send it
if (!await SignInManager.SendTwoFactorCodeAsync(model.SelectedProvider))
{
return View("Error");
}
return RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
}
//
// GET: /Account/ExternalLoginCallback
[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
// Sign in the user with this external login provider if the user already has a login
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
case SignInStatus.Failure:
default:
// If the user does not have an account, then prompt the user to create an account
ViewBag.ReturnUrl = returnUrl;
ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
}
}
//
// POST: /Account/ExternalLoginConfirmation
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
{
if (User.Identity.IsAuthenticated)
{
return RedirectToAction("Index", "Manage");
}
if (ModelState.IsValid)
{
// Get the information about the user from the external login provider
var info = await AuthenticationManager.GetExternalLoginInfoAsync();
if (info == null)
{
return View("ExternalLoginFailure");
}
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
var result = await UserManager.CreateAsync(user);
if (result.Succeeded)
{
result = await UserManager.AddLoginAsync(user.Id, info.Login);
if (result.Succeeded)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
return RedirectToLocal(returnUrl);
}
}
AddErrors(result);
}
ViewBag.ReturnUrl = returnUrl;
return View(model);
}
//
// POST: /Account/LogOff
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
return RedirectToAction("Index", "Home");
}
//
// GET: /Account/ExternalLoginFailure
[AllowAnonymous]
public ActionResult ExternalLoginFailure()
{
return View();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (_userManager != null)
{
_userManager.Dispose();
_userManager = null;
}
if (_signInManager != null)
{
_signInManager.Dispose();
_signInManager = null;
}
}
base.Dispose(disposing);
}
#region Helpers
// Used for XSRF protection when adding external logins
private const string XsrfKey = "XsrfId";
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.GetOwinContext().Authentication;
}
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
private ActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
return RedirectToAction("Index", "Home");
}
internal class ChallengeResult : HttpUnauthorizedResult
{
public ChallengeResult(string provider, string redirectUri)
: this(provider, redirectUri, null)
{
}
public ChallengeResult(string provider, string redirectUri, string userId)
{
LoginProvider = provider;
RedirectUri = redirectUri;
UserId = userId;
}
public string LoginProvider { get; set; }
public string RedirectUri { get; set; }
public string UserId { get; set; }
public override void ExecuteResult(ControllerContext context)
{
var properties = new AuthenticationProperties { RedirectUri = RedirectUri };
if (UserId != null)
{
properties.Dictionary[XsrfKey] = UserId;
}
context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
}
}
#endregion
}
}

View file

@ -0,0 +1,567 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Project_Unite.Models;
namespace Project_Unite.Controllers
{
//We have a custom ACL implementation so we do not need to use the ASP.NET role system to check if a user has an ACL rule.
[Authorize]
public class AdminController : Controller
{
private ApplicationDbContext db = new ApplicationDbContext();
public ActionResult Index()
{
ViewBag.Admin = true;
return View();
}
public ActionResult DeleteForum(string id)
{
var frm = db.ForumCategories.FirstOrDefault(x => x.Id == id);
if (frm == null)
return new HttpStatusCodeResult(404);
//Purge ALL DATA RELATED TO THIS CATEGORY.
DeleteCategoryRecursive(frm);
db.SaveChanges();
return RedirectToAction("Forums");
}
public void DeleteCategoryRecursive(ForumCategory start)
{
foreach (var c in start.Children.ToArray())
{
DeleteCategoryRecursive(c);
}
foreach (var topic in start.Topics.ToArray())
{
DeleteTopic(topic);
}
db.ForumCategories.Remove(db.ForumCategories.FirstOrDefault(x => x.Id == start.Id));
}
public void DeleteTopic(ForumTopic topic)
{
foreach(var post in topic.Posts.ToArray())
{
DeletePost(post);
}
db.ForumTopics.Remove(topic);
}
public ActionResult AccessControl()
{
var model = new Dictionary<string, ForumPermission[]>();
var db = new ApplicationDbContext();
var forums = db.ForumCategories.ToArray();
foreach(var forum in forums)
{
ACL.UpdateACLDefinitions(forum.Id);
if(forum.Id != "root")
{
if (!model.ContainsKey(forum.Id))
{
model.Add(forum.Id, forum.Permissions);
}
}
}
return View(new AdminAccessControlViewModel(model));
}
public ActionResult SetPermission(string id, string role, string permission)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessAdminCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanEditRoles"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanEditForumCategories"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var frm = db.ForumCategories.FirstOrDefault(x => x.Id == id);
if (frm == null)
return new HttpStatusCodeResult(403);
var rolePerm = db.ForumPermissions.Where(x => x.CategoryId == frm.Id).FirstOrDefault(x => x.RoleId == role);
if (rolePerm == null)
return new HttpStatusCodeResult(404);
rolePerm.Permissions = (PermissionPreset)Enum.Parse(typeof(PermissionPreset), permission);
db.AuditLogs.Add(new Models.AuditLog(User.Identity.GetUserId(), AuditLogLevel.Admin, "User altered the ACL definition for forum ID " + id + ", role ID " + role + ", to permission \"" + permission + "\"."));
db.SaveChanges();
return RedirectToAction("AccessControl");
}
public void DeletePost(ForumPost post)
{
db.ForumPosts.Remove(post);
}
// GET: Admin/Forums
public ActionResult Forums()
{
ViewBag.Admin = true;
var cats = db.ForumCategories.First(x => x.Id == "root").Children.Where(x=>x.Id != "root");
return View(cats);
}
public ActionResult AddForumCategory(string parentId)
{
ViewBag.Admin = true;
if (parentId == null)
parentId = "root";
var model = new AddForumCategoryViewModel();
model.PossibleParents = GetForumCategories();
model.Parent = (parentId);
return View(model);
}
public ActionResult RaisePriority(string id)
{
var uid = User.Identity.Name;
if(ACL.Granted(uid, "CanEditRoles"))
{
var db = new ApplicationDbContext();
var role = db.Roles.FirstOrDefault(x => x.Id == id) as Role;
if (role == null)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
if (role.Priority == db.Roles.Count() - 1)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
Role higherUp = null;
foreach(var r in db.Roles)
{
if ((r as Role).Priority == role.Priority + 1)
higherUp = r as Role;
}
higherUp.Priority--;
role.Priority++;
db.SaveChanges();
return RedirectToAction("Roles");
}
else
{
return new HttpStatusCodeResult(403);
}
}
public async Task<ActionResult> RemoveUserFromRole(string id, string usr)
{
if(ACL.CanManageRole(User.Identity.Name, id))
{
var uman = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
await uman.RemoveFromRoleAsync(usr, id);
return RedirectToAction("RoleDetails", new { @id = id });
}
else
{
return new HttpStatusCodeResult(403);
}
}
public ActionResult LowerPriority(string id)
{
var uid = User.Identity.Name;
if (ACL.Granted(uid, "CanEditRoles"))
{
var db = new ApplicationDbContext();
var role = db.Roles.FirstOrDefault(x => x.Id == id) as Role;
if (role == null)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
if (role.Priority == 0)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
Role higherUp = null;
foreach (var r in db.Roles)
{
if ((r as Role).Priority == role.Priority - 1)
higherUp = r as Role;
}
if(higherUp != null)
higherUp.Priority++;
role.Priority--;
db.SaveChanges();
return RedirectToAction("Roles");
}
else
{
return new HttpStatusCodeResult(403);
}
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult AddForumCategory(AddForumCategoryViewModel model)
{
try
{
if (model == null)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
if (string.IsNullOrWhiteSpace(model.Name))
{
ViewBag.Error = "Please specify a name for this forum category.";
return View(model);
}
string DisallowedChars = "/.,\\][;':\"|?><!@#$%^&*()_+-=`~}{ ";
string id = model.Name.ToLower();
foreach (var c in DisallowedChars)
{
id = id.Replace(c, '_');
}
var frm = new ForumCategory();
frm.Name = model.Name;
frm.Id = id;
frm.Description = model.Description;
frm.LinkUrl = null;
frm.Parent = db.ForumCategories.FirstOrDefault(x => x.Id == model.Parent).Id;
db.ForumCategories.Add(frm);
db.SaveChanges();
if (model.StealPermissionsFrom != "root")
{
var frmToSteal = db.ForumCategories.FirstOrDefault(x => x.Id == model.StealPermissionsFrom);
ACL.UpdateACLDefinitions(frmToSteal.Id); //Just to be sure..
foreach(var perm in frmToSteal.Permissions)
{
var aclEntry = new ForumPermission();
aclEntry.CategoryId = frm.Id;
aclEntry.RoleId = perm.RoleId;
aclEntry.Permissions = perm.Permissions;
aclEntry.Id = Guid.NewGuid().ToString();
db.ForumPermissions.Add(aclEntry);
}
db.SaveChanges();
}
else
{
ACL.UpdateACLDefinitions(frm.Id);
//This sets the permission data to the default values.
}
return RedirectToAction("Forums");
}
catch (Exception ex)
{
ViewBag.Error = ex.ToString();
return View(model);
}
}
public ActionResult AnonymizeUser(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAcessAdminCP"))
return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
if (!ACL.Granted(User.Identity.Name, "CanAnonymizeUser"))
return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
var db = new ApplicationDbContext();
var user = db.Users.FirstOrDefault(x => x.Id == id);
if (user == null)
return new HttpStatusCodeResult(404);
user.UserName = Guid.NewGuid().ToString() + "@system";
user.Email = Guid.NewGuid().ToString() + "@system";
user.PasswordHash = Guid.NewGuid().ToString();
user.EmailConfirmed = false;
user.Hobbies = "";
user.Interests = "";
user.Bio = @"# User anonymized.
This user has been anonymized by an administrator.";
user.AvatarUrl = "";
user.BannerUrl = "";
var uman = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
foreach(var role in user.Roles)
{
uman.RemoveFromRole(user.Id, role.RoleId);
}
uman.AddToRole(user.Id, ACL.LowestPriorityRole().Id);
db.SaveChanges();
return RedirectToAction("Users");
}
public ActionResult Logs()
{
if (!ACL.Granted(User.Identity.Name, "CanAccessAdminCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
return View(db.AuditLogs);
}
public ActionResult Users()
{
return View(new ApplicationDbContext().Users);
}
public ActionResult EditForum(string id)
{
ViewBag.Admin = true;
var frm = db.ForumCategories.FirstOrDefault(x => x.Id == id);
if (frm == null)
return new HttpStatusCodeResult(404);
var m = new AddForumCategoryViewModel();
m.Id = frm.Id;
m.Parent = frm.Parent;
m.Description = frm.Description;
m.Name = frm.Name;
m.PossibleParents = GetForumCategories();
return View(m);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditForum(string id, AddForumCategoryViewModel m)
{
try
{
m.Id = id;
var frm = db.ForumCategories.FirstOrDefault(x => x.Id == id);
frm.Name = m.Name;
frm.Description = m.Description;
frm.Parent = m.Parent;
db.SaveChanges();
return RedirectToAction("Forums");
}
catch (Exception ex)
{
ViewBag.Error = ex.ToString();
return View(m);
}
}
// GET: Admin
public ActionResult Roles()
{
ViewBag.Admin = true;
return View(db.IdentityRoles.ToList());
}
// GET: Admin/RoleDetails/5
public ActionResult RoleDetails(string id)
{
ViewBag.Admin = true;
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Role role = db.IdentityRoles.Find(id);
if (role == null)
{
return HttpNotFound();
}
return View(role);
}
// GET: Admin/Create
public ActionResult CreateRole()
{
ViewBag.Admin = true;
return View();
}
// POST: Admin/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateRole(Role role)
{
if (ModelState.IsValid)
{
db.IdentityRoles.Add(role);
db.SaveChanges();
return RedirectToAction("Roles");
}
return View(role);
}
// GET: Admin/AddUserToRole
public ActionResult AddUserToRole()
{
ViewBag.Admin = true;
return View(new AddUserToRoleViewModel());
}
// POST: Admin/AddUserToRole
[HttpPost]
public async Task<ActionResult> AddUserToRole(AddUserToRoleViewModel model)
{
var r = db.Roles.FirstOrDefault(role => role.Name == model.RoleId);
var user = db.Users.FirstOrDefault(u => u.DisplayName == model.Username);
var uMan = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
var isInRole = await uMan.IsInRoleAsync(user.Id, r.Id);
if(isInRole)
{
ViewBag.Error = $"{model.Username} is already in the {r.Name} role.";
return View(model);
}
else
{
await uMan.AddToRoleAsync(user.Id, r.Name);
return RedirectToAction("Roles");
}
}
// GET: Admin/Edit/5
public ActionResult EditRole(string id)
{
ViewBag.Admin = true;
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Role role = db.IdentityRoles.Find(id);
if (role == null)
{
return HttpNotFound();
}
return View(role);
}
// POST: Admin/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditRole(Role role)
{
if (ModelState.IsValid)
{
db.Entry(role).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(role);
}
// GET: Admin/Delete/5
public ActionResult DeleteRole(string id)
{
ViewBag.Admin = true;
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Role role = db.IdentityRoles.Find(id);
if (role == null)
{
return HttpNotFound();
}
return View(role);
}
// POST: Admin/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteRoleConfirmed(string id)
{
Role role = db.IdentityRoles.Find(id);
db.IdentityRoles.Remove(role);
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
public List<SelectListItem> GetForumCategories()
{
var items = new List<SelectListItem>();
items.Add(new SelectListItem
{
Value = "root",
Text = "Top Level"
});
foreach(var cat in getChildren("root", 1))
{
items.Add(cat);
}
return items;
}
private IEnumerable<SelectListItem> getChildren(string id, int dashcount)
{
var lst = new List<SelectListItem>();
db = new ApplicationDbContext();
foreach (var cat in db.ForumCategories.FirstOrDefault(c => c.Id == id).Children.Where(x=>x.Id != "root"))
{
string dashes = "";
for (int i = 0; i <= dashcount; i++)
dashes += "-";
lst.Add(new SelectListItem
{
Text = dashes + " " + cat.Name,
Value = cat.Id,
});
lst.AddRange(getChildren(cat.Id, dashcount + 1));
}
return lst;
}
}
}

View file

@ -0,0 +1,305 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Project_Unite.Models;
namespace Project_Unite.Controllers
{
public class ForumController : Controller
{
public ApplicationDbContext db = new ApplicationDbContext();
// GET: Forum
public ActionResult Index()
{
var toplevels = (db.ForumCategories.FirstOrDefault(x => x.Id == "root").Children);
return View(toplevels);
}
//GET: ViewForum
public ActionResult ViewForum(string id)
{
try
{
var cat = db.ForumCategories.FirstOrDefault(m => m.Id == id);
if (!ACL.CanSee(User.Identity.Name, id))
return new HttpStatusCodeResult(403);
return View(cat);
}
catch
{
return new HttpStatusCodeResult(404);
}
}
public const string BadIdChars = "~`!@#$%^&*()-+={}[]|\\:;'\"<,>.?/";
public ActionResult PostReply(string id, string fid)
{
if (!ACL.CanReply(User.Identity.Name, fid))
return new HttpStatusCodeResult(403);
var model = new CreateTopicViewModel();
model.Category = id;
return View(model);
}
[Authorize]
public ActionResult Dislike(string id)
{
var db = new ApplicationDbContext();
var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
var uid = User.Identity.GetUserId();
if (topic == null)
return new HttpStatusCodeResult(404);
if (topic.AuthorId == User.Identity.GetUserId())
return RedirectToAction("ViewTopic", new { id = id, triedtolikeowntopic = true });
var like = db.Likes.Where(x => x.Topic == topic.Id).FirstOrDefault(x => x.User == uid);
if (like != null)
{
if (like.IsDislike == false)
{
like.IsDislike = true;
}
else
{
db.Likes.Remove(like);
}
}
else
{
like = new Models.Like();
like.Id = Guid.NewGuid().ToString();
like.User = User.Identity.GetUserId();
like.Topic = topic.Id;
like.LikedAt = DateTime.Now;
like.IsDislike = true;
db.Likes.Add(like);
}
db.SaveChanges();
return RedirectToAction("ViewTopic", new { id = id });
}
[Authorize]
public ActionResult Like(string id)
{
var db = new ApplicationDbContext();
var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
var uid = User.Identity.GetUserId();
if (topic == null)
return new HttpStatusCodeResult(404);
if (topic.AuthorId == User.Identity.GetUserId())
return RedirectToAction("ViewTopic", new { id = id, triedtolikeowntopic = true });
var like = db.Likes.Where(x=>x.Topic==topic.Id).FirstOrDefault(x => x.User == uid);
if (like != null)
{
if (like.IsDislike == true)
{
like.IsDislike = false;
}
else
{
db.Likes.Remove(like);
}
}
else
{
like = new Models.Like();
like.Id = Guid.NewGuid().ToString();
like.User = User.Identity.GetUserId();
like.Topic = topic.Id;
like.LikedAt = DateTime.Now;
like.IsDislike = false;
db.Likes.Add(like);
}
db.SaveChanges();
return RedirectToAction("ViewTopic", new { id = id });
}
[Authorize]
public ActionResult EditPost(string id)
{
var db = new ApplicationDbContext();
var topic = db.ForumPosts.FirstOrDefault(x => x.Id == id);
var uid = User.Identity.GetUserId();
string acl_perm = "CanEditPosts";
if (topic == null)
return new HttpStatusCodeResult(404);
if (topic.AuthorId == User.Identity.GetUserId())
acl_perm = "CanEditOwnPosts";
if (!ACL.Granted(User.Identity.Name, acl_perm))
return new HttpStatusCodeResult(403);
var model = new EditPostViewModel();
model.Id = topic.Id;
model.Contents = topic.Body;
return View(model);
}
[Authorize]
public ActionResult DeletePost(string id)
{
var db = new ApplicationDbContext();
var topic = db.ForumPosts.FirstOrDefault(x => x.Id == id);
var uid = User.Identity.GetUserId();
string acl_perm = "CanDeletePosts";
if (topic == null)
return new HttpStatusCodeResult(404);
if (topic.AuthorId == User.Identity.GetUserId())
acl_perm = "CanDeleteOwnPosts";
if (!ACL.Granted(User.Identity.Name, acl_perm))
return new HttpStatusCodeResult(403);
db.ForumPosts.Remove(topic);
var parent = db.ForumTopics.FirstOrDefault(x => x.Id == topic.Parent);
db.SaveChanges();
if (parent.Posts.Length == 0)
{
string cat = parent.Parent;
db.ForumTopics.Remove(parent);
db.SaveChanges();
RedirectToAction("ViewForum", new { id = cat });
}
return RedirectToAction("ViewTopic", new { id = db.ForumTopics.FirstOrDefault(x => x.Id == topic.Parent).Discriminator});
}
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize]
public ActionResult EditPost(EditPostViewModel model)
{
var db = new ApplicationDbContext();
var topic = db.ForumPosts.FirstOrDefault(x => x.Id == model.Id);
var uid = User.Identity.GetUserId();
string acl_perm = "CanEditPosts";
if (topic == null)
return new HttpStatusCodeResult(404);
if (topic.AuthorId == User.Identity.GetUserId())
acl_perm = "CanEditOwnPosts";
if (!ACL.Granted(User.Identity.Name, acl_perm))
return new HttpStatusCodeResult(403);
var edit = new ForumPostEdit();
edit.EditedAt = DateTime.Now;
edit.EditReason = model.EditReason;
edit.Id = Guid.NewGuid().ToString();
edit.Parent = topic.Id;
edit.PreviousState = topic.Body;
edit.UserId = uid;
db.ForumPostEdits.Add(edit);
topic.Body = model.Contents;
db.SaveChanges();
return RedirectToAction("ViewTopic", new { id = db.ForumTopics.FirstOrDefault(x => x.Id == topic.Parent).Discriminator });
}
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize]
public ActionResult PostReply(CreateTopicViewModel model)
{
var db = new ApplicationDbContext();
var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == model.Category);
if (topic == null)
return new HttpStatusCodeResult(404);
if (!ACL.CanReply(User.Identity.Name, topic.Parent))
return new HttpStatusCodeResult(403);
var post = new ForumPost();
post.AuthorId = User.Identity.GetUserId();
post.Body = model.Body;
post.Id = Guid.NewGuid().ToString();
post.Parent = topic.Id;
post.PostedAt = DateTime.Now;
db.ForumPosts.Add(post);
db.SaveChanges();
return RedirectToAction("ViewTopic", new { id = topic.Discriminator });
}
public ActionResult CreateTopic(string id)
{
if (!ACL.CanPost(User.Identity.Name, id))
return new HttpStatusCodeResult(403);
var model = new CreateTopicViewModel();
model.Category = id;
return View(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize]
public ActionResult CreateTopic(CreateTopicViewModel model)
{
if (!ACL.CanPost(User.Identity.Name, model.Category))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var forum = db.ForumCategories.FirstOrDefault(x => x.Id == model.Category);
if (forum == null)
return new HttpStatusCodeResult(404);
string subjectId = model.Subject;
char[] badChars = subjectId.Where(x => !AllowedChars.Contains(x)).ToArray();
foreach(var c in badChars)
{
subjectId = subjectId.Replace(c, '_');
}
while (subjectId.Contains("__"))
{
subjectId = subjectId.Replace("__", "_");
}
var topic = new ForumTopic();
topic.AuthorId = User.Identity.GetUserId();
topic.Id = Guid.NewGuid().ToString();
topic.Discriminator = subjectId + "_" + db.ForumTopics.Count().ToString();
topic.StartedAt = DateTime.Now;
topic.Parent = forum.Id;
topic.IsAnnounce = model.IsAnnounce;
topic.IsSticky = model.IsSticky;
topic.IsGlobal = model.IsGlobal;
topic.Subject = model.Subject;
var post = new ForumPost();
post.AuthorId = topic.AuthorId;
post.Body = model.Body;
post.Id = Guid.NewGuid().ToString();
post.Parent = topic.Id;
post.PostedAt = topic.StartedAt;
db.ForumTopics.Add(topic);
db.ForumPosts.Add(post);
db.SaveChanges();
return RedirectToAction("ViewTopic", new { id = topic.Discriminator });
}
const string AllowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
[Authorize]
public ActionResult ViewTopic(string id, bool triedtolikeowntopic = false)
{
if (triedtolikeowntopic)
ViewBag.Error = "You cannot like or dislike your own topic!";
var db = new ApplicationDbContext();
var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
if (topic == null)
return new HttpStatusCodeResult(404);
if (!ACL.CanSee(User.Identity.Name, topic.Parent))
return new HttpStatusCodeResult(403);
return View(topic);
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace Project_Unite.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Project_Unite.Controllers
{
public class LegalController : Controller
{
// GET: Legal/TOS
public ActionResult TOS()
{
return View();
}
// GET: Legal/Privacy
public ActionResult Privacy()
{
return View();
}
}
}

View file

@ -0,0 +1,382 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Project_Unite.Models;
namespace Project_Unite.Controllers
{
[Authorize]
public class ManageController : Controller
{
private ApplicationSignInManager _signInManager;
private ApplicationUserManager _userManager;
public ManageController()
{
}
public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
{
UserManager = userManager;
SignInManager = signInManager;
}
public ApplicationSignInManager SignInManager
{
get
{
return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
}
private set
{
_signInManager = value;
}
}
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}
//
// GET: /Manage/Index
public async Task<ActionResult> Index(ManageMessageId? message)
{
ViewBag.StatusMessage =
message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
: message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
: message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
: message == ManageMessageId.Error ? "An error has occurred."
: message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
: "";
var userId = User.Identity.GetUserId();
var usr = UserManager.FindById(userId);
return View(usr);
}
//
// POST: /Manage/RemoveLogin
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> RemoveLogin(string loginProvider, string providerKey)
{
ManageMessageId? message;
var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
if (result.Succeeded)
{
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
message = ManageMessageId.RemoveLoginSuccess;
}
else
{
message = ManageMessageId.Error;
}
return RedirectToAction("ManageLogins", new { Message = message });
}
//
// GET: /Manage/AddPhoneNumber
public ActionResult AddPhoneNumber()
{
return View();
}
//
// POST: /Manage/AddPhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
// Generate the token and send it
var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
if (UserManager.SmsService != null)
{
var message = new IdentityMessage
{
Destination = model.Number,
Body = "Your security code is: " + code
};
await UserManager.SmsService.SendAsync(message);
}
return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
}
//
// POST: /Manage/EnableTwoFactorAuthentication
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> EnableTwoFactorAuthentication()
{
await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true);
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", "Manage");
}
//
// POST: /Manage/DisableTwoFactorAuthentication
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> DisableTwoFactorAuthentication()
{
await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false);
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", "Manage");
}
//
// GET: /Manage/VerifyPhoneNumber
public async Task<ActionResult> VerifyPhoneNumber(string phoneNumber)
{
var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber);
// Send an SMS through the SMS provider to verify the phone number
return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
}
//
// POST: /Manage/VerifyPhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code);
if (result.Succeeded)
{
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess });
}
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "Failed to verify phone");
return View(model);
}
//
// POST: /Manage/RemovePhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> RemovePhoneNumber()
{
var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null);
if (!result.Succeeded)
{
return RedirectToAction("Index", new { Message = ManageMessageId.Error });
}
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess });
}
//
// GET: /Manage/ChangePassword
public ActionResult ChangePassword()
{
return View();
}
//
// POST: /Manage/ChangePassword
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ChangePassword(ChangePasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
if (result.Succeeded)
{
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess });
}
AddErrors(result);
return View(model);
}
//
// GET: /Manage/SetPassword
public ActionResult SetPassword()
{
return View();
}
//
// POST: /Manage/SetPassword
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> SetPassword(SetPasswordViewModel model)
{
if (ModelState.IsValid)
{
var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
if (result.Succeeded)
{
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user != null)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
}
return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess });
}
AddErrors(result);
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Manage/ManageLogins
public async Task<ActionResult> ManageLogins(ManageMessageId? message)
{
ViewBag.StatusMessage =
message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
: message == ManageMessageId.Error ? "An error has occurred."
: "";
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user == null)
{
return View("Error");
}
var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId());
var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList();
ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1;
return View(new ManageLoginsViewModel
{
CurrentLogins = userLogins,
OtherLogins = otherLogins
});
}
//
// POST: /Manage/LinkLogin
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LinkLogin(string provider)
{
// Request a redirect to the external login provider to link a login for the current user
return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId());
}
//
// GET: /Manage/LinkLoginCallback
public async Task<ActionResult> LinkLoginCallback()
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
if (loginInfo == null)
{
return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
}
var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login);
return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
}
protected override void Dispose(bool disposing)
{
if (disposing && _userManager != null)
{
_userManager.Dispose();
_userManager = null;
}
base.Dispose(disposing);
}
#region Helpers
// Used for XSRF protection when adding external logins
private const string XsrfKey = "XsrfId";
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.GetOwinContext().Authentication;
}
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
private bool HasPassword()
{
var user = UserManager.FindById(User.Identity.GetUserId());
if (user != null)
{
return user.PasswordHash != null;
}
return false;
}
private bool HasPhoneNumber()
{
var user = UserManager.FindById(User.Identity.GetUserId());
if (user != null)
{
return user.PhoneNumber != null;
}
return false;
}
public enum ManageMessageId
{
AddPhoneSuccess,
ChangePasswordSuccess,
SetTwoFactorSuccess,
SetPasswordSuccess,
RemoveLoginSuccess,
RemovePhoneSuccess,
Error
}
#endregion
}
}

View file

@ -0,0 +1,320 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Project_Unite.Models;
namespace Project_Unite.Controllers
{
[Authorize]
public class ModeratorController : Controller
{
// GET: Moderator
public ActionResult Index()
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
ViewBag.Moderator = true;
return View();
}
public ActionResult UserDetails(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.DisplayName == id);
if (usr == null || !ACL.Granted(User.Identity.Name, "CanViewUserInfo"))
return new HttpStatusCodeResult(403);
return View(usr);
}
public ActionResult Users()
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanViewUserInfo"))
return new HttpStatusCodeResult(403);
return View(new ApplicationDbContext().Users);
}
public ActionResult Unban(string id, string returnUrl = "")
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanIssueBan"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.Id == id);
if (usr == null)
return new HttpStatusCodeResult(404);
if (usr.IsBanned == false) //we don't need to re-unban the user... save the SQL queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
usr.IsBanned = false;
db.AuditLogs.Add(new Models.AuditLog(User.Identity.GetUserId(), AuditLogLevel.Moderator, $@"Moderator has unbanned {ACL.UserNameRaw(id)}."));
db.SaveChanges();
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction("Users");
else
return Redirect(returnUrl);
}
public ActionResult Ban(string id, string returnUrl = "")
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanIssueBan"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.Id == id);
if (usr == null)
return new HttpStatusCodeResult(404);
if (usr.IsBanned == true) //we don't need to re-ban the user... save the SQL queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
usr.IsBanned = true;
usr.BannedAt = DateTime.Now;
usr.BannedBy = User.Identity.GetUserId();
db.AuditLogs.Add(new Models.AuditLog(User.Identity.GetUserId(), AuditLogLevel.Moderator, $@"Moderator has banned {ACL.UserNameRaw(id)}."));
db.SaveChanges();
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction("Users");
else
return Redirect(returnUrl);
}
public ActionResult Unmute(string id, string returnUrl = "")
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanIssueMute"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.Id == id);
if (usr == null)
return new HttpStatusCodeResult(404);
if (usr.IsMuted == false) //we don't need to re-unmute the user... save the SQL queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
usr.IsMuted = false;
db.AuditLogs.Add(new Models.AuditLog(User.Identity.GetUserId(), AuditLogLevel.Moderator, $@"Moderator has un-muted {ACL.UserNameRaw(id)}."));
db.SaveChanges();
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction("Users");
else
return Redirect(returnUrl);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ChangeUserName(string id, ApplicationUser model, string returnUrl = "")
{
string acl_r = "CanEditUsernames";
if (id == User.Identity.GetUserId())
acl_r = "CanEditUsername";
if (!ACL.Granted(User.Identity.Name, acl_r))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.Id == id);
if (usr == null)
return new HttpStatusCodeResult(404);
usr.DisplayName = model.DisplayName;
db.SaveChanges();
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction("Users");
else
return Redirect(returnUrl);
}
public ActionResult Lock(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
if (forum == null)
return new HttpStatusCodeResult(404);
string perm = "CanLockTopics";
var uid = User.Identity.GetUserId();
if (forum.AuthorId == uid)
perm = "CanLockOwnTopics";
if (!ACL.Granted(User.Identity.Name, perm))
return new HttpStatusCodeResult(403);
if (forum.IsLocked == true) //Save the DB queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
forum.IsLocked = true;
db.AuditLogs.Add(new AuditLog(uid, AuditLogLevel.Moderator, $"User has locked topic \"{forum.Subject}\" by {ACL.UserNameRaw(forum.AuthorId)}."));
db.SaveChanges();
return RedirectToAction("ViewTopic", "Forum", new { id = id });
}
public ActionResult Unlock(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
if (forum == null)
return new HttpStatusCodeResult(404);
string perm = "CanUnlockTopics";
var uid = User.Identity.GetUserId();
if (forum.AuthorId == uid)
perm = "CanUnlockOwnTopics";
if (!ACL.Granted(User.Identity.Name, perm))
return new HttpStatusCodeResult(403);
if (forum.IsLocked == false) //Save the DB queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
forum.IsLocked = false;
db.AuditLogs.Add(new AuditLog(uid, AuditLogLevel.Moderator, $"User has unlocked topic \"{forum.Subject}\" by {ACL.UserNameRaw(forum.AuthorId)}."));
db.SaveChanges();
return RedirectToAction("ViewTopic", "Forum", new { id = id });
}
public ActionResult List(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
if (forum == null)
return new HttpStatusCodeResult(404);
string perm = "CanUnlistTopics";
var uid = User.Identity.GetUserId();
if (forum.AuthorId == uid)
perm = "CanUnlistOwnTopics";
if (!ACL.Granted(User.Identity.Name, perm))
return new HttpStatusCodeResult(403);
if (forum.IsUnlisted == false) //Save the DB queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
forum.IsUnlisted = false;
db.SaveChanges();
db.AuditLogs.Add(new AuditLog(uid, AuditLogLevel.Moderator, $"User has listed topic \"{forum.Subject}\" by {ACL.UserNameRaw(forum.AuthorId)}."));
return RedirectToAction("ViewTopic", "Forum", new { id = id });
}
public ActionResult Unlist(string id)
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id);
if (forum == null)
return new HttpStatusCodeResult(404);
string perm = "CanUnlistTopics";
var uid = User.Identity.GetUserId();
if (forum.AuthorId == uid)
perm = "CanUnlistOwnTopics";
if (!ACL.Granted(User.Identity.Name, perm))
return new HttpStatusCodeResult(403);
if (forum.IsUnlisted == true) //Save the DB queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
forum.IsUnlisted = true;
db.AuditLogs.Add(new AuditLog(uid, AuditLogLevel.Moderator, $"User has unlisted topic \"{forum.Subject}\" by {ACL.UserNameRaw(forum.AuthorId)}."));
db.SaveChanges();
return RedirectToAction("ViewTopic", "Forum", new { id = id });
}
public ActionResult Bans()
{
var model = new ModeratorBanListViewModel();
var db = new ApplicationDbContext();
model.UserBans = db.Users.Where(x => x.IsBanned == true);
model.IPBans = db.BannedIPs;
return View(model);
}
public ActionResult Logs()
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
return View(db.AuditLogs.Where(x => x.Level != AuditLogLevel.Admin));
}
public ActionResult Mute(string id, string returnUrl = "")
{
if (!ACL.Granted(User.Identity.Name, "CanAccessModCP"))
return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanIssueMute"))
return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.Id == id);
if (usr == null)
return new HttpStatusCodeResult(404);
if (usr.IsMuted == true) //we don't need to re-mute the user... save the SQL queries...
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
usr.IsMuted = true;
usr.MutedAt = DateTime.Now;
usr.MutedBy = User.Identity.GetUserId();
db.AuditLogs.Add(new Models.AuditLog(User.Identity.GetUserId(), AuditLogLevel.Moderator, $@"Moderator has muted {ACL.UserNameRaw(id)}."));
db.SaveChanges();
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction("Users");
else
return Redirect(returnUrl);
}
}
}

View file

@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="Project_Unite.MvcApplication" Language="C#" %>

View file

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Microsoft.AspNet.Identity;
using Project_Unite.Models;
namespace Project_Unite
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
var addr = HttpContext.Current.Request.UserHostAddress;
var db = new ApplicationDbContext();
var ip = db.BannedIPs.FirstOrDefault(i => i.Address == addr);
if (ip != null)
{
//The user is banned. Anally rape their ability to get on here.
this.Response.StatusCode = 403;
this.CompleteRequest();
return;
}
}
protected void Application_EndRequest(object s, EventArgs e)
{
var db = new ApplicationDbContext();
if (!string.IsNullOrEmpty(User.Identity.Name))
{
//Check for a username ban.
var usr = db.Users.First(x => x.UserName == User.Identity.Name);
var banned = usr.IsBanned;
if (banned == true)
{
//The user is banned. Anally rape their ability to get on here.
this.Response.StatusCode = 200;
this.Response.ContentType = "plaintext";
this.Response.ClearContent();
this.Response.Output.Write($@"Greetings from the ShiftOS administration team, {ACL.UserNameRaw(User.Identity.GetUserId())}.
If you are seeing this page, it means two things:
1. I, Michael, am an awesome programmer and managed to get this ban system fully working.
2. You've been banned.
If you would like to appeal the ban, contact me through my email address: michaelshiftos@gmail.com
Ban information:
Bannee: {ACL.UserNameRaw(User.Identity.GetUserId())}
Banner: {ACL.UserNameRaw(usr.BannedBy)}
Timestamp: {usr.BannedAt}
DISCLAIMER:
=============
We reserve the right to disregard ban appeals if we see fit. Users other than myself or another Administrator
may administrate a ban appeal. Do not try to contact the banner. They will most likely not respond, and if they do,
it will most likely not end well for your status.
Do not attempt to multi-account or perform any form of ban-evading. If you are detected ban-evading,
you will be IP-banned and this screen won't be as friendly to you.
As it stands, this ban does not affect your ability to play ShiftOS. You can still connect to the multi-user domain,
however, if you do ban-evade, your IP ban CAN and WILL be extended to the multi-user domain.
We also reserve the right to purge your data after 2 months of a permanent ban. This is to save space on our database,
so do not cry to us when you find out you can't log in because your account got anhilated by the automatic purge system.
- Michael VanOverbeek, on behalf of the ShiftOS staff. Play fair.");
this.CompleteRequest();
return;
}
if (usr.LastKnownIPAddress != Request.UserHostAddress)
{
usr.LastKnownIPAddress = Request.UserHostAddress;
db.SaveChanges();
}
}
}
}
}

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class InitialCreate : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(InitialCreate));
string IMigrationMetadata.Id
{
get { return "201703151602344_InitialCreate"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,108 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class InitialCreate : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.AspNetRoles",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Name = c.String(nullable: false, maxLength: 256),
})
.PrimaryKey(t => t.Id)
.Index(t => t.Name, unique: true, name: "RoleNameIndex");
CreateTable(
"dbo.AspNetUserRoles",
c => new
{
UserId = c.String(nullable: false, maxLength: 128),
RoleId = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.UserId, t.RoleId })
.ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId)
.Index(t => t.RoleId);
CreateTable(
"dbo.AspNetUsers",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Codepoints = c.Long(nullable: false),
Bio = c.String(),
BannerUrl = c.String(),
AvatarUrl = c.String(),
DisplayName = c.String(),
FullName = c.String(),
Website = c.String(),
YoutubeUrl = c.String(),
SystemName = c.String(),
Email = c.String(maxLength: 256),
EmailConfirmed = c.Boolean(nullable: false),
PasswordHash = c.String(),
SecurityStamp = c.String(),
PhoneNumber = c.String(),
PhoneNumberConfirmed = c.Boolean(nullable: false),
TwoFactorEnabled = c.Boolean(nullable: false),
LockoutEndDateUtc = c.DateTime(),
LockoutEnabled = c.Boolean(nullable: false),
AccessFailedCount = c.Int(nullable: false),
UserName = c.String(nullable: false, maxLength: 256),
})
.PrimaryKey(t => t.Id)
.Index(t => t.UserName, unique: true, name: "UserNameIndex");
CreateTable(
"dbo.AspNetUserClaims",
c => new
{
Id = c.Int(nullable: false, identity: true),
UserId = c.String(nullable: false, maxLength: 128),
ClaimType = c.String(),
ClaimValue = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
CreateTable(
"dbo.AspNetUserLogins",
c => new
{
LoginProvider = c.String(nullable: false, maxLength: 128),
ProviderKey = c.String(nullable: false, maxLength: 128),
UserId = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
}
public override void Down()
{
DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
DropIndex("dbo.AspNetUsers", "UserNameIndex");
DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
DropIndex("dbo.AspNetRoles", "RoleNameIndex");
DropTable("dbo.AspNetUserLogins");
DropTable("dbo.AspNetUserClaims");
DropTable("dbo.AspNetUsers");
DropTable("dbo.AspNetUserRoles");
DropTable("dbo.AspNetRoles");
}
}
}

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Target" xml:space="preserve">
<value>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</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class CustomRoleSystem : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(CustomRoleSystem));
string IMigrationMetadata.Id
{
get { return "201703151901273_CustomRoleSystem"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,22 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class CustomRoleSystem : DbMigration
{
public override void Up()
{
AddColumn("dbo.AspNetRoles", "Description", c => c.String());
AddColumn("dbo.AspNetRoles", "ColorHex", c => c.String());
AddColumn("dbo.AspNetRoles", "Discriminator", c => c.String(nullable: false, maxLength: 128));
}
public override void Down()
{
DropColumn("dbo.AspNetRoles", "Discriminator");
DropColumn("dbo.AspNetRoles", "ColorHex");
DropColumn("dbo.AspNetRoles", "Description");
}
}
}

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Target" xml:space="preserve">
<value>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</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class acl_rsi_inducing_booleans_jesus_christ : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(acl_rsi_inducing_booleans_jesus_christ));
string IMigrationMetadata.Id
{
get { return "201703152047370_acl_rsi_inducing_booleans_jesus_christ"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,128 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class acl_rsi_inducing_booleans_jesus_christ : DbMigration
{
public override void Up()
{
AddColumn("dbo.AspNetRoles", "CanViewProfiles", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditOwnProfile", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditProfiles", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditUsername", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditUsernames", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanIssueBan", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanIssueIPBan", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanIssueEmailBan", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanIssueMute", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanReleaseBuild", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanBlog", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAccessModCP", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAccessAdminCP", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAccessDevCP", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditForumCategories", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanPostTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanPostPolls", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanPostReplies", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanPostStatuses", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditRoles", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteRoles", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteOwnPosts", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeletePosts", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteOwnStatuses", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteStatuses", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditOwnPosts", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditPosts", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditOwnStatuses", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanVoteInPolls", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteUsers", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAnonymizeUsers", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanPostSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditOwnSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanEditSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteOwnSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDeleteSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanUpvoteSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanDownvoteSkins", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanStickyOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanStickyTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAnnounceOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanAnnounceTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanGlobalOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanGlobalTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanMoveOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanMoveTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanUnlistOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanUnlistTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanLockOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanUnlockOwnTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanLockTopics", c => c.Boolean());
AddColumn("dbo.AspNetRoles", "CanUnlockTopics", c => c.Boolean());
}
public override void Down()
{
DropColumn("dbo.AspNetRoles", "CanUnlockTopics");
DropColumn("dbo.AspNetRoles", "CanLockTopics");
DropColumn("dbo.AspNetRoles", "CanUnlockOwnTopics");
DropColumn("dbo.AspNetRoles", "CanLockOwnTopics");
DropColumn("dbo.AspNetRoles", "CanUnlistTopics");
DropColumn("dbo.AspNetRoles", "CanUnlistOwnTopics");
DropColumn("dbo.AspNetRoles", "CanMoveTopics");
DropColumn("dbo.AspNetRoles", "CanMoveOwnTopics");
DropColumn("dbo.AspNetRoles", "CanGlobalTopics");
DropColumn("dbo.AspNetRoles", "CanGlobalOwnTopics");
DropColumn("dbo.AspNetRoles", "CanAnnounceTopics");
DropColumn("dbo.AspNetRoles", "CanAnnounceOwnTopics");
DropColumn("dbo.AspNetRoles", "CanStickyTopics");
DropColumn("dbo.AspNetRoles", "CanStickyOwnTopics");
DropColumn("dbo.AspNetRoles", "CanDownvoteSkins");
DropColumn("dbo.AspNetRoles", "CanUpvoteSkins");
DropColumn("dbo.AspNetRoles", "CanDeleteSkins");
DropColumn("dbo.AspNetRoles", "CanDeleteOwnSkins");
DropColumn("dbo.AspNetRoles", "CanEditSkins");
DropColumn("dbo.AspNetRoles", "CanEditOwnSkins");
DropColumn("dbo.AspNetRoles", "CanPostSkins");
DropColumn("dbo.AspNetRoles", "CanAnonymizeUsers");
DropColumn("dbo.AspNetRoles", "CanDeleteUsers");
DropColumn("dbo.AspNetRoles", "CanVoteInPolls");
DropColumn("dbo.AspNetRoles", "CanEditOwnStatuses");
DropColumn("dbo.AspNetRoles", "CanEditPosts");
DropColumn("dbo.AspNetRoles", "CanEditOwnPosts");
DropColumn("dbo.AspNetRoles", "CanEditTopics");
DropColumn("dbo.AspNetRoles", "CanEditOwnTopics");
DropColumn("dbo.AspNetRoles", "CanDeleteStatuses");
DropColumn("dbo.AspNetRoles", "CanDeleteOwnStatuses");
DropColumn("dbo.AspNetRoles", "CanDeletePosts");
DropColumn("dbo.AspNetRoles", "CanDeleteOwnPosts");
DropColumn("dbo.AspNetRoles", "CanDeleteTopics");
DropColumn("dbo.AspNetRoles", "CanDeleteOwnTopics");
DropColumn("dbo.AspNetRoles", "CanDeleteRoles");
DropColumn("dbo.AspNetRoles", "CanEditRoles");
DropColumn("dbo.AspNetRoles", "CanPostStatuses");
DropColumn("dbo.AspNetRoles", "CanPostReplies");
DropColumn("dbo.AspNetRoles", "CanPostPolls");
DropColumn("dbo.AspNetRoles", "CanPostTopics");
DropColumn("dbo.AspNetRoles", "CanEditForumCategories");
DropColumn("dbo.AspNetRoles", "CanAccessDevCP");
DropColumn("dbo.AspNetRoles", "CanAccessAdminCP");
DropColumn("dbo.AspNetRoles", "CanAccessModCP");
DropColumn("dbo.AspNetRoles", "CanBlog");
DropColumn("dbo.AspNetRoles", "CanReleaseBuild");
DropColumn("dbo.AspNetRoles", "CanIssueMute");
DropColumn("dbo.AspNetRoles", "CanIssueEmailBan");
DropColumn("dbo.AspNetRoles", "CanIssueIPBan");
DropColumn("dbo.AspNetRoles", "CanIssueBan");
DropColumn("dbo.AspNetRoles", "CanEditUsernames");
DropColumn("dbo.AspNetRoles", "CanEditUsername");
DropColumn("dbo.AspNetRoles", "CanEditProfiles");
DropColumn("dbo.AspNetRoles", "CanEditOwnProfile");
DropColumn("dbo.AspNetRoles", "CanViewProfiles");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class rolepriority : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(rolepriority));
string IMigrationMetadata.Id
{
get { return "201703152115389_role-priority"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,18 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class rolepriority : DbMigration
{
public override void Up()
{
AddColumn("dbo.AspNetRoles", "Priority", c => c.Int());
}
public override void Down()
{
DropColumn("dbo.AspNetRoles", "Priority");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class forum_backend_base : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(forum_backend_base));
string IMigrationMetadata.Id
{
get { return "201703160106134_forum_backend_base"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,112 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class forum_backend_base : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ForumCategories",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
ParentId = c.String(),
LinkUrl = c.String(),
ForumCategory_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumCategories", t => t.ForumCategory_Id)
.Index(t => t.ForumCategory_Id);
CreateTable(
"dbo.ForumPollOptions",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
PollId = c.String(),
Name = c.String(),
ForumPoll_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPolls", t => t.ForumPoll_Id)
.Index(t => t.ForumPoll_Id);
CreateTable(
"dbo.ForumPollVotes",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
PollOptionId = c.String(),
UserId = c.String(),
ForumPollOption_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPollOptions", t => t.ForumPollOption_Id)
.Index(t => t.ForumPollOption_Id);
CreateTable(
"dbo.ForumPolls",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Description = c.String(),
TopicId = c.String(),
IsActive = c.Boolean(nullable: false),
AllowMultivote = c.Boolean(nullable: false),
AllowVoteChanges = c.Boolean(nullable: false),
})
.PrimaryKey(t => t.Id);
CreateTable(
"dbo.ForumPosts",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
AuthorId = c.String(),
TopicId = c.String(),
Body = c.String(),
ForumTopic_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumTopics", t => t.ForumTopic_Id)
.Index(t => t.ForumTopic_Id);
CreateTable(
"dbo.ForumTopics",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Subject = c.String(),
AuthorId = c.String(),
CategoryId = c.String(),
IsSticky = c.Boolean(nullable: false),
IsAnnounce = c.Boolean(nullable: false),
IsUnlisted = c.Boolean(nullable: false),
IsGlobal = c.Boolean(nullable: false),
PollId = c.String(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropForeignKey("dbo.ForumPosts", "ForumTopic_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumPollOptions", "ForumPoll_Id", "dbo.ForumPolls");
DropForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumCategories", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id" });
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id" });
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id" });
DropTable("dbo.ForumTopics");
DropTable("dbo.ForumPosts");
DropTable("dbo.ForumPolls");
DropTable("dbo.ForumPollVotes");
DropTable("dbo.ForumPollOptions");
DropTable("dbo.ForumCategories");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class forum_relations : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(forum_relations));
string IMigrationMetadata.Id
{
get { return "201703160141526_forum_relations"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,26 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class forum_relations : DbMigration
{
public override void Up()
{
AddColumn("dbo.ForumCategories", "Name", c => c.String());
AddColumn("dbo.ForumCategories", "Description", c => c.String());
AddColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumTopics", "ForumCategory_Id");
AddForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories", "Id");
}
public override void Down()
{
DropForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id" });
DropColumn("dbo.ForumTopics", "ForumCategory_Id");
DropColumn("dbo.ForumCategories", "Description");
DropColumn("dbo.ForumCategories", "Name");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class votingsystemforums : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(votingsystemforums));
string IMigrationMetadata.Id
{
get { return "201703161150361_voting-system-forums"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,61 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class votingsystemforums : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ForumPostEdits",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
UserId = c.String(),
EditReason = c.String(),
PreviousState = c.String(),
EditedAt = c.DateTime(nullable: false),
ForumPost_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPosts", t => t.ForumPost_Id)
.Index(t => t.ForumPost_Id);
CreateTable(
"dbo.Likes",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Post_Id = c.String(maxLength: 128),
User_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPosts", t => t.Post_Id)
.ForeignKey("dbo.AspNetUsers", t => t.User_Id)
.Index(t => t.Post_Id)
.Index(t => t.User_Id);
AddColumn("dbo.ForumTopics", "Votes", c => c.Int(nullable: false));
AddColumn("dbo.ForumTopics", "StartedAt", c => c.DateTime(nullable: false));
AddColumn("dbo.ForumPosts", "PostedAt", c => c.DateTime(nullable: false));
AddColumn("dbo.AspNetRoles", "CanDeleteForumCategories", c => c.Boolean());
}
public override void Down()
{
DropForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers");
DropForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts");
DropForeignKey("dbo.ForumPostEdits", "ForumPost_Id", "dbo.ForumPosts");
DropIndex("dbo.Likes", new[] { "User_Id" });
DropIndex("dbo.Likes", new[] { "Post_Id" });
DropIndex("dbo.ForumPostEdits", new[] { "ForumPost_Id" });
DropColumn("dbo.AspNetRoles", "CanDeleteForumCategories");
DropColumn("dbo.ForumPosts", "PostedAt");
DropColumn("dbo.ForumTopics", "StartedAt");
DropColumn("dbo.ForumTopics", "Votes");
DropTable("dbo.Likes");
DropTable("dbo.ForumPostEdits");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class candeleteforumcategories : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(candeleteforumcategories));
string IMigrationMetadata.Id
{
get { return "201703161217271_candeleteforumcategories"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class candeleteforumcategories : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class moreaclstuff : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(moreaclstuff));
string IMigrationMetadata.Id
{
get { return "201703161328360_more-acl-stuff"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,34 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class moreaclstuff : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ACLForumPermissions",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
RoleId = c.String(),
CanSee = c.Boolean(nullable: false),
CanReply = c.Boolean(nullable: false),
CanPost = c.Boolean(nullable: false),
ForumCategory_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumCategories", t => t.ForumCategory_Id)
.Index(t => t.ForumCategory_Id);
}
public override void Down()
{
DropForeignKey("dbo.ACLForumPermissions", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ACLForumPermissions", new[] { "ForumCategory_Id" });
DropTable("dbo.ACLForumPermissions");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class relationfix : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(relationfix));
string IMigrationMetadata.Id
{
get { return "201703161505425_relationfix"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,96 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class relationfix : DbMigration
{
public override void Up()
{
DropForeignKey("dbo.ForumCategories", "ForumCategory_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ForumPosts", "ForumTopic_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumPollOptions", "ForumPoll_Id", "dbo.ForumPolls");
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id" });
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id" });
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id" });
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id" });
RenameColumn(table: "dbo.Likes", name: "Post_Id", newName: "ForumPost_Id1");
RenameIndex(table: "dbo.Likes", name: "IX_Post_Id", newName: "IX_ForumPost_Id1");
AddColumn("dbo.ForumCategories", "ForumCategory_Id1", c => c.String(maxLength: 128));
AddColumn("dbo.ForumTopics", "ForumCategory_Id1", c => c.String(maxLength: 128));
AddColumn("dbo.ForumPosts", "ForumTopic_Id1", c => c.String(maxLength: 128));
AddColumn("dbo.Likes", "ForumPost_Id", c => c.String());
AddColumn("dbo.ForumPollOptions", "ForumPoll_Id1", c => c.String(maxLength: 128));
AddColumn("dbo.ForumPollVotes", "ForumPollOption_Id1", c => c.String(maxLength: 128));
AddColumn("dbo.ForumPolls", "ForumTopic_Id", c => c.String());
AlterColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String());
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String());
AlterColumn("dbo.ForumPosts", "ForumTopic_Id", c => c.String());
AlterColumn("dbo.ForumPollOptions", "ForumPoll_Id", c => c.String());
AlterColumn("dbo.ForumPollVotes", "ForumPollOption_Id", c => c.String());
CreateIndex("dbo.ForumCategories", "ForumCategory_Id1");
CreateIndex("dbo.ForumTopics", "ForumCategory_Id1");
CreateIndex("dbo.ForumPosts", "ForumTopic_Id1");
CreateIndex("dbo.ForumPollOptions", "ForumPoll_Id1");
CreateIndex("dbo.ForumPollVotes", "ForumPollOption_Id1");
AddForeignKey("dbo.ForumCategories", "ForumCategory_Id1", "dbo.ForumCategories", "Id");
AddForeignKey("dbo.ForumTopics", "ForumCategory_Id1", "dbo.ForumCategories", "Id");
AddForeignKey("dbo.ForumPosts", "ForumTopic_Id1", "dbo.ForumTopics", "Id");
AddForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id1", "dbo.ForumPollOptions", "Id");
AddForeignKey("dbo.ForumPollOptions", "ForumPoll_Id1", "dbo.ForumPolls", "Id");
DropColumn("dbo.ForumCategories", "ParentId");
DropColumn("dbo.ForumTopics", "CategoryId");
DropColumn("dbo.ForumPosts", "TopicId");
DropColumn("dbo.ForumPollOptions", "PollId");
DropColumn("dbo.ForumPollVotes", "PollOptionId");
DropColumn("dbo.ForumPolls", "TopicId");
}
public override void Down()
{
AddColumn("dbo.ForumPolls", "TopicId", c => c.String());
AddColumn("dbo.ForumPollVotes", "PollOptionId", c => c.String());
AddColumn("dbo.ForumPollOptions", "PollId", c => c.String());
AddColumn("dbo.ForumPosts", "TopicId", c => c.String());
AddColumn("dbo.ForumTopics", "CategoryId", c => c.String());
AddColumn("dbo.ForumCategories", "ParentId", c => c.String());
DropForeignKey("dbo.ForumPollOptions", "ForumPoll_Id1", "dbo.ForumPolls");
DropForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id1", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumPosts", "ForumTopic_Id1", "dbo.ForumTopics");
DropForeignKey("dbo.ForumTopics", "ForumCategory_Id1", "dbo.ForumCategories");
DropForeignKey("dbo.ForumCategories", "ForumCategory_Id1", "dbo.ForumCategories");
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id1" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id1" });
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id1" });
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id1" });
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id1" });
AlterColumn("dbo.ForumPollVotes", "ForumPollOption_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPollOptions", "ForumPoll_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPosts", "ForumTopic_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String(maxLength: 128));
DropColumn("dbo.ForumPolls", "ForumTopic_Id");
DropColumn("dbo.ForumPollVotes", "ForumPollOption_Id1");
DropColumn("dbo.ForumPollOptions", "ForumPoll_Id1");
DropColumn("dbo.Likes", "ForumPost_Id");
DropColumn("dbo.ForumPosts", "ForumTopic_Id1");
DropColumn("dbo.ForumTopics", "ForumCategory_Id1");
DropColumn("dbo.ForumCategories", "ForumCategory_Id1");
RenameIndex(table: "dbo.Likes", name: "IX_ForumPost_Id1", newName: "IX_Post_Id");
RenameColumn(table: "dbo.Likes", name: "ForumPost_Id1", newName: "Post_Id");
CreateIndex("dbo.ForumPollVotes", "ForumPollOption_Id");
CreateIndex("dbo.ForumPollOptions", "ForumPoll_Id");
CreateIndex("dbo.ForumPosts", "ForumTopic_Id");
CreateIndex("dbo.ForumTopics", "ForumCategory_Id");
CreateIndex("dbo.ForumCategories", "ForumCategory_Id");
AddForeignKey("dbo.ForumPollOptions", "ForumPoll_Id", "dbo.ForumPolls", "Id");
AddForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id", "dbo.ForumPollOptions", "Id");
AddForeignKey("dbo.ForumPosts", "ForumTopic_Id", "dbo.ForumTopics", "Id");
AddForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories", "Id");
AddForeignKey("dbo.ForumCategories", "ForumCategory_Id", "dbo.ForumCategories", "Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class mistake : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(mistake));
string IMigrationMetadata.Id
{
get { return "201703161515127_mistake"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,78 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class mistake : DbMigration
{
public override void Up()
{
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id1" });
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id1" });
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id1" });
DropIndex("dbo.Likes", new[] { "ForumPost_Id1" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id1" });
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id1" });
DropColumn("dbo.ForumCategories", "ForumCategory_Id");
DropColumn("dbo.ForumTopics", "ForumCategory_Id");
DropColumn("dbo.ForumPosts", "ForumTopic_Id");
DropColumn("dbo.Likes", "ForumPost_Id");
DropColumn("dbo.ForumPollOptions", "ForumPoll_Id");
DropColumn("dbo.ForumPollVotes", "ForumPollOption_Id");
RenameColumn(table: "dbo.ForumCategories", name: "ForumCategory_Id1", newName: "ForumCategory_Id");
RenameColumn(table: "dbo.ForumTopics", name: "ForumCategory_Id1", newName: "ForumCategory_Id");
RenameColumn(table: "dbo.ForumPosts", name: "ForumTopic_Id1", newName: "ForumTopic_Id");
RenameColumn(table: "dbo.Likes", name: "ForumPost_Id1", newName: "ForumPost_Id");
RenameColumn(table: "dbo.ForumPollVotes", name: "ForumPollOption_Id1", newName: "ForumPollOption_Id");
RenameColumn(table: "dbo.ForumPollOptions", name: "ForumPoll_Id1", newName: "ForumPoll_Id");
AlterColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPosts", "ForumTopic_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.Likes", "ForumPost_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPollOptions", "ForumPoll_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPollVotes", "ForumPollOption_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumCategories", "ForumCategory_Id");
CreateIndex("dbo.ForumTopics", "ForumCategory_Id");
CreateIndex("dbo.ForumPosts", "ForumTopic_Id");
CreateIndex("dbo.Likes", "ForumPost_Id");
CreateIndex("dbo.ForumPollOptions", "ForumPoll_Id");
CreateIndex("dbo.ForumPollVotes", "ForumPollOption_Id");
DropColumn("dbo.ForumPolls", "ForumTopic_Id");
}
public override void Down()
{
AddColumn("dbo.ForumPolls", "ForumTopic_Id", c => c.String());
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id" });
DropIndex("dbo.Likes", new[] { "ForumPost_Id" });
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id" });
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id" });
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id" });
AlterColumn("dbo.ForumPollVotes", "ForumPollOption_Id", c => c.String());
AlterColumn("dbo.ForumPollOptions", "ForumPoll_Id", c => c.String());
AlterColumn("dbo.Likes", "ForumPost_Id", c => c.String());
AlterColumn("dbo.ForumPosts", "ForumTopic_Id", c => c.String());
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String());
AlterColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String());
RenameColumn(table: "dbo.ForumPollOptions", name: "ForumPoll_Id", newName: "ForumPoll_Id1");
RenameColumn(table: "dbo.ForumPollVotes", name: "ForumPollOption_Id", newName: "ForumPollOption_Id1");
RenameColumn(table: "dbo.Likes", name: "ForumPost_Id", newName: "ForumPost_Id1");
RenameColumn(table: "dbo.ForumPosts", name: "ForumTopic_Id", newName: "ForumTopic_Id1");
RenameColumn(table: "dbo.ForumTopics", name: "ForumCategory_Id", newName: "ForumCategory_Id1");
RenameColumn(table: "dbo.ForumCategories", name: "ForumCategory_Id", newName: "ForumCategory_Id1");
AddColumn("dbo.ForumPollVotes", "ForumPollOption_Id", c => c.String());
AddColumn("dbo.ForumPollOptions", "ForumPoll_Id", c => c.String());
AddColumn("dbo.Likes", "ForumPost_Id", c => c.String());
AddColumn("dbo.ForumPosts", "ForumTopic_Id", c => c.String());
AddColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String());
AddColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String());
CreateIndex("dbo.ForumPollVotes", "ForumPollOption_Id1");
CreateIndex("dbo.ForumPollOptions", "ForumPoll_Id1");
CreateIndex("dbo.Likes", "ForumPost_Id1");
CreateIndex("dbo.ForumPosts", "ForumTopic_Id1");
CreateIndex("dbo.ForumTopics", "ForumCategory_Id1");
CreateIndex("dbo.ForumCategories", "ForumCategory_Id1");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class morerelationfix : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(morerelationfix));
string IMigrationMetadata.Id
{
get { return "201703161536324_morerelationfix"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,54 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class morerelationfix : DbMigration
{
public override void Up()
{
RenameColumn(table: "dbo.ForumCategories", name: "ForumCategory_Id", newName: "Parent_Id");
RenameColumn(table: "dbo.ACLForumPermissions", name: "ForumCategory_Id", newName: "Parent_Id");
RenameColumn(table: "dbo.ForumTopics", name: "ForumCategory_Id", newName: "Parent_Id");
RenameColumn(table: "dbo.ForumPosts", name: "ForumTopic_Id", newName: "Parent_Id");
RenameColumn(table: "dbo.ForumPostEdits", name: "ForumPost_Id", newName: "Parent_Id");
RenameColumn(table: "dbo.Likes", name: "ForumPost_Id", newName: "Post_Id");
RenameColumn(table: "dbo.ForumPollVotes", name: "ForumPollOption_Id", newName: "Option_Id");
RenameColumn(table: "dbo.ForumPollOptions", name: "ForumPoll_Id", newName: "Poll_Id");
RenameIndex(table: "dbo.ForumCategories", name: "IX_ForumCategory_Id", newName: "IX_Parent_Id");
RenameIndex(table: "dbo.ACLForumPermissions", name: "IX_ForumCategory_Id", newName: "IX_Parent_Id");
RenameIndex(table: "dbo.ForumTopics", name: "IX_ForumCategory_Id", newName: "IX_Parent_Id");
RenameIndex(table: "dbo.ForumPosts", name: "IX_ForumTopic_Id", newName: "IX_Parent_Id");
RenameIndex(table: "dbo.ForumPostEdits", name: "IX_ForumPost_Id", newName: "IX_Parent_Id");
RenameIndex(table: "dbo.Likes", name: "IX_ForumPost_Id", newName: "IX_Post_Id");
RenameIndex(table: "dbo.ForumPollOptions", name: "IX_ForumPoll_Id", newName: "IX_Poll_Id");
RenameIndex(table: "dbo.ForumPollVotes", name: "IX_ForumPollOption_Id", newName: "IX_Option_Id");
AddColumn("dbo.ForumPolls", "Parent_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumPolls", "Parent_Id");
AddForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics", "Id");
}
public override void Down()
{
DropForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics");
DropIndex("dbo.ForumPolls", new[] { "Parent_Id" });
DropColumn("dbo.ForumPolls", "Parent_Id");
RenameIndex(table: "dbo.ForumPollVotes", name: "IX_Option_Id", newName: "IX_ForumPollOption_Id");
RenameIndex(table: "dbo.ForumPollOptions", name: "IX_Poll_Id", newName: "IX_ForumPoll_Id");
RenameIndex(table: "dbo.Likes", name: "IX_Post_Id", newName: "IX_ForumPost_Id");
RenameIndex(table: "dbo.ForumPostEdits", name: "IX_Parent_Id", newName: "IX_ForumPost_Id");
RenameIndex(table: "dbo.ForumPosts", name: "IX_Parent_Id", newName: "IX_ForumTopic_Id");
RenameIndex(table: "dbo.ForumTopics", name: "IX_Parent_Id", newName: "IX_ForumCategory_Id");
RenameIndex(table: "dbo.ACLForumPermissions", name: "IX_Parent_Id", newName: "IX_ForumCategory_Id");
RenameIndex(table: "dbo.ForumCategories", name: "IX_Parent_Id", newName: "IX_ForumCategory_Id");
RenameColumn(table: "dbo.ForumPollOptions", name: "Poll_Id", newName: "ForumPoll_Id");
RenameColumn(table: "dbo.ForumPollVotes", name: "Option_Id", newName: "ForumPollOption_Id");
RenameColumn(table: "dbo.Likes", name: "Post_Id", newName: "ForumPost_Id");
RenameColumn(table: "dbo.ForumPostEdits", name: "Parent_Id", newName: "ForumPost_Id");
RenameColumn(table: "dbo.ForumPosts", name: "Parent_Id", newName: "ForumTopic_Id");
RenameColumn(table: "dbo.ForumTopics", name: "Parent_Id", newName: "ForumCategory_Id");
RenameColumn(table: "dbo.ACLForumPermissions", name: "Parent_Id", newName: "ForumCategory_Id");
RenameColumn(table: "dbo.ForumCategories", name: "Parent_Id", newName: "ForumCategory_Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class cdelete : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(cdelete));
string IMigrationMetadata.Id
{
get { return "201703161607158_cdelete"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,116 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class cdelete : DbMigration
{
public override void Up()
{
//Cannot insert the value NULL into column 'Parent_Id', table 'aspnet-Project-Unite-20170315114859.dbo.ForumCategories'; column does not allow nulls. UPDATE fails.
//The statement has been terminated.
DropForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ForumPosts", "Parent_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumPostEdits", "Parent_Id", "dbo.ForumPosts");
DropForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts");
DropForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers");
DropForeignKey("dbo.ForumPollOptions", "Poll_Id", "dbo.ForumPolls");
DropForeignKey("dbo.ForumPollVotes", "Option_Id", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics");
DropIndex("dbo.ForumCategories", new[] { "Parent_Id" });
DropIndex("dbo.ACLForumPermissions", new[] { "Parent_Id" });
DropIndex("dbo.ForumTopics", new[] { "Parent_Id" });
DropIndex("dbo.ForumPosts", new[] { "Parent_Id" });
DropIndex("dbo.ForumPostEdits", new[] { "Parent_Id" });
DropIndex("dbo.Likes", new[] { "Post_Id" });
DropIndex("dbo.Likes", new[] { "User_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "Poll_Id" });
DropIndex("dbo.ForumPolls", new[] { "Parent_Id" });
DropIndex("dbo.ForumPollVotes", new[] { "Option_Id" });
AlterColumn("dbo.ForumCategories", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ACLForumPermissions", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumTopics", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumPosts", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumPostEdits", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.Likes", "Post_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.Likes", "User_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumPollOptions", "Poll_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumPolls", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
AlterColumn("dbo.ForumPollVotes", "Option_Id", c => c.String(nullable: false, maxLength: 128));
CreateIndex("dbo.ForumCategories", "Parent_Id");
CreateIndex("dbo.ACLForumPermissions", "Parent_Id");
CreateIndex("dbo.ForumTopics", "Parent_Id");
CreateIndex("dbo.ForumPosts", "Parent_Id");
CreateIndex("dbo.ForumPostEdits", "Parent_Id");
CreateIndex("dbo.Likes", "Post_Id");
CreateIndex("dbo.Likes", "User_Id");
CreateIndex("dbo.ForumPollOptions", "Poll_Id");
CreateIndex("dbo.ForumPolls", "Parent_Id");
CreateIndex("dbo.ForumPollVotes", "Option_Id");
AddForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumPosts", "Parent_Id", "dbo.ForumTopics", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumPostEdits", "Parent_Id", "dbo.ForumPosts", "Id", cascadeDelete: true);
AddForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts", "Id", cascadeDelete: true);
AddForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumPollOptions", "Poll_Id", "dbo.ForumPolls", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumPollVotes", "Option_Id", "dbo.ForumPollOptions", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics", "Id", cascadeDelete: true);
}
public override void Down()
{
DropForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumPollVotes", "Option_Id", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumPollOptions", "Poll_Id", "dbo.ForumPolls");
DropForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers");
DropForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts");
DropForeignKey("dbo.ForumPostEdits", "Parent_Id", "dbo.ForumPosts");
DropForeignKey("dbo.ForumPosts", "Parent_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumPollVotes", new[] { "Option_Id" });
DropIndex("dbo.ForumPolls", new[] { "Parent_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "Poll_Id" });
DropIndex("dbo.Likes", new[] { "User_Id" });
DropIndex("dbo.Likes", new[] { "Post_Id" });
DropIndex("dbo.ForumPostEdits", new[] { "Parent_Id" });
DropIndex("dbo.ForumPosts", new[] { "Parent_Id" });
DropIndex("dbo.ForumTopics", new[] { "Parent_Id" });
DropIndex("dbo.ACLForumPermissions", new[] { "Parent_Id" });
DropIndex("dbo.ForumCategories", new[] { "Parent_Id" });
AlterColumn("dbo.ForumPollVotes", "Option_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPolls", "Parent_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPollOptions", "Poll_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.Likes", "User_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.Likes", "Post_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPostEdits", "Parent_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumPosts", "Parent_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumTopics", "Parent_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ACLForumPermissions", "Parent_Id", c => c.String(maxLength: 128));
AlterColumn("dbo.ForumCategories", "Parent_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumPollVotes", "Option_Id");
CreateIndex("dbo.ForumPolls", "Parent_Id");
CreateIndex("dbo.ForumPollOptions", "Poll_Id");
CreateIndex("dbo.Likes", "User_Id");
CreateIndex("dbo.Likes", "Post_Id");
CreateIndex("dbo.ForumPostEdits", "Parent_Id");
CreateIndex("dbo.ForumPosts", "Parent_Id");
CreateIndex("dbo.ForumTopics", "Parent_Id");
CreateIndex("dbo.ACLForumPermissions", "Parent_Id");
CreateIndex("dbo.ForumCategories", "Parent_Id");
AddForeignKey("dbo.ForumPolls", "Parent_Id", "dbo.ForumTopics", "Id");
AddForeignKey("dbo.ForumPollVotes", "Option_Id", "dbo.ForumPollOptions", "Id");
AddForeignKey("dbo.ForumPollOptions", "Poll_Id", "dbo.ForumPolls", "Id");
AddForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers", "Id");
AddForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts", "Id");
AddForeignKey("dbo.ForumPostEdits", "Parent_Id", "dbo.ForumPosts", "Id");
AddForeignKey("dbo.ForumPosts", "Parent_Id", "dbo.ForumTopics", "Id");
AddForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories", "Id");
AddForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories", "Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class fuck : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(fuck));
string IMigrationMetadata.Id
{
get { return "201703161645354_fuck."; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,22 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class fuck : DbMigration
{
public override void Up()
{
DropIndex("dbo.ForumCategories", new[] { "Parent_Id" });
AlterColumn("dbo.ForumCategories", "Parent_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumCategories", "Parent_Id");
}
public override void Down()
{
DropIndex("dbo.ForumCategories", new[] { "Parent_Id" });
AlterColumn("dbo.ForumCategories", "Parent_Id", c => c.String(nullable: false, maxLength: 128));
CreateIndex("dbo.ForumCategories", "Parent_Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class morerelationshipshit : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(morerelationshipshit));
string IMigrationMetadata.Id
{
get { return "201703161804526_more-relationship-shit"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class morerelationshipshit : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class FUCKFUCKFUCK : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FUCKFUCKFUCK));
string IMigrationMetadata.Id
{
get { return "201703161812076_FUCKFUCKFUCK"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FUCKFUCKFUCK : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class TAKEMEWITHYOUWHENYOUGO : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(TAKEMEWITHYOUWHENYOUGO));
string IMigrationMetadata.Id
{
get { return "201703161820307_TAKEMEWITHYOUWHENYOUGO"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class TAKEMEWITHYOUWHENYOUGO : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class jonathan_ladouceur_would_be_better_at_this_than_me_ffs : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(jonathan_ladouceur_would_be_better_at_this_than_me_ffs));
string IMigrationMetadata.Id
{
get { return "201703161841223_jonathan_ladouceur_would_be_better_at_this_than_me_ffs"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class jonathan_ladouceur_would_be_better_at_this_than_me_ffs : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class jonny_please : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(jonny_please));
string IMigrationMetadata.Id
{
get { return "201703161844454_jonny_please"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class jonny_please : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class app : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(app));
string IMigrationMetadata.Id
{
get { return "201703161854009_app"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,40 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class app : DbMigration
{
public override void Up()
{
//Column names in each table must be unique. Column name 'Parent_Id' in table 'dbo.ACLForumPermissions' is specified more than once.
//Cannot drop the table 'dbo.ACLForumPermissionForumCategories', because it does not exist or you do not have permission.
DropForeignKey("dbo.ACLForumPermissionForumCategories", "ACLForumPermission_Id", "dbo.ACLForumPermissions");
DropForeignKey("dbo.ACLForumPermissionForumCategories", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ACLForumPermissionForumCategories", new[] { "ACLForumPermission_Id" });
DropIndex("dbo.ACLForumPermissionForumCategories", new[] { "ForumCategory_Id" });
}
public override void Down()
{
CreateTable(
"dbo.ACLForumPermissionForumCategories",
c => new
{
ACLForumPermission_Id = c.String(nullable: false, maxLength: 128),
ForumCategory_Id = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.ACLForumPermission_Id, t.ForumCategory_Id });
DropForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories");
DropIndex("dbo.ACLForumPermissions", new[] { "Parent_Id" });
DropColumn("dbo.ACLForumPermissions", "Parent_Id");
CreateIndex("dbo.ACLForumPermissionForumCategories", "ForumCategory_Id");
CreateIndex("dbo.ACLForumPermissionForumCategories", "ACLForumPermission_Id");
AddForeignKey("dbo.ACLForumPermissionForumCategories", "ForumCategory_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
AddForeignKey("dbo.ACLForumPermissionForumCategories", "ACLForumPermission_Id", "dbo.ACLForumPermissions", "Id", cascadeDelete: true);
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class dingdong : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(dingdong));
string IMigrationMetadata.Id
{
get { return "201703161905556_dingdong"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class dingdong : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class help_me : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(help_me));
string IMigrationMetadata.Id
{
get { return "201703161941448_help_me"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,22 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class help_me : DbMigration
{
public override void Up()
{
RenameColumn(table: "dbo.ForumCategories", name: "Parent_Id", newName: "ForumCategory_Id");
RenameIndex(table: "dbo.ForumCategories", name: "IX_Parent_Id", newName: "IX_ForumCategory_Id");
AddColumn("dbo.ForumCategories", "Parent", c => c.String());
}
public override void Down()
{
DropColumn("dbo.ForumCategories", "Parent");
RenameIndex(table: "dbo.ForumCategories", name: "IX_ForumCategory_Id", newName: "IX_Parent_Id");
RenameColumn(table: "dbo.ForumCategories", name: "ForumCategory_Id", newName: "Parent_Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class do_dodododo_do_do : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(do_dodododo_do_do));
string IMigrationMetadata.Id
{
get { return "201703161947569_do_dodododo_do_do"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,34 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class do_dodododo_do_do : DbMigration
{
public override void Up()
{
}
public override void Down()
{
DropForeignKey("dbo.ForumTopics", new[] { "Parent_Id", "Parent_Parent" }, "dbo.ForumCategories");
DropForeignKey("dbo.ACLForumPermissions", new[] { "Parent_Id", "Parent_Parent" }, "dbo.ForumCategories");
DropForeignKey("dbo.ForumCategories", new[] { "ForumCategory_Id", "ForumCategory_Parent" }, "dbo.ForumCategories");
DropIndex("dbo.ForumTopics", new[] { "Parent_Id", "Parent_Parent" });
DropIndex("dbo.ACLForumPermissions", new[] { "Parent_Id", "Parent_Parent" });
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id", "ForumCategory_Parent" });
DropPrimaryKey("dbo.ForumCategories");
AlterColumn("dbo.ForumCategories", "Parent", c => c.String());
DropColumn("dbo.ForumTopics", "Parent_Parent");
DropColumn("dbo.ACLForumPermissions", "Parent_Parent");
DropColumn("dbo.ForumCategories", "ForumCategory_Parent");
AddPrimaryKey("dbo.ForumCategories", "Id");
CreateIndex("dbo.ForumTopics", "Parent_Id");
CreateIndex("dbo.ACLForumPermissions", "Parent_Id");
CreateIndex("dbo.ForumCategories", "ForumCategory_Id");
AddForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
AddForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
AddForeignKey("dbo.ForumCategories", "ForumCategory_Id", "dbo.ForumCategories", "Id");
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class jonny___ : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(jonny___));
string IMigrationMetadata.Id
{
get { return "201703162001254_jonny___"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,33 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class jonny___ : DbMigration
{
public override void Up()
{
}
public override void Down()
{
AddColumn("dbo.ForumTopics", "Parent_Parent", c => c.String(nullable: false, maxLength: 128));
AddColumn("dbo.ACLForumPermissions", "Parent_Parent", c => c.String(nullable: false, maxLength: 128));
AddColumn("dbo.ForumCategories", "ForumCategory_Parent", c => c.String(maxLength: 128));
AddColumn("dbo.ForumCategories", "ForumCategory_Id", c => c.String(maxLength: 128));
DropForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories");
DropForeignKey("dbo.ACLForumPermissions", "Parent_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumTopics", new[] { "Parent_Id" });
DropIndex("dbo.ACLForumPermissions", new[] { "Parent_Id" });
DropPrimaryKey("dbo.ForumCategories");
AlterColumn("dbo.ForumCategories", "Parent", c => c.String(nullable: false, maxLength: 128));
AddPrimaryKey("dbo.ForumCategories", new[] { "Id", "Parent" });
CreateIndex("dbo.ForumTopics", new[] { "Parent_Id", "Parent_Parent" });
CreateIndex("dbo.ACLForumPermissions", new[] { "Parent_Id", "Parent_Parent" });
CreateIndex("dbo.ForumCategories", new[] { "ForumCategory_Id", "ForumCategory_Parent" });
AddForeignKey("dbo.ForumTopics", new[] { "Parent_Id", "Parent_Parent" }, "dbo.ForumCategories", new[] { "Id", "Parent" }, cascadeDelete: true);
AddForeignKey("dbo.ACLForumPermissions", new[] { "Parent_Id", "Parent_Parent" }, "dbo.ForumCategories", new[] { "Id", "Parent" }, cascadeDelete: true);
AddForeignKey("dbo.ForumCategories", new[] { "ForumCategory_Id", "ForumCategory_Parent" }, "dbo.ForumCategories", new[] { "Id", "Parent" });
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class running_out_of_names : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(running_out_of_names));
string IMigrationMetadata.Id
{
get { return "201703162003429_running_out_of_names"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,30 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class running_out_of_names : DbMigration
{
public override void Up()
{
DropForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumTopics", new[] { "Parent_Id" });
RenameColumn(table: "dbo.ForumTopics", name: "Parent_Id", newName: "ForumCategory_Id");
AddColumn("dbo.ForumTopics", "Parent", c => c.String(nullable: false));
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String(maxLength: 128));
CreateIndex("dbo.ForumTopics", "ForumCategory_Id");
AddForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories", "Id");
}
public override void Down()
{
DropForeignKey("dbo.ForumTopics", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumTopics", new[] { "ForumCategory_Id" });
AlterColumn("dbo.ForumTopics", "ForumCategory_Id", c => c.String(nullable: false, maxLength: 128));
DropColumn("dbo.ForumTopics", "Parent");
RenameColumn(table: "dbo.ForumTopics", name: "ForumCategory_Id", newName: "Parent_Id");
CreateIndex("dbo.ForumTopics", "Parent_Id");
AddForeignKey("dbo.ForumTopics", "Parent_Id", "dbo.ForumCategories", "Id", cascadeDelete: true);
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class killme : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(killme));
string IMigrationMetadata.Id
{
get { return "201703162019023_killme"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View file

@ -0,0 +1,16 @@
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class killme : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
// <auto-generated />
namespace Project_Unite.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class jonathan_ladouceur : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(jonathan_ladouceur));
string IMigrationMetadata.Id
{
get { return "201703171437322_jonathan_ladouceur"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

Some files were not shown because too many files have changed in this diff Show more