blog acl
This commit is contained in:
148
Yavsc/ApiControllers/BlogAclApiController.cs
Normal file
148
Yavsc/ApiControllers/BlogAclApiController.cs
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Http;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
|
namespace Yavsc.Controllers
|
||||||
|
{
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Route("api/blogacl")]
|
||||||
|
public class BlogAclApiController : Controller
|
||||||
|
{
|
||||||
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
|
public BlogAclApiController(ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: api/BlogAclApi
|
||||||
|
[HttpGet]
|
||||||
|
public IEnumerable<CircleAuthorizationToBlogPost> GetBlogACL()
|
||||||
|
{
|
||||||
|
return _context.BlogACL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: api/BlogAclApi/5
|
||||||
|
[HttpGet("{id}", Name = "GetCircleAuthorizationToBlogPost")]
|
||||||
|
public async Task<IActionResult> GetCircleAuthorizationToBlogPost([FromRoute] long id)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.BlogACL.SingleAsync(m => m.CircleId == id);
|
||||||
|
|
||||||
|
if (circleAuthorizationToBlogPost == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(circleAuthorizationToBlogPost);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PUT: api/BlogAclApi/5
|
||||||
|
[HttpPut("{id}")]
|
||||||
|
public async Task<IActionResult> PutCircleAuthorizationToBlogPost([FromRoute] long id, [FromBody] CircleAuthorizationToBlogPost circleAuthorizationToBlogPost)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id != circleAuthorizationToBlogPost.CircleId)
|
||||||
|
{
|
||||||
|
return HttpBadRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
_context.Entry(circleAuthorizationToBlogPost).State = EntityState.Modified;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch (DbUpdateConcurrencyException)
|
||||||
|
{
|
||||||
|
if (!CircleAuthorizationToBlogPostExists(id))
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: api/BlogAclApi
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> PostCircleAuthorizationToBlogPost([FromBody] CircleAuthorizationToBlogPost circleAuthorizationToBlogPost)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
_context.BlogACL.Add(circleAuthorizationToBlogPost);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch (DbUpdateException)
|
||||||
|
{
|
||||||
|
if (CircleAuthorizationToBlogPostExists(circleAuthorizationToBlogPost.CircleId))
|
||||||
|
{
|
||||||
|
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreatedAtRoute("GetCircleAuthorizationToBlogPost", new { id = circleAuthorizationToBlogPost.CircleId }, circleAuthorizationToBlogPost);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE: api/BlogAclApi/5
|
||||||
|
[HttpDelete("{id}")]
|
||||||
|
public async Task<IActionResult> DeleteCircleAuthorizationToBlogPost([FromRoute] long id)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.BlogACL.SingleAsync(m => m.CircleId == id);
|
||||||
|
if (circleAuthorizationToBlogPost == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
_context.BlogACL.Remove(circleAuthorizationToBlogPost);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return Ok(circleAuthorizationToBlogPost);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
_context.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CircleAuthorizationToBlogPostExists(long id)
|
||||||
|
{
|
||||||
|
return _context.BlogACL.Count(e => e.CircleId == id) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ using Microsoft.Data.Entity;
|
|||||||
using Microsoft.Extensions.OptionsModel;
|
using Microsoft.Extensions.OptionsModel;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.ViewModels.Auth;
|
using Yavsc.ViewModels.Auth;
|
||||||
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
|
|
||||||
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Blog blog = _context.Blogspot.Include(x => x.Author).Single(m => m.Id == id);
|
Blog blog = _context.Blogspot.Include(x => x.Author).Include(x => x.ACL).Single(m => m.Id == id);
|
||||||
|
|
||||||
|
|
||||||
if (blog == null)
|
if (blog == null)
|
||||||
@ -138,6 +139,16 @@ namespace Yavsc.Controllers
|
|||||||
}
|
}
|
||||||
if (await _authorizationService.AuthorizeAsync(User, blog, new EditRequirement()))
|
if (await _authorizationService.AuthorizeAsync(User, blog, new EditRequirement()))
|
||||||
{
|
{
|
||||||
|
ViewBag.ACL = _context.Circle.Where(
|
||||||
|
c=>c.OwnerId == blog.AuthorId)
|
||||||
|
.Select(
|
||||||
|
c => new SelectListItem
|
||||||
|
{
|
||||||
|
Text = c.Name,
|
||||||
|
Value = c.Id.ToString(),
|
||||||
|
Selected = blog.ACL.Any(a=>a.CircleId==c.Id)
|
||||||
|
}
|
||||||
|
);
|
||||||
return View(blog);
|
return View(blog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -156,6 +167,7 @@ namespace Yavsc.Controllers
|
|||||||
var auth = _authorizationService.AuthorizeAsync(User, blog, new EditRequirement());
|
var auth = _authorizationService.AuthorizeAsync(User, blog, new EditRequirement());
|
||||||
if (auth.Result)
|
if (auth.Result)
|
||||||
{
|
{
|
||||||
|
// saves the change
|
||||||
_context.Update(blog);
|
_context.Update(blog);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
ViewData["StatusMessage"] = "Post modified";
|
ViewData["StatusMessage"] = "Post modified";
|
||||||
|
1052
Yavsc/Migrations/20170120095258_blogAcl.Designer.cs
generated
Normal file
1052
Yavsc/Migrations/20170120095258_blogAcl.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
377
Yavsc/Migrations/20170120095258_blogAcl.cs
Normal file
377
Yavsc/Migrations/20170120095258_blogAcl.cs
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
namespace Yavsc.Migrations
|
||||||
|
{
|
||||||
|
public partial class blogAcl : 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_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_Estimate_PerformerProfile_OwnerId", table: "Estimate");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Activity_ActivityCode", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CircleAuthorizationToBlogPost",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
CircleId = table.Column<long>(nullable: false),
|
||||||
|
BlogPostId = table.Column<long>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CircleAuthorizationToBlogPost", x => new { x.CircleId, x.BlogPostId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
|
||||||
|
column: x => x.BlogPostId,
|
||||||
|
principalTable: "Blog",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
|
||||||
|
column: x => x.CircleId,
|
||||||
|
principalTable: "Circle",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
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_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_Estimate_PerformerProfile_OwnerId",
|
||||||
|
table: "Estimate",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_Activity_ActivityCode",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_ApplicationUser_ClientId",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
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_CircleMember_ApplicationUser_MemberId",
|
||||||
|
table: "CircleMember",
|
||||||
|
column: "MemberId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PostTag_Blog_PostId",
|
||||||
|
table: "PostTag",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "Blog",
|
||||||
|
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_UserActivity_Activity_DoesCode",
|
||||||
|
table: "UserActivity",
|
||||||
|
column: "DoesCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_UserActivity_PerformerProfile_UserId",
|
||||||
|
table: "UserActivity",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
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_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_Estimate_PerformerProfile_OwnerId", table: "Estimate");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Activity_ActivityCode", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
|
||||||
|
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
|
||||||
|
migrationBuilder.DropTable("CircleAuthorizationToBlogPost");
|
||||||
|
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_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_Estimate_PerformerProfile_OwnerId",
|
||||||
|
table: "Estimate",
|
||||||
|
column: "OwnerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_Activity_ActivityCode",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "ActivityCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_ApplicationUser_ClientId",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BookQuery_PerformerProfile_PerformerId",
|
||||||
|
table: "BookQuery",
|
||||||
|
column: "PerformerId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
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_CircleMember_ApplicationUser_MemberId",
|
||||||
|
table: "CircleMember",
|
||||||
|
column: "MemberId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PostTag_Blog_PostId",
|
||||||
|
table: "PostTag",
|
||||||
|
column: "PostId",
|
||||||
|
principalTable: "Blog",
|
||||||
|
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_UserActivity_Activity_DoesCode",
|
||||||
|
table: "UserActivity",
|
||||||
|
column: "DoesCode",
|
||||||
|
principalTable: "Activity",
|
||||||
|
principalColumn: "Code",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_UserActivity_PerformerProfile_UserId",
|
||||||
|
table: "UserActivity",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "PerformerProfile",
|
||||||
|
principalColumn: "PerformerId",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -97,22 +97,6 @@ namespace Yavsc.Migrations
|
|||||||
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
|
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Location", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.IsRequired()
|
|
||||||
.HasAnnotation("MaxLength", 512);
|
|
||||||
|
|
||||||
b.Property<double>("Latitude");
|
|
||||||
|
|
||||||
b.Property<double>("Longitude");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b =>
|
modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -125,6 +109,15 @@ namespace Yavsc.Migrations
|
|||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CircleId");
|
||||||
|
|
||||||
|
b.Property<long>("BlogPostId");
|
||||||
|
|
||||||
|
b.HasKey("CircleId", "BlogPostId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
|
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("UserId");
|
b.Property<string>("UserId");
|
||||||
@ -427,9 +420,9 @@ namespace Yavsc.Migrations
|
|||||||
b.Property<string>("ClientId")
|
b.Property<string>("ClientId")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
b.Property<DateTime>("DateCreated");
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
|
b.Property<DateTime>("DateModified");
|
||||||
|
|
||||||
b.Property<DateTime>("EventDate");
|
b.Property<DateTime>("EventDate");
|
||||||
|
|
||||||
@ -444,6 +437,10 @@ namespace Yavsc.Migrations
|
|||||||
|
|
||||||
b.Property<string>("Reason");
|
b.Property<string>("Reason");
|
||||||
|
|
||||||
|
b.Property<string>("UserCreated");
|
||||||
|
|
||||||
|
b.Property<string>("UserModified");
|
||||||
|
|
||||||
b.Property<DateTime?>("ValidationDate");
|
b.Property<DateTime?>("ValidationDate");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
@ -533,44 +530,6 @@ namespace Yavsc.Migrations
|
|||||||
b.HasKey("ConnectionId");
|
b.HasKey("ConnectionId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Circle", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("ApplicationUserId");
|
|
||||||
|
|
||||||
b.Property<string>("Name");
|
|
||||||
|
|
||||||
b.Property<string>("OwnerId");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<long>("CircleId");
|
|
||||||
|
|
||||||
b.Property<string>("MemberId")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Contact", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("OwnerId");
|
|
||||||
|
|
||||||
b.Property<string>("UserId");
|
|
||||||
|
|
||||||
b.Property<string>("ApplicationUserId");
|
|
||||||
|
|
||||||
b.HasKey("OwnerId", "UserId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
|
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("DeviceId");
|
b.Property<string>("DeviceId");
|
||||||
@ -664,13 +623,58 @@ namespace Yavsc.Migrations
|
|||||||
b.HasKey("UserId");
|
b.HasKey("UserId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
|
modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("PostId");
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
b.Property<long>("TagId");
|
b.Property<string>("ApplicationUserId");
|
||||||
|
|
||||||
b.HasKey("PostId", "TagId");
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<string>("OwnerId");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<long>("CircleId");
|
||||||
|
|
||||||
|
b.Property<string>("MemberId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("OwnerId");
|
||||||
|
|
||||||
|
b.Property<string>("UserId");
|
||||||
|
|
||||||
|
b.Property<string>("ApplicationUserId");
|
||||||
|
|
||||||
|
b.HasKey("OwnerId", "UserId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.Location", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasAnnotation("MaxLength", 512);
|
||||||
|
|
||||||
|
b.Property<double>("Latitude");
|
||||||
|
|
||||||
|
b.Property<double>("Longitude");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Relationship.LocationType", b =>
|
modelBuilder.Entity("Yavsc.Models.Relationship.LocationType", b =>
|
||||||
@ -683,6 +687,26 @@ namespace Yavsc.Migrations
|
|||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.PostTag", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("PostId");
|
||||||
|
|
||||||
|
b.Property<long>("TagId");
|
||||||
|
|
||||||
|
b.HasKey("PostId", "TagId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.Tag", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Skill", b =>
|
modelBuilder.Entity("Yavsc.Models.Skill", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -695,17 +719,6 @@ namespace Yavsc.Migrations
|
|||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Tag", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b =>
|
modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -816,6 +829,17 @@ namespace Yavsc.Migrations
|
|||||||
.HasForeignKey("OwnerId");
|
.HasForeignKey("OwnerId");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yavsc.Models.Blog")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BlogPostId");
|
||||||
|
|
||||||
|
b.HasOne("Yavsc.Models.Relationship.Circle")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CircleId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
|
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Yavsc.Models.ApplicationUser")
|
b.HasOne("Yavsc.Models.ApplicationUser")
|
||||||
@ -836,7 +860,7 @@ namespace Yavsc.Migrations
|
|||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BankInfoId");
|
.HasForeignKey("BankInfoId");
|
||||||
|
|
||||||
b.HasOne("Yavsc.Location")
|
b.HasOne("Yavsc.Models.Relationship.Location")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("PostalAddressId");
|
.HasForeignKey("PostalAddressId");
|
||||||
});
|
});
|
||||||
@ -895,7 +919,7 @@ namespace Yavsc.Migrations
|
|||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ClientId");
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
b.HasOne("Yavsc.Location")
|
b.HasOne("Yavsc.Models.Relationship.Location")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("LocationId");
|
.HasForeignKey("LocationId");
|
||||||
|
|
||||||
@ -937,31 +961,6 @@ namespace Yavsc.Migrations
|
|||||||
.HasForeignKey("ApplicationUserId");
|
.HasForeignKey("ApplicationUserId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Circle", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Yavsc.Models.ApplicationUser")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ApplicationUserId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Yavsc.Models.Circle")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CircleId");
|
|
||||||
|
|
||||||
b.HasOne("Yavsc.Models.ApplicationUser")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("MemberId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Contact", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Yavsc.Models.ApplicationUser")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ApplicationUserId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
|
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Yavsc.Models.ApplicationUser")
|
b.HasOne("Yavsc.Models.ApplicationUser")
|
||||||
@ -978,12 +977,37 @@ namespace Yavsc.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Messaging.ClientProviderInfo", b =>
|
modelBuilder.Entity("Yavsc.Models.Messaging.ClientProviderInfo", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Yavsc.Location")
|
b.HasOne("Yavsc.Models.Relationship.Location")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BillingAddressId");
|
.HasForeignKey("BillingAddressId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
|
modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yavsc.Models.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ApplicationUserId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yavsc.Models.Relationship.Circle")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CircleId");
|
||||||
|
|
||||||
|
b.HasOne("Yavsc.Models.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MemberId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yavsc.Models.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ApplicationUserId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yavsc.Models.Relationship.PostTag", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Yavsc.Models.Blog")
|
b.HasOne("Yavsc.Models.Blog")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
@ -1007,7 +1031,7 @@ namespace Yavsc.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
|
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Yavsc.Location")
|
b.HasOne("Yavsc.Models.Relationship.Location")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("OrganizationAddressId");
|
.HasForeignKey("OrganizationAddressId");
|
||||||
|
|
||||||
|
20
Yavsc/Models/Access/CircleAuthorizationToBlogPost.cs
Normal file
20
Yavsc/Models/Access/CircleAuthorizationToBlogPost.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace Yavsc.Models.Access
|
||||||
|
{
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Models.Relationship;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
public class CircleAuthorizationToBlogPost
|
||||||
|
{
|
||||||
|
public long CircleId { get; set; }
|
||||||
|
public long BlogPostId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[ForeignKey("BlogPostId")]
|
||||||
|
public virtual Blog Post { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[ForeignKey("CircleId")]
|
||||||
|
public virtual Circle Allowed { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
namespace Yavsc.Models
|
namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
@ -39,5 +41,8 @@ namespace Yavsc.Models
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[InverseProperty("Post")]
|
||||||
|
public virtual List<CircleAuthorizationToBlogPost> ACL { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,12 @@ namespace Yavsc.ViewModels.Auth.Handlers
|
|||||||
else if (context.User.Identity.IsAuthenticated)
|
else if (context.User.Identity.IsAuthenticated)
|
||||||
if (resource.AuthorId == context.User.GetUserId())
|
if (resource.AuthorId == context.User.GetUserId())
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
else if (resource.Visible)
|
else if (resource.Visible) {
|
||||||
|
|
||||||
// TODO && ( resource.Circles == null || context.User belongs to resource.Circles )
|
// TODO && ( resource.Circles == null || context.User belongs to resource.Circles )
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -98,6 +98,9 @@ editorcontenu.on('text-change',function(delta,source){
|
|||||||
|
|
||||||
<h2 > @SR["Blog post edition"] </h2>
|
<h2 > @SR["Blog post edition"] </h2>
|
||||||
|
|
||||||
|
@Html.ValidationSummary()
|
||||||
|
|
||||||
|
|
||||||
<div id="Titletoolbar" class="hidden ql-snow ql-toolbar">
|
<div id="Titletoolbar" class="hidden ql-snow ql-toolbar">
|
||||||
<button class="ql-format-button ql-bold"></button>
|
<button class="ql-format-button ql-bold"></button>
|
||||||
<button class="ql-format-button ql-italic"></button>
|
<button class="ql-format-button ql-italic"></button>
|
||||||
@ -171,6 +174,13 @@ editorcontenu.on('text-change',function(delta,source){
|
|||||||
<input asp-for="Visible" class="form-control"/>
|
<input asp-for="Visible" class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="ACL" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<select asp-for="ACL" asp-items=@ViewBag.ACL multiple>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-2 col-md-10">
|
<div class="col-md-offset-2 col-md-10">
|
||||||
@ -178,7 +188,6 @@ editorcontenu.on('text-change',function(delta,source){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@Html.HiddenFor(m=>m.DateCreated)
|
|
||||||
</form>
|
</form>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
17
Yavsc/Views/Shared/DisplayTemplates/Blog.cshtml
Normal file
17
Yavsc/Views/Shared/DisplayTemplates/Blog.cshtml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@model Blog
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="blog dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Title)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Title)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Author)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Author)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,12 @@
|
|||||||
|
@model CircleAuthorizationToBlogPost
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Post)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Allowed)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
Reference in New Issue
Block a user