no-more-circle-autorisation-to-file
parent
f3d3a7e575
commit
6ae7333dbb
@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Yavsc.Abstract;
|
|
||||||
using Yavsc.Abstract.Identity.Security;
|
|
||||||
using Yavsc.Attributes.Validation;
|
|
||||||
using Yavsc.Models.Relationship;
|
|
||||||
|
|
||||||
namespace Yavsc.Server.Models.Access
|
|
||||||
{
|
|
||||||
[Obsolete("use rules from .access files")]
|
|
||||||
public class CircleAuthorizationToFile : ICircleAuthorization
|
|
||||||
{
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public long CircleId
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
[YaStringLength(48)]
|
|
||||||
[YaRegularExpression(Constants.UserFileNamePatternRegExp)]
|
|
||||||
public string FullPath
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[ForeignKey("CircleId"), JsonIgnore]
|
|
||||||
public virtual Circle Circle { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,188 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Authorization;
|
|
||||||
using Microsoft.AspNet.Http;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.Data.Entity;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Server.Models.Access;
|
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
|
||||||
{
|
|
||||||
[Produces("application/json")]
|
|
||||||
[Route("api/FileCircleApi")]
|
|
||||||
[Authorize]
|
|
||||||
public class FileCircleApiController : Controller
|
|
||||||
{
|
|
||||||
private readonly ApplicationDbContext _context;
|
|
||||||
|
|
||||||
public FileCircleApiController(ApplicationDbContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: api/FileCircleApi
|
|
||||||
[HttpGet]
|
|
||||||
public IEnumerable<CircleAuthorizationToFile> GetCircleAuthorizationToFile()
|
|
||||||
{
|
|
||||||
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
return _context.CircleAuthorizationToFile
|
|
||||||
.Include( m => m.Circle)
|
|
||||||
.Where( m => m.Circle.OwnerId == uid);
|
|
||||||
|
|
||||||
// .Where( m => (m.Circle.Public || m.Circle.OwnerId == uid || m.Circle.Members.Any(u=>u.MemberId == uid) ));
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: api/FileCircleApi/5
|
|
||||||
[HttpGet("{id}", Name = "GetCircleAuthorizationToFile")]
|
|
||||||
public async Task<IActionResult> GetCircleAuthorizationToFile([FromRoute] long id)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
|
|
||||||
CircleAuthorizationToFile circleAuthorizationToFile = await _context.CircleAuthorizationToFile
|
|
||||||
.Include(m => m.Circle)
|
|
||||||
.Include( m => m.Circle.Members)
|
|
||||||
.SingleOrDefaultAsync(m => m.Circle.OwnerId == uid && m.CircleId == id);
|
|
||||||
|
|
||||||
if (circleAuthorizationToFile == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUT: api/FileCircleApi/5
|
|
||||||
[HttpPut("{id}")]
|
|
||||||
public async Task<IActionResult> PutCircleAuthorizationToFile([FromRoute] long id, [FromBody] CircleAuthorizationToFile circleAuthorizationToFile)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id != circleAuthorizationToFile.CircleId)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
var circle = await _context.Circle.FirstOrDefaultAsync(c=>c.Id == id);
|
|
||||||
if (circle == null)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uid != circle.OwnerId)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
_context.Entry(circleAuthorizationToFile).State = EntityState.Modified;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _context.SaveChangesAsync(uid);
|
|
||||||
}
|
|
||||||
catch (DbUpdateConcurrencyException)
|
|
||||||
{
|
|
||||||
if (!CircleAuthorizationToFileExists(id))
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: api/FileCircleApi
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<IActionResult> PostCircleAuthorizationToFile([FromBody] CircleAuthorizationToFile circleAuthorizationToFile)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
var circle = await _context.Circle.FirstOrDefaultAsync(c=>c.Id == circleAuthorizationToFile.CircleId);
|
|
||||||
if (circle == null || circle.OwnerId != uid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_context.CircleAuthorizationToFile.Add(circleAuthorizationToFile);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _context.SaveChangesAsync(uid);
|
|
||||||
}
|
|
||||||
catch (DbUpdateException)
|
|
||||||
{
|
|
||||||
if (CircleAuthorizationToFileExists(circleAuthorizationToFile.CircleId))
|
|
||||||
{
|
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreatedAtRoute("GetCircleAuthorizationToFile", new { id = circleAuthorizationToFile.CircleId }, circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELETE: api/FileCircleApi/5
|
|
||||||
[HttpDelete("{id}")]
|
|
||||||
public async Task<IActionResult> DeleteCircleAuthorizationToFile([FromRoute] long id)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
CircleAuthorizationToFile circleAuthorizationToFile = await _context.CircleAuthorizationToFile
|
|
||||||
.Include(c=>c.Circle).SingleAsync(m => m.CircleId == id);
|
|
||||||
if (circleAuthorizationToFile == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
if (circleAuthorizationToFile == null || circleAuthorizationToFile.Circle.OwnerId != uid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
_context.CircleAuthorizationToFile.Remove(circleAuthorizationToFile);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
|
|
||||||
return Ok(circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
_context.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CircleAuthorizationToFileExists(long id)
|
|
||||||
{
|
|
||||||
return _context.CircleAuthorizationToFile.Count(e => e.CircleId == id) > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,209 +0,0 @@
|
|||||||
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.WebSockets;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Http;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.Data.Entity;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Streaming;
|
|
||||||
using Yavsc.Services;
|
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
|
||||||
{
|
|
||||||
[Route("api/live")]
|
|
||||||
public class LiveApiController : Controller
|
|
||||||
{
|
|
||||||
readonly ILiveProcessor _liveProcessor;
|
|
||||||
private readonly ApplicationDbContext _dbContext;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Live Api Controller
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="loggerFactory"></param>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
|
|
||||||
public LiveApiController(
|
|
||||||
ApplicationDbContext context,
|
|
||||||
ILiveProcessor liveProcessor)
|
|
||||||
{
|
|
||||||
_liveProcessor = liveProcessor;
|
|
||||||
_dbContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("filenamehint/{id}")]
|
|
||||||
public async Task<string[]> GetFileNameHint(string id)
|
|
||||||
{
|
|
||||||
return await _dbContext.Tags.Where( t=> t.Name.StartsWith(id)).Select(t=>t.Name).Take(25).ToArrayAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("live/uid-{id}")]
|
|
||||||
public async Task<IActionResult> ByUserId(string id)
|
|
||||||
{
|
|
||||||
// TODO read access rights
|
|
||||||
// TODO multiple channel
|
|
||||||
if (!HttpContext.WebSockets.IsWebSocketRequest) return new BadRequestResult();
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
var existent = _liveProcessor.Casters[id];
|
|
||||||
var socket = await HttpContext.WebSockets.AcceptWebSocketAsync();
|
|
||||||
if (existent.Listeners.TryAdd(uid,socket)) {
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await socket.CloseAsync(WebSocketCloseStatus.EndpointUnavailable,"Listeners.TryAdd failed",CancellationToken.None);
|
|
||||||
}
|
|
||||||
return HttpBadRequest("Listeners.TryAdd returned false");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Lists user's live castings
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="meta/id">user id</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IActionResult Index(long? id)
|
|
||||||
{
|
|
||||||
if (id==0)
|
|
||||||
return View("Index", _liveProcessor.Casters.Select(c=> new { UserName = c.Key, Listenning = c.Value.Listeners.Count }));
|
|
||||||
|
|
||||||
var flow = _dbContext.LiveFlow.SingleOrDefault(f=>f.Id == id);
|
|
||||||
if (flow == null) return HttpNotFound();
|
|
||||||
|
|
||||||
return View("Flow", flow);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("meta/uid-{id}")]
|
|
||||||
public async Task<IActionResult> GetLiveFlow([FromRoute] long id)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveFlow liveFlow = await _dbContext.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("meta/{id}")]
|
|
||||||
public async Task<IActionResult> PutLiveFlow([FromRoute] long id, [FromBody] LiveFlow liveFlow)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id != liveFlow.Id)
|
|
||||||
{
|
|
||||||
return HttpBadRequest();
|
|
||||||
}
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
if (liveFlow.OwnerId!=uid)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError("id","This flow isn't yours.");
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
_dbContext.Entry(liveFlow).State = EntityState.Modified;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _dbContext.SaveChangesAsync(uid);
|
|
||||||
}
|
|
||||||
catch (DbUpdateConcurrencyException)
|
|
||||||
{
|
|
||||||
if (!LiveFlowExists(id))
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("meta")]
|
|
||||||
public async Task<IActionResult> PostLiveFlow([FromBody] LiveFlow liveFlow)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
liveFlow.OwnerId=uid;
|
|
||||||
|
|
||||||
_dbContext.LiveFlow.Add(liveFlow);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _dbContext.SaveChangesAsync(uid);
|
|
||||||
}
|
|
||||||
catch (DbUpdateException)
|
|
||||||
{
|
|
||||||
if (LiveFlowExists(liveFlow.Id))
|
|
||||||
{
|
|
||||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreatedAtRoute("GetLiveFlow", new { id = liveFlow.Id }, liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELETE: api/LiveApi/5
|
|
||||||
[HttpDelete("meta/uid-{uid}")]
|
|
||||||
public async Task<IActionResult> DeleteLiveFlow([FromRoute] long uid)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveFlow liveFlow = await _dbContext.LiveFlow.SingleAsync(m => m.Id == uid);
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var cuid = User.GetUserId();
|
|
||||||
if (liveFlow.OwnerId!=cuid)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError("id","This flow isn't yours.");
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
_dbContext.LiveFlow.Remove(liveFlow);
|
|
||||||
await _dbContext.SaveChangesAsync(cuid);
|
|
||||||
|
|
||||||
return Ok(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
_dbContext.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool LiveFlowExists(long id)
|
|
||||||
{
|
|
||||||
return _dbContext.LiveFlow.Count(e => e.Id == id) > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,183 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Authorization;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
|
||||||
using Microsoft.Data.Entity;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Streaming;
|
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
|
||||||
{
|
|
||||||
public class LiveFlowController : Controller
|
|
||||||
{
|
|
||||||
private readonly ApplicationDbContext _context;
|
|
||||||
|
|
||||||
public LiveFlowController(ApplicationDbContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: LiveFlow
|
|
||||||
public async Task<IActionResult> Index()
|
|
||||||
{
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
var applicationDbContext = _context.LiveFlow.Where(f=>f.OwnerId == uid);
|
|
||||||
return View(await applicationDbContext.ToListAsync());
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IActionResult> AdminIndex()
|
|
||||||
{
|
|
||||||
var applicationDbContext = _context.LiveFlow.Include(l => l.Owner);
|
|
||||||
return View(await applicationDbContext.ToListAsync());
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: LiveFlow/Details/5
|
|
||||||
public async Task<IActionResult> Details(long? id)
|
|
||||||
{
|
|
||||||
if (id == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: LiveFlow/Create
|
|
||||||
public IActionResult Create()
|
|
||||||
{
|
|
||||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner");
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: LiveFlow/Create
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> Create(LiveFlow liveFlow)
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
_context.LiveFlow.Add(liveFlow);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", liveFlow.OwnerId);
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: LiveFlow/Edit/5
|
|
||||||
public async Task<IActionResult> Edit(long? id)
|
|
||||||
{
|
|
||||||
if (id == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IActionResult> AdminEdit(long? id)
|
|
||||||
{
|
|
||||||
if (id == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewBag.OwnerId = _context.ApplicationUser.Select
|
|
||||||
(u=> new SelectListItem(){Text=u.UserName,Value=u.Id,Selected=liveFlow.OwnerId==u.Id});
|
|
||||||
return View("AdminEdit", liveFlow);
|
|
||||||
}
|
|
||||||
// POST: LiveFlow/Edit/5
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> Edit(LiveFlow liveFlow)
|
|
||||||
{
|
|
||||||
if (User.GetUserId()!=liveFlow.OwnerId)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError("OwnerId","denied");
|
|
||||||
}
|
|
||||||
else if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
_context.Update(liveFlow);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// POST: LiveFlow/Edit/5
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
[Authorize("AdministratorOnly")]
|
|
||||||
public async Task<IActionResult> AdminEdit(LiveFlow liveFlow)
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
_context.Update(liveFlow);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", liveFlow.OwnerId);
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: LiveFlow/Delete/5
|
|
||||||
[ActionName("Delete")]
|
|
||||||
public async Task<IActionResult> Delete(long? id)
|
|
||||||
{
|
|
||||||
if (id == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
|
|
||||||
if (liveFlow == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
else if (User.GetUserId()!=liveFlow.OwnerId)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError("OwnerId","denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(liveFlow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: LiveFlow/Delete/5
|
|
||||||
[HttpPost, ActionName("Delete")]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
|
||||||
{
|
|
||||||
LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id);
|
|
||||||
if (User.GetUserId()!=liveFlow.OwnerId)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError("OwnerId","denied");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
_context.LiveFlow.Remove(liveFlow);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Authorization;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
|
||||||
using Microsoft.Data.Entity;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Server.Models.Access;
|
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
|
||||||
{
|
|
||||||
[Authorize()]
|
|
||||||
public class MyFSRulesController : Controller
|
|
||||||
{
|
|
||||||
private readonly ApplicationDbContext _context;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public MyFSRulesController(ApplicationDbContext context,
|
|
||||||
ILoggerFactory loggerFactory)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
_logger = loggerFactory.CreateLogger<MyFSRulesController>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: MyFSRules
|
|
||||||
public async Task<IActionResult> Index()
|
|
||||||
{
|
|
||||||
var applicationDbContext = _context.CircleAuthorizationToFile.Include(c => c.Circle)
|
|
||||||
.Where (m=>m.Circle.OwnerId == User.GetUserId());
|
|
||||||
return View(await applicationDbContext.ToListAsync());
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: MyFSRules/Details/5
|
|
||||||
public async Task<IActionResult> Details(long circleId, string fullPath)
|
|
||||||
{
|
|
||||||
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
_logger.LogInformation($"Searching fsa for {uid} :\n {circleId}/{fullPath}");
|
|
||||||
CircleAuthorizationToFile circleAuthorizationToFile =
|
|
||||||
await _context.CircleAuthorizationToFile
|
|
||||||
.Include(m=>m.Circle)
|
|
||||||
.SingleOrDefaultAsync(m => ((m.CircleId == circleId) && (m.FullPath == fullPath) &&
|
|
||||||
(m.Circle.OwnerId == uid)));
|
|
||||||
if (circleAuthorizationToFile == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: MyFSRules/Create
|
|
||||||
public IActionResult Create()
|
|
||||||
{
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
var userCircles = _context.Circle.Where(c=>c.OwnerId == uid);
|
|
||||||
ViewBag.CircleId = new SelectList(userCircles, "Id", "Name");
|
|
||||||
var uccount = userCircles.Count();
|
|
||||||
_logger.LogInformation($"User circle count : {uccount}");
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: MyFSRules/Create
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> Create(CircleAuthorizationToFile circleAuthorizationToFile)
|
|
||||||
{
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
// refuse to allow files to other circle than user's ones.
|
|
||||||
var circle = await _context.Circle.SingleOrDefaultAsync(c=>c.Id==circleAuthorizationToFile.CircleId);
|
|
||||||
if (circle.OwnerId != uid) return this.HttpUnauthorized();
|
|
||||||
_context.CircleAuthorizationToFile.Add(circleAuthorizationToFile);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
var userCircles = _context.Circle.Where(c=>c.OwnerId == uid);
|
|
||||||
ViewBag.CircleId = new SelectList(userCircles, "Id", "Name");
|
|
||||||
return View(circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: MyFSRules/Delete/5
|
|
||||||
[ActionName("Delete")]
|
|
||||||
public async Task<IActionResult> Delete(long circleId, string fullPath)
|
|
||||||
{
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
CircleAuthorizationToFile circleAuthorizationToFile =
|
|
||||||
await _context.CircleAuthorizationToFile
|
|
||||||
.Include(a=>a.Circle).SingleOrDefaultAsync(m => m.CircleId == circleId && m.FullPath == fullPath);
|
|
||||||
if (circleAuthorizationToFile == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
if (circleAuthorizationToFile.Circle.OwnerId != uid) return HttpUnauthorized();
|
|
||||||
return View(circleAuthorizationToFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: MyFSRules/Delete/5
|
|
||||||
[HttpPost, ActionName("Delete")]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> DeleteConfirmed(long circleId, string fullPath)
|
|
||||||
{
|
|
||||||
var uid = User.GetUserId();
|
|
||||||
CircleAuthorizationToFile circleAuthorizationToFile =
|
|
||||||
await _context.CircleAuthorizationToFile
|
|
||||||
.Include(a=> a.Circle)
|
|
||||||
.SingleOrDefaultAsync(m => m.CircleId == circleId && m.FullPath == fullPath);
|
|
||||||
if (circleAuthorizationToFile == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
if (circleAuthorizationToFile.Circle.OwnerId != uid) return HttpUnauthorized();
|
|
||||||
_context.CircleAuthorizationToFile.Remove(circleAuthorizationToFile);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,819 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
namespace Yavsc.Migrations
|
||||||
|
{
|
||||||
|
public partial class nomorecircleautorisationtofile : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Ban_ApplicationUser_TargetId", table: "Ban");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_UserId", table: "BlackListed");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", table: "CircleAuthorizationToBlogPost");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlogTag_BlogPost_PostId", table: "BlogTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlogTag_Tag_TagId", table: "BlogTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Comment_ApplicationUser_AuthorId", table: "Comment");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Comment_BlogPost_PostId", table: "Comment");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Schedule_ApplicationUser_OwnerId", table: "Schedule");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", table: "ChatConnection");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ChatRoomAccess_ApplicationUser_UserId", table: "ChatRoomAccess");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_InstrumentRating_Instrument_InstrumentId", table: "InstrumentRating");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_GitId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
|
||||||
|
migrationBuilder.DropTable("CircleAuthorizationToFile");
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
|
||||||
|
table: "AspNetRoleClaims",
|
||||||
|
column: "RoleId",
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserClaims",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserLogins",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "RoleId",
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Ban_ApplicationUser_TargetId",
|
||||||
|
table: "Ban",
|
||||||
|
column: "TargetId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlackListed_ApplicationUser_OwnerId",
|
||||||
|
table: "BlackListed",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlackListed_ApplicationUser_UserId",
|
||||||
|
table: "BlackListed",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId",
|
||||||
|
table: "CircleAuthorizationToBlogPost",
|
||||||
|
column: "BlogPostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
|
||||||
|
table: "CircleAuthorizationToBlogPost",
|
||||||
|
column: "CircleId",
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AccountBalance_ApplicationUser_UserId",
|
||||||
|
table: "AccountBalance",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BalanceImpact_AccountBalance_BalanceId",
|
||||||
|
table: "BalanceImpact",
|
||||||
|
column: "BalanceId",
|
||||||
|
principalTable: "AccountBalance",
|
||||||
|
principalColumn: "UserId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CommandLine_Estimate_EstimateId",
|
||||||
|
table: "CommandLine",
|
||||||
|
column: "EstimateId",
|
||||||
|
principalTable: "Estimate",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Estimate_ApplicationUser_ClientId",
|
||||||
|
table: "Estimate",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlogTag_BlogPost_PostId",
|
||||||
|
table: "BlogTag",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlogTag_Tag_TagId",
|
||||||
|
table: "BlogTag",
|
||||||
|
column: "TagId",
|
||||||
|
principalTable: "Tag",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Comment_ApplicationUser_AuthorId",
|
||||||
|
table: "Comment",
|
||||||
|
column: "AuthorId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Comment_BlogPost_PostId",
|
||||||
|
table: "Comment",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Schedule_ApplicationUser_OwnerId",
|
||||||
|
table: "Schedule",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ChatConnection_ApplicationUser_ApplicationUserId",
|
||||||
|
table: "ChatConnection",
|
||||||
|
column: "ApplicationUserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ChatRoomAccess_ApplicationUser_UserId",
|
||||||
|
table: "ChatRoomAccess",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BrusherProfile_PerformerProfile_UserId",
|
||||||
|
table: "BrusherProfile",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_Activity_ActivityCode",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_ApplicationUser_ClientId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_HairPrestation_PrestationId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId",
|
||||||
|
table: "HairPrestationCollectionItem",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId",
|
||||||
|
table: "HairPrestationCollectionItem",
|
||||||
|
column: "QueryId",
|
||||||
|
principalTable: "HairMultiCutQuery",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaint_Color_ColorId",
|
||||||
|
table: "HairTaint",
|
||||||
|
column: "ColorId",
|
||||||
|
principalTable: "Color",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaintInstance_HairPrestation_PrestationId",
|
||||||
|
table: "HairTaintInstance",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaintInstance_HairTaint_TaintId",
|
||||||
|
table: "HairTaintInstance",
|
||||||
|
column: "TaintId",
|
||||||
|
principalTable: "HairTaint",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_DimissClicked_Notification_NotificationId",
|
||||||
|
table: "DimissClicked",
|
||||||
|
column: "NotificationId",
|
||||||
|
principalTable: "Notification",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_InstrumentRating_Instrument_InstrumentId",
|
||||||
|
table: "InstrumentRating",
|
||||||
|
column: "InstrumentId",
|
||||||
|
principalTable: "Instrument",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Instrumentation_Instrument_InstrumentId",
|
||||||
|
table: "Instrumentation",
|
||||||
|
column: "InstrumentId",
|
||||||
|
principalTable: "Instrument",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleMember_Circle_CircleId",
|
||||||
|
table: "CircleMember",
|
||||||
|
column: "CircleId",
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contact_PostalAddress_AddressId",
|
||||||
|
table: "Contact",
|
||||||
|
column: "AddressId",
|
||||||
|
principalTable: "PostalAddress",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PerformerProfile_Location_OrganizationAddressId",
|
||||||
|
table: "PerformerProfile",
|
||||||
|
column: "OrganizationAddressId",
|
||||||
|
principalTable: "Location",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
|
||||||
|
table: "PerformerProfile",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_Activity_ActivityCode",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_ApplicationUser_ClientId",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_Activity_ActivityCode",
|
||||||
|
table: "Project",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_ApplicationUser_ClientId",
|
||||||
|
table: "Project",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_GitRepositoryReference_GitId",
|
||||||
|
table: "Project",
|
||||||
|
column: "GitId",
|
||||||
|
principalTable: "GitRepositoryReference",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_PerformerProfile_PerformerId",
|
||||||
|
table: "Project",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProjectBuildConfiguration_Project_ProjectId",
|
||||||
|
table: "ProjectBuildConfiguration",
|
||||||
|
column: "ProjectId",
|
||||||
|
principalTable: "Project",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Ban_ApplicationUser_TargetId", table: "Ban");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_UserId", table: "BlackListed");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", table: "CircleAuthorizationToBlogPost");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlogTag_BlogPost_PostId", table: "BlogTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BlogTag_Tag_TagId", table: "BlogTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Comment_ApplicationUser_AuthorId", table: "Comment");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Comment_BlogPost_PostId", table: "Comment");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Schedule_ApplicationUser_OwnerId", table: "Schedule");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", table: "ChatConnection");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ChatRoomAccess_ApplicationUser_UserId", table: "ChatRoomAccess");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_InstrumentRating_Instrument_InstrumentId", table: "InstrumentRating");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_GitId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CircleAuthorizationToFile",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
CircleId = table.Column<long>(nullable: false),
|
||||||
|
FullPath = table.Column<string>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CircleAuthorizationToFile", x => new { x.CircleId, x.FullPath });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToFile_Circle_CircleId",
|
||||||
|
column: x => x.CircleId,
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
|
||||||
|
table: "AspNetRoleClaims",
|
||||||
|
column: "RoleId",
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserClaims",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserLogins",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "RoleId",
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Ban_ApplicationUser_TargetId",
|
||||||
|
table: "Ban",
|
||||||
|
column: "TargetId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlackListed_ApplicationUser_OwnerId",
|
||||||
|
table: "BlackListed",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlackListed_ApplicationUser_UserId",
|
||||||
|
table: "BlackListed",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId",
|
||||||
|
table: "CircleAuthorizationToBlogPost",
|
||||||
|
column: "BlogPostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
|
||||||
|
table: "CircleAuthorizationToBlogPost",
|
||||||
|
column: "CircleId",
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AccountBalance_ApplicationUser_UserId",
|
||||||
|
table: "AccountBalance",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BalanceImpact_AccountBalance_BalanceId",
|
||||||
|
table: "BalanceImpact",
|
||||||
|
column: "BalanceId",
|
||||||
|
principalTable: "AccountBalance",
|
||||||
|
principalColumn: "UserId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CommandLine_Estimate_EstimateId",
|
||||||
|
table: "CommandLine",
|
||||||
|
column: "EstimateId",
|
||||||
|
principalTable: "Estimate",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Estimate_ApplicationUser_ClientId",
|
||||||
|
table: "Estimate",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlogTag_BlogPost_PostId",
|
||||||
|
table: "BlogTag",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlogTag_Tag_TagId",
|
||||||
|
table: "BlogTag",
|
||||||
|
column: "TagId",
|
||||||
|
principalTable: "Tag",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Comment_ApplicationUser_AuthorId",
|
||||||
|
table: "Comment",
|
||||||
|
column: "AuthorId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Comment_BlogPost_PostId",
|
||||||
|
table: "Comment",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "BlogPost",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Schedule_ApplicationUser_OwnerId",
|
||||||
|
table: "Schedule",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ChatConnection_ApplicationUser_ApplicationUserId",
|
||||||
|
table: "ChatConnection",
|
||||||
|
column: "ApplicationUserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ChatRoomAccess_ApplicationUser_UserId",
|
||||||
|
table: "ChatRoomAccess",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BrusherProfile_PerformerProfile_UserId",
|
||||||
|
table: "BrusherProfile",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_Activity_ActivityCode",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_ApplicationUser_ClientId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairCutQuery_HairPrestation_PrestationId",
|
||||||
|
table: "HairCutQuery",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "HairMultiCutQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId",
|
||||||
|
table: "HairPrestationCollectionItem",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId",
|
||||||
|
table: "HairPrestationCollectionItem",
|
||||||
|
column: "QueryId",
|
||||||
|
principalTable: "HairMultiCutQuery",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaint_Color_ColorId",
|
||||||
|
table: "HairTaint",
|
||||||
|
column: "ColorId",
|
||||||
|
principalTable: "Color",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaintInstance_HairPrestation_PrestationId",
|
||||||
|
table: "HairTaintInstance",
|
||||||
|
column: "PrestationId",
|
||||||
|
principalTable: "HairPrestation",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_HairTaintInstance_HairTaint_TaintId",
|
||||||
|
table: "HairTaintInstance",
|
||||||
|
column: "TaintId",
|
||||||
|
principalTable: "HairTaint",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_DimissClicked_Notification_NotificationId",
|
||||||
|
table: "DimissClicked",
|
||||||
|
column: "NotificationId",
|
||||||
|
principalTable: "Notification",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_InstrumentRating_Instrument_InstrumentId",
|
||||||
|
table: "InstrumentRating",
|
||||||
|
column: "InstrumentId",
|
||||||
|
principalTable: "Instrument",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Instrumentation_Instrument_InstrumentId",
|
||||||
|
table: "Instrumentation",
|
||||||
|
column: "InstrumentId",
|
||||||
|
principalTable: "Instrument",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CircleMember_Circle_CircleId",
|
||||||
|
table: "CircleMember",
|
||||||
|
column: "CircleId",
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Contact_PostalAddress_AddressId",
|
||||||
|
table: "Contact",
|
||||||
|
column: "AddressId",
|
||||||
|
principalTable: "PostalAddress",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PerformerProfile_Location_OrganizationAddressId",
|
||||||
|
table: "PerformerProfile",
|
||||||
|
column: "OrganizationAddressId",
|
||||||
|
principalTable: "Location",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
|
||||||
|
table: "PerformerProfile",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_Activity_ActivityCode",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_ApplicationUser_ClientId",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_RdvQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "RdvQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_Activity_ActivityCode",
|
||||||
|
table: "Project",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_ApplicationUser_ClientId",
|
||||||
|
table: "Project",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_GitRepositoryReference_GitId",
|
||||||
|
table: "Project",
|
||||||
|
column: "GitId",
|
||||||
|
principalTable: "GitRepositoryReference",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Project_PerformerProfile_PerformerId",
|
||||||
|
table: "Project",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ProjectBuildConfiguration_Project_ProjectId",
|
||||||
|
table: "ProjectBuildConfiguration",
|
||||||
|
column: "ProjectId",
|
||||||
|
principalTable: "Project",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue