[reorg]
This commit is contained in:
7
src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs
Normal file
7
src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Yavsc.Abstract.Chat
|
||||||
|
{
|
||||||
|
public enum ChatRoomAccessLevel: int {
|
||||||
|
Op=1,
|
||||||
|
HalfOp=2
|
||||||
|
}
|
||||||
|
}
|
16
src/Yavsc.Abstract/Chat/IChatRoom.cs
Normal file
16
src/Yavsc.Abstract/Chat/IChatRoom.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Yavsc.Abstract.Chat
|
||||||
|
{
|
||||||
|
public interface IChatRoom<TMod> where TMod : IChatRoomAccess
|
||||||
|
{
|
||||||
|
[RegularExpression(@"^#?[a-zA-Z0-9'-']{3,10}$", ErrorMessage = "chan name cannot be validated.")]
|
||||||
|
string Name { get; }
|
||||||
|
|
||||||
|
[RegularExpression(@"^#?[a-zA-Z0-9'-']{3,10}$", ErrorMessage = "topic cannot be validated.")]
|
||||||
|
string Topic { get ; set; }
|
||||||
|
|
||||||
|
List<TMod> Administration { get; }
|
||||||
|
}
|
||||||
|
}
|
12
src/Yavsc.Abstract/Chat/IChatRoomAccess.cs
Normal file
12
src/Yavsc.Abstract/Chat/IChatRoomAccess.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Yavsc.Abstract.Chat
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface IChatRoomAccess
|
||||||
|
{
|
||||||
|
long Id { get; }
|
||||||
|
|
||||||
|
ChatRoomAccessLevel Level { get; set; }
|
||||||
|
|
||||||
|
string UserId { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
namespace Yavsc.Abstract.Streaming
|
namespace Yavsc.Abstract.Chat
|
||||||
{
|
{
|
||||||
public interface IConnection
|
public interface IConnection
|
||||||
{
|
{
|
@ -4,8 +4,9 @@ using System.Reflection;
|
|||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2018")]
|
[assembly: AssemblyCopyright("Copyright © Paul Schneider 2014-2019")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("Yavsc")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("fr")]
|
[assembly: NeutralResourcesLanguage("fr")]
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.6.1")]
|
@ -1,8 +0,0 @@
|
|||||||
namespace Yavsc.Abstract.Streaming
|
|
||||||
{
|
|
||||||
public enum ChatRoomUsageLevel: int {
|
|
||||||
User=0,
|
|
||||||
HalfOp,
|
|
||||||
Op
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Streaming
|
|
||||||
{
|
|
||||||
public interface IChatConnection<T> : IConnection where T: IChatRoomUsage
|
|
||||||
{
|
|
||||||
List<T> Rooms { get; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Streaming
|
|
||||||
{
|
|
||||||
public interface IChatRoom<TUsage> where TUsage : IChatRoomUsage
|
|
||||||
{
|
|
||||||
string Name { get; set; }
|
|
||||||
string Topic { get ; set; }
|
|
||||||
List<TUsage> UserList { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
namespace Yavsc.Abstract.Streaming
|
|
||||||
{
|
|
||||||
|
|
||||||
public interface IChatRoomUsage {
|
|
||||||
|
|
||||||
string ChannelName { get; set; }
|
|
||||||
|
|
||||||
string ChatUserConnectionId { get; set; }
|
|
||||||
|
|
||||||
ChatRoomUsageLevel Level { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,9 +26,9 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace Yavsc.Models.Chat
|
namespace Yavsc.Models.Chat
|
||||||
{
|
{
|
||||||
public class ChatConnection : Abstract.Streaming.IChatConnection<ChatRoomPresence>
|
public class ChatConnection
|
||||||
{
|
{
|
||||||
[JsonIgnore,Required]
|
[Required]
|
||||||
public string ApplicationUserId { get; set; }
|
public string ApplicationUserId { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ApplicationUserId"),JsonIgnore]
|
[ForeignKey("ApplicationUserId"),JsonIgnore]
|
||||||
|
@ -12,6 +12,12 @@ namespace Yavsc.Models.Relationship
|
|||||||
[Required()]
|
[Required()]
|
||||||
public string OwnerId { get; set; }
|
public string OwnerId { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string EMail { get; set; }
|
||||||
|
|
||||||
|
public PostalAddress PostalAddress { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[ForeignKeyAttribute("OwnerId"),NotMapped]
|
[ForeignKeyAttribute("OwnerId"),NotMapped]
|
||||||
public virtual ApplicationUser Owner { get; set; }
|
public virtual ApplicationUser Owner { get; set; }
|
||||||
|
|
||||||
|
@ -2,13 +2,8 @@ using Yavsc.Models.Relationship;
|
|||||||
|
|
||||||
namespace Yavsc
|
namespace Yavsc
|
||||||
{
|
{
|
||||||
public class Contact
|
public class OupsContact
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
|
||||||
public string EMail { get; set; }
|
|
||||||
|
|
||||||
public PostalAddress PostalAddress { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using Yavsc.Models.Relationship;
|
||||||
|
|
||||||
namespace Yavsc
|
namespace Yavsc
|
||||||
{
|
{
|
||||||
public class SiteSettings
|
public class SiteSettings
|
||||||
|
@ -24,7 +24,7 @@ namespace Yavsc.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<HyperLink> GetLinks()
|
public IEnumerable<HyperLink> GetLinks()
|
||||||
{
|
{
|
||||||
return _context.Links;
|
return _context.HyperLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/HyperLinkApi/5
|
// GET: api/HyperLinkApi/5
|
||||||
@ -36,7 +36,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
|
|
||||||
if (hyperLink == null)
|
if (hyperLink == null)
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.Links.Add(hyperLink);
|
_context.HyperLink.Add(hyperLink);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
@ -119,13 +119,13 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
if (hyperLink == null)
|
if (hyperLink == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.Links.Remove(hyperLink);
|
_context.HyperLink.Remove(hyperLink);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(hyperLink);
|
return Ok(hyperLink);
|
||||||
@ -142,7 +142,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
private bool HyperLinkExists(string id)
|
private bool HyperLinkExists(string id)
|
||||||
{
|
{
|
||||||
return _context.Links.Count(e => e.HRef == id) > 0;
|
return _context.HyperLink.Count(e => e.HRef == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace Yavsc.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<MusicalPreference> GetMusicalPreferences()
|
public IEnumerable<MusicalPreference> GetMusicalPreferences()
|
||||||
{
|
{
|
||||||
return _context.MusicalPreferences;
|
return _context.MusicalPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/MusicalPreferencesApi/5
|
// GET: api/MusicalPreferencesApi/5
|
||||||
@ -36,7 +36,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicalPreference musicalPreference = _context.MusicalPreferences.Single(m => m.OwnerProfileId == id);
|
MusicalPreference musicalPreference = _context.MusicalPreference.Single(m => m.OwnerProfileId == id);
|
||||||
|
|
||||||
if (musicalPreference == null)
|
if (musicalPreference == null)
|
||||||
{
|
{
|
||||||
@ -89,7 +89,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.MusicalPreferences.Add(musicalPreference);
|
_context.MusicalPreference.Add(musicalPreference);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
@ -118,13 +118,13 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicalPreference musicalPreference = _context.MusicalPreferences.Single(m => m.OwnerProfileId == id);
|
MusicalPreference musicalPreference = _context.MusicalPreference.Single(m => m.OwnerProfileId == id);
|
||||||
if (musicalPreference == null)
|
if (musicalPreference == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.MusicalPreferences.Remove(musicalPreference);
|
_context.MusicalPreference.Remove(musicalPreference);
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
|
|
||||||
return Ok(musicalPreference);
|
return Ok(musicalPreference);
|
||||||
@ -141,7 +141,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
private bool MusicalPreferenceExists(string id)
|
private bool MusicalPreferenceExists(string id)
|
||||||
{
|
{
|
||||||
return _context.MusicalPreferences.Count(e => e.OwnerProfileId == id) > 0;
|
return _context.MusicalPreference.Count(e => e.OwnerProfileId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace Yavsc.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<CircleAuthorizationToBlogPost> GetBlogACL()
|
public IEnumerable<CircleAuthorizationToBlogPost> GetBlogACL()
|
||||||
{
|
{
|
||||||
return _context.BlogACL;
|
return _context.CircleAuthorizationToBlogPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/BlogAclApi/5
|
// GET: api/BlogAclApi/5
|
||||||
@ -37,7 +37,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.BlogACL.SingleAsync(
|
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.CircleAuthorizationToBlogPost.SingleAsync(
|
||||||
m => m.CircleId == id && m.Allowed.OwnerId == uid );
|
m => m.CircleId == id && m.Allowed.OwnerId == uid );
|
||||||
|
|
||||||
if (circleAuthorizationToBlogPost == null)
|
if (circleAuthorizationToBlogPost == null)
|
||||||
@ -106,7 +106,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
}
|
}
|
||||||
_context.BlogACL.Add(circleAuthorizationToBlogPost);
|
_context.CircleAuthorizationToBlogPost.Add(circleAuthorizationToBlogPost);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
@ -136,7 +136,7 @@ namespace Yavsc.Controllers
|
|||||||
}
|
}
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
|
|
||||||
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.BlogACL.Include(
|
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.CircleAuthorizationToBlogPost.Include(
|
||||||
a=>a.Allowed
|
a=>a.Allowed
|
||||||
).SingleAsync(m => m.CircleId == id
|
).SingleAsync(m => m.CircleId == id
|
||||||
&& m.Allowed.OwnerId == uid);
|
&& m.Allowed.OwnerId == uid);
|
||||||
@ -144,7 +144,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
_context.BlogACL.Remove(circleAuthorizationToBlogPost);
|
_context.CircleAuthorizationToBlogPost.Remove(circleAuthorizationToBlogPost);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
|
|
||||||
return Ok(circleAuthorizationToBlogPost);
|
return Ok(circleAuthorizationToBlogPost);
|
||||||
@ -161,7 +161,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
private bool CircleAuthorizationToBlogPostExists(long id)
|
private bool CircleAuthorizationToBlogPostExists(long id)
|
||||||
{
|
{
|
||||||
return _context.BlogACL.Count(e => e.CircleId == id) > 0;
|
return _context.CircleAuthorizationToBlogPost.Count(e => e.CircleId == id) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ namespace Yavsc.Controllers
|
|||||||
public IEnumerable<ChatUserInfo> GetUserList()
|
public IEnumerable<ChatUserInfo> GetUserList()
|
||||||
{
|
{
|
||||||
List<ChatUserInfo> result = new List<ChatUserInfo>();
|
List<ChatUserInfo> result = new List<ChatUserInfo>();
|
||||||
var cxsQuery = dbContext.Connections?.Include(c=>c.Owner).GroupBy( c => c.ApplicationUserId );
|
var cxsQuery = dbContext.ChatConnection?.Include(c=>c.Owner).GroupBy( c => c.ApplicationUserId );
|
||||||
|
|
||||||
// List<ChatUserInfo> result = new List<ChatUserInfo>();
|
// List<ChatUserInfo> result = new List<ChatUserInfo>();
|
||||||
if (cxsQuery!=null)
|
if (cxsQuery!=null)
|
||||||
|
@ -25,7 +25,7 @@ namespace Yavsc.AuthorizationHandlers
|
|||||||
context.Fail();
|
context.Fail();
|
||||||
else if (destUserId == uid)
|
else if (destUserId == uid)
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
else if (_dbContext.Banlist.Any(b=>b.TargetId == uid)) context.Fail();
|
else if (_dbContext.Ban.Any(b=>b.TargetId == uid)) context.Fail();
|
||||||
else if (_dbContext.BlackListed.Any(b=>b.OwnerId == destUserId && b.UserId == uid)) context.Fail();
|
else if (_dbContext.BlackListed.Any(b=>b.OwnerId == destUserId && b.UserId == uid)) context.Fail();
|
||||||
else context.Succeed(requirement);
|
else context.Succeed(requirement);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace Yavsc.Controllers
|
|||||||
// GET: CoWorking
|
// GET: CoWorking
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var applicationDbContext = _context.WorkflowProviders.Include(c => c.Performer).Include(c => c.WorkingFor);
|
var applicationDbContext = _context.CoWorking.Include(c => c.Performer).Include(c => c.WorkingFor);
|
||||||
return View(await applicationDbContext.ToListAsync());
|
return View(await applicationDbContext.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoWorking coWorking = await _context.WorkflowProviders.SingleAsync(m => m.Id == id);
|
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||||
if (coWorking == null)
|
if (coWorking == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -57,7 +57,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.WorkflowProviders.Add(coWorking);
|
_context.CoWorking.Add(coWorking);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoWorking coWorking = await _context.WorkflowProviders.SingleAsync(m => m.Id == id);
|
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||||
if (coWorking == null)
|
if (coWorking == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -109,7 +109,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoWorking coWorking = await _context.WorkflowProviders.SingleAsync(m => m.Id == id);
|
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||||
if (coWorking == null)
|
if (coWorking == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -123,8 +123,8 @@ namespace Yavsc.Controllers
|
|||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
CoWorking coWorking = await _context.WorkflowProviders.SingleAsync(m => m.Id == id);
|
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
|
||||||
_context.WorkflowProviders.Remove(coWorking);
|
_context.CoWorking.Remove(coWorking);
|
||||||
await _context.SaveChangesAsync(User.GetUserId());
|
await _context.SaveChangesAsync(User.GetUserId());
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace Yavsc.Controllers
|
|||||||
// GET: HyperLink
|
// GET: HyperLink
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Links.ToListAsync());
|
return View(await _context.HyperLink.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HyperLink/Details/5
|
// GET: HyperLink/Details/5
|
||||||
@ -29,7 +29,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
if (hyperLink == null)
|
if (hyperLink == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -51,7 +51,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Links.Add(hyperLink);
|
_context.HyperLink.Add(hyperLink);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
if (hyperLink == null)
|
if (hyperLink == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -97,7 +97,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
if (hyperLink == null)
|
if (hyperLink == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -111,8 +111,8 @@ namespace Yavsc.Controllers
|
|||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
{
|
{
|
||||||
HyperLink hyperLink = await _context.Links.SingleAsync(m => m.HRef == id);
|
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||||
_context.Links.Remove(hyperLink);
|
_context.HyperLink.Remove(hyperLink);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace Yavsc.Controllers
|
|||||||
// GET: Project
|
// GET: Project
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var applicationDbContext = _context.Projects.Include(p => p.Client).Include(p => p.Context).Include(p => p.PerformerProfile).Include(p => p.Regularisation).Include(p => p.Repository);
|
var applicationDbContext = _context.Project.Include(p => p.Client).Include(p => p.Context).Include(p => p.PerformerProfile).Include(p => p.Regularisation).Include(p => p.Repository);
|
||||||
return View(await applicationDbContext.ToListAsync());
|
return View(await applicationDbContext.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Project project = await _context.Projects.SingleAsync(m => m.Id == id);
|
Project project = await _context.Project.SingleAsync(m => m.Id == id);
|
||||||
if (project == null)
|
if (project == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -66,7 +66,7 @@ namespace Yavsc.Controllers
|
|||||||
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
||||||
a => a.Code, a => a.Name);
|
a => a.Code, a => a.Name);
|
||||||
ViewBag.PerformerIdItems = _context.Performers.Include(p=>p.Performer).CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
|
ViewBag.PerformerIdItems = _context.Performers.Include(p=>p.Performer).CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
|
||||||
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
|
ViewBag.PaymentIdItems = _context.PayPalPayment.CreateSelectListItems<PayPalPayment>
|
||||||
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
|
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
|
||||||
|
|
||||||
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
|
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
|
||||||
@ -83,7 +83,7 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
_context.Projects.Add(project);
|
_context.Project.Add(project);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ namespace Yavsc.Controllers
|
|||||||
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
|
||||||
a => a.Code, a => a.Name, project.ActivityCode);
|
a => a.Code, a => a.Name, project.ActivityCode);
|
||||||
ViewBag.PerformerIdItems = _context.Performers.Include(p=>p.Performer).CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName, project.PerformerId);
|
ViewBag.PerformerIdItems = _context.Performers.Include(p=>p.Performer).CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName, project.PerformerId);
|
||||||
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
|
ViewBag.PaymentIdItems = _context.PayPalPayment.CreateSelectListItems<PayPalPayment>
|
||||||
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}", project.PaymentId);
|
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}", project.PaymentId);
|
||||||
return View(project);
|
return View(project);
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Project project = await _context.Projects.SingleAsync(m => m.Id == id);
|
Project project = await _context.Project.SingleAsync(m => m.Id == id);
|
||||||
if (project == null)
|
if (project == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -146,7 +146,7 @@ namespace Yavsc.Controllers
|
|||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Project project = await _context.Projects.SingleAsync(m => m.Id == id);
|
Project project = await _context.Project.SingleAsync(m => m.Id == id);
|
||||||
if (project == null)
|
if (project == null)
|
||||||
{
|
{
|
||||||
return HttpNotFound();
|
return HttpNotFound();
|
||||||
@ -160,8 +160,8 @@ namespace Yavsc.Controllers
|
|||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
{
|
{
|
||||||
Project project = await _context.Projects.SingleAsync(m => m.Id == id);
|
Project project = await _context.Project.SingleAsync(m => m.Id == id);
|
||||||
_context.Projects.Remove(project);
|
_context.Project.Remove(project);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ namespace Yavsc.Helpers
|
|||||||
string token)
|
string token)
|
||||||
{
|
{
|
||||||
var details = GetExpressCheckoutDetails(token);
|
var details = GetExpressCheckoutDetails(token);
|
||||||
var payment = await context.PayPalPayments.SingleOrDefaultAsync(p=>p.CreationToken == token);
|
var payment = await context.PayPalPayment.SingleOrDefaultAsync(p=>p.CreationToken == token);
|
||||||
if (payment == null)
|
if (payment == null)
|
||||||
{
|
{
|
||||||
payment = new PayPalPayment{
|
payment = new PayPalPayment{
|
||||||
@ -146,7 +146,7 @@ namespace Yavsc.Helpers
|
|||||||
State = details.Ack.ToString()
|
State = details.Ack.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
context.PayPalPayments.Add(payment);
|
context.PayPalPayment.Add(payment);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
payment.ExecutorId = userId;
|
payment.ExecutorId = userId;
|
||||||
@ -162,7 +162,7 @@ namespace Yavsc.Helpers
|
|||||||
string token, GetExpressCheckoutDetailsResponseType fromPayPal)
|
string token, GetExpressCheckoutDetailsResponseType fromPayPal)
|
||||||
{
|
{
|
||||||
return new PaymentInfo {
|
return new PaymentInfo {
|
||||||
DbContent = await context.PayPalPayments
|
DbContent = await context.PayPalPayment
|
||||||
.Include(p=>p.Executor)
|
.Include(p=>p.Executor)
|
||||||
.SingleOrDefaultAsync(
|
.SingleOrDefaultAsync(
|
||||||
p=>p.CreationToken==token),
|
p=>p.CreationToken==token),
|
||||||
|
@ -95,7 +95,7 @@ namespace Yavsc
|
|||||||
if (userName != null)
|
if (userName != null)
|
||||||
{
|
{
|
||||||
using (var db = new ApplicationDbContext()) {
|
using (var db = new ApplicationDbContext()) {
|
||||||
var cx = db.Connections.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId);
|
var cx = db.ChatConnection.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId);
|
||||||
if (cx != null)
|
if (cx != null)
|
||||||
{
|
{
|
||||||
if (stopCalled)
|
if (stopCalled)
|
||||||
@ -179,7 +179,7 @@ namespace Yavsc
|
|||||||
string senderId = (await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == Context.ConnectionId)).ApplicationUserId;
|
string senderId = (await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == Context.ConnectionId)).ApplicationUserId;
|
||||||
|
|
||||||
|
|
||||||
if (_dbContext.Banlist.Any(b=>b.TargetId == senderId)) return false;
|
if (_dbContext.Ban.Any(b=>b.TargetId == senderId)) return false;
|
||||||
var destChatUser = await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == destConnectionId);
|
var destChatUser = await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == destConnectionId);
|
||||||
|
|
||||||
if (_dbContext.BlackListed.Any(b=>b.OwnerId == destChatUser.ApplicationUserId && b.UserId == senderId)) return false;
|
if (_dbContext.BlackListed.Any(b=>b.OwnerId == destChatUser.ApplicationUserId && b.UserId == senderId)) return false;
|
||||||
@ -200,9 +200,9 @@ namespace Yavsc
|
|||||||
|
|
||||||
public void Abort()
|
public void Abort()
|
||||||
{
|
{
|
||||||
var cx = _dbContext .Connections.SingleOrDefault(c=>c.ConnectionId == Context.ConnectionId);
|
var cx = _dbContext .ChatConnection.SingleOrDefault(c=>c.ConnectionId == Context.ConnectionId);
|
||||||
if (cx!=null) {
|
if (cx!=null) {
|
||||||
_dbContext.Connections.Remove(cx);
|
_dbContext.ChatConnection.Remove(cx);
|
||||||
_dbContext.SaveChanges();
|
_dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ namespace Yavsc.Models
|
|||||||
// Customize the ASP.NET Identity model and override the defaults if needed.
|
// Customize the ASP.NET Identity model and override the defaults if needed.
|
||||||
// For example, you can rename the ASP.NET Identity table names and more.
|
// For example, you can rename the ASP.NET Identity table names and more.
|
||||||
// Add your customizations after calling base.OnModelCreating(builder);
|
// Add your customizations after calling base.OnModelCreating(builder);
|
||||||
builder.Entity<Relationship.Contact>().HasKey(x => new { x.OwnerId, x.UserId });
|
builder.Entity<Contact>().HasKey(x => new { x.OwnerId, x.UserId });
|
||||||
builder.Entity<GoogleCloudMobileDeclaration>().Property(x => x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
|
builder.Entity<GoogleCloudMobileDeclaration>().Property(x => x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
|
||||||
builder.Entity<BlogTag>().HasKey(x => new { x.PostId, x.TagId });
|
builder.Entity<BlogTag>().HasKey(x => new { x.PostId, x.TagId });
|
||||||
builder.Entity<ApplicationUser>().HasMany<ChatConnection>(c => c.Connections);
|
builder.Entity<ApplicationUser>().HasMany<ChatConnection>(c => c.Connections);
|
||||||
@ -157,15 +157,13 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
|
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
|
||||||
|
|
||||||
public DbSet<Relationship.Contact> Contacts { get; set; }
|
public DbSet<Contact> Contacts { get; set; }
|
||||||
|
|
||||||
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
||||||
|
|
||||||
public DbSet<ChatConnection> Connections { get; set; }
|
|
||||||
|
|
||||||
public DbSet<BlackListed> BlackListed { get; set; }
|
public DbSet<BlackListed> BlackListed { get; set; }
|
||||||
|
|
||||||
public DbSet<MusicalPreference> MusicalPreferences { get; set; }
|
public DbSet<MusicalPreference> MusicalPreference { get; set; }
|
||||||
|
|
||||||
public DbSet<MusicalTendency> MusicalTendency { get; set; }
|
public DbSet<MusicalTendency> MusicalTendency { get; set; }
|
||||||
|
|
||||||
@ -182,7 +180,7 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
[ActivitySettings]
|
[ActivitySettings]
|
||||||
public DbSet<GeneralSettings> GeneralSettings { get; set; }
|
public DbSet<GeneralSettings> GeneralSettings { get; set; }
|
||||||
public DbSet<CoWorking> WorkflowProviders { get; set; }
|
public DbSet<CoWorking> CoWorking { get; set; }
|
||||||
|
|
||||||
private void AddTimestamps(string currentUsername)
|
private void AddTimestamps(string currentUsername)
|
||||||
{
|
{
|
||||||
@ -218,13 +216,13 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
public DbSet<Circle> Circle { get; set; }
|
public DbSet<Circle> Circle { get; set; }
|
||||||
|
|
||||||
public DbSet<CircleAuthorizationToBlogPost> BlogACL { get; set; }
|
public DbSet<CircleAuthorizationToBlogPost> CircleAuthorizationToBlogPost { get; set; }
|
||||||
|
|
||||||
public DbSet<CommandForm> CommandForm { get; set; }
|
public DbSet<CommandForm> CommandForm { get; set; }
|
||||||
|
|
||||||
public DbSet<Form> Form { get; set; }
|
public DbSet<Form> Form { get; set; }
|
||||||
|
|
||||||
public DbSet<Ban> Banlist { get; set; }
|
public DbSet<Ban> Ban { get; set; }
|
||||||
|
|
||||||
public DbSet<HairTaint> HairTaint { get; set; }
|
public DbSet<HairTaint> HairTaint { get; set; }
|
||||||
|
|
||||||
@ -240,13 +238,13 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
public DbSet<BankIdentity> BankIdentity { get; set; }
|
public DbSet<BankIdentity> BankIdentity { get; set; }
|
||||||
|
|
||||||
public DbSet<PayPalPayment> PayPalPayments { get; set; }
|
public DbSet<PayPalPayment> PayPalPayment { get; set; }
|
||||||
|
|
||||||
public DbSet<HyperLink> Links { get; set; }
|
public DbSet<HyperLink> HyperLink { get; set; }
|
||||||
|
|
||||||
public DbSet<Period> Period { get; set; }
|
public DbSet<Period> Period { get; set; }
|
||||||
|
|
||||||
public DbSet<BlogTag> BlogTags { get; set; }
|
public DbSet<BlogTag> BlogTag { get; set; }
|
||||||
|
|
||||||
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
||||||
|
|
||||||
@ -266,7 +264,7 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
public DbSet<GitRepositoryReference> GitRepositoryReference { get; set; }
|
public DbSet<GitRepositoryReference> GitRepositoryReference { get; set; }
|
||||||
|
|
||||||
public DbSet<Project> Projects { get; set; }
|
public DbSet<Project> Project { get; set; }
|
||||||
|
|
||||||
public DbSet<BlogTrad> BlogTrad { get; set; }
|
public DbSet<BlogTrad> BlogTrad { get; set; }
|
||||||
|
|
||||||
|
@ -91,10 +91,11 @@ namespace Yavsc {
|
|||||||
SiteSettings settingsOptions, ILogger logger) {
|
SiteSettings settingsOptions, ILogger logger) {
|
||||||
|
|
||||||
app.UseIdentity ();
|
app.UseIdentity ();
|
||||||
app.UseWhen (context => context.Request.Path.StartsWithSegments ("/api")
|
app.UseWhen ( context => context.Request.Path.StartsWithSegments ("/api")
|
||||||
|| context.Request.Path.StartsWithSegments ("/live"),
|
|| context.Request.Path.StartsWithSegments ("/live") ,
|
||||||
branch => {
|
branchLiveOrApi =>
|
||||||
branch.UseJwtBearerAuthentication (
|
{
|
||||||
|
branchLiveOrApi.UseJwtBearerAuthentication (
|
||||||
options => {
|
options => {
|
||||||
options.AuthenticationScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.AuthenticationScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
options.AutomaticAuthenticate = true;
|
options.AutomaticAuthenticate = true;
|
||||||
@ -103,21 +104,21 @@ namespace Yavsc {
|
|||||||
ProtectionProvider
|
ProtectionProvider
|
||||||
));
|
));
|
||||||
options.Events = new JwtBearerEvents
|
options.Events = new JwtBearerEvents
|
||||||
{
|
|
||||||
OnReceivingToken = async context =>
|
|
||||||
{
|
|
||||||
var signalRTokenHeader = context.Request.Query["signalRTokenHeader"];
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(signalRTokenHeader) &&
|
|
||||||
(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
|
|
||||||
{
|
{
|
||||||
context.Token = context.Request.Query["signalRTokenHeader"];
|
OnReceivingToken = context =>
|
||||||
}
|
{
|
||||||
}
|
return Task.Run( () => {
|
||||||
};
|
var signalRTokenHeader = context.Request.Query["signalRTokenHeader"];
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(signalRTokenHeader) &&
|
||||||
|
(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
|
||||||
|
{
|
||||||
|
context.Token = context.Request.Query["signalRTokenHeader"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
app.UseWhen (context => !context.Request.Path.StartsWithSegments ("/api") && !context.Request.Path.StartsWithSegments ("/live"),
|
app.UseWhen (context => !context.Request.Path.StartsWithSegments ("/api") && !context.Request.Path.StartsWithSegments ("/live"),
|
||||||
branch => {
|
branch => {
|
||||||
|
Reference in New Issue
Block a user