mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
- Modified uploads to have an expiration of a day for non-logged in users.
- Cleaned up API scopes. - Cleaned up the UI. - Removed uneccessary 'hide' property for pastes.
This commit is contained in:
parent
e027ac44d6
commit
9bbb9a8ffa
@ -12,7 +12,7 @@ using Teknik.Logging;
|
||||
|
||||
namespace Teknik.Areas.API.V1.Controllers
|
||||
{
|
||||
[Authorize(AuthenticationSchemes = "Bearer", Policy = "AnyAPI")]
|
||||
[Authorize(Policy = "AnyAPI")]
|
||||
public class AccountAPIv1Controller : APIv1Controller
|
||||
{
|
||||
public AccountAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
|
||||
|
@ -13,7 +13,7 @@ using Teknik.Logging;
|
||||
|
||||
namespace Teknik.Areas.API.V1.Controllers
|
||||
{
|
||||
[Authorize(AuthenticationSchemes = "Bearer", Roles = "Admin", Policy = "AnyAPI")]
|
||||
[Authorize(Roles = "Admin", Policy = "AnyAPI")]
|
||||
public class AdminAPIv1Controller : APIv1Controller
|
||||
{
|
||||
public AdminAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
|
||||
|
@ -17,20 +17,19 @@ using Teknik.Utilities;
|
||||
|
||||
namespace Teknik.Areas.API.V1.Controllers
|
||||
{
|
||||
[Authorize(AuthenticationSchemes = "Bearer", Policy = "WriteOnlyAPI")]
|
||||
[Authorize(Policy = "WriteAPI")]
|
||||
public class PasteAPIv1Controller : APIv1Controller
|
||||
{
|
||||
public PasteAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public IActionResult Paste(PasteAPIv1Model model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model != null && model.code != null)
|
||||
{
|
||||
Paste.Models.Paste paste = PasteHelper.CreatePaste(_config, _dbContext, model.code, model.title, model.syntax, model.expireUnit, model.expireLength, model.password, model.hide);
|
||||
Paste.Models.Paste paste = PasteHelper.CreatePaste(_config, _dbContext, model.code, model.title, model.syntax, model.expireUnit, model.expireLength, model.password);
|
||||
|
||||
// Associate this with the user if they are logged in
|
||||
if (User.Identity.IsAuthenticated)
|
||||
|
@ -18,13 +18,12 @@ using Teknik.Utilities;
|
||||
|
||||
namespace Teknik.Areas.API.V1.Controllers
|
||||
{
|
||||
[Authorize(AuthenticationSchemes = "Bearer", Policy = "WriteOnlyAPI")]
|
||||
[Authorize(Policy = "WriteAPI")]
|
||||
public class ShortenAPIv1Controller : APIv1Controller
|
||||
{
|
||||
public ShortenAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public IActionResult Shorten(ShortenAPIv1Model model)
|
||||
{
|
||||
try
|
||||
|
@ -22,7 +22,7 @@ using Teknik.Utilities;
|
||||
|
||||
namespace Teknik.Areas.API.V1.Controllers
|
||||
{
|
||||
[Authorize(AuthenticationSchemes = "Bearer", Policy = "WriteOnlyAPI")]
|
||||
[Authorize(Policy = "WriteAPI")]
|
||||
public class UploadAPIv1Controller : APIv1Controller
|
||||
{
|
||||
public UploadAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
|
||||
@ -47,6 +47,12 @@ namespace Teknik.Areas.API.V1.Controllers
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-logged in users are defaulted to 1 day expiration
|
||||
model.expirationUnit = ExpirationUnit.Days;
|
||||
model.expirationLength = 1;
|
||||
}
|
||||
if (model.file.Length <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
@ -156,6 +162,8 @@ namespace Teknik.Areas.API.V1.Controllers
|
||||
keySize = upload.KeySize,
|
||||
iv = upload.IV,
|
||||
blockSize = upload.BlockSize,
|
||||
maxDownloads = upload.MaxDownloads,
|
||||
expirationDate = upload.ExpireDate,
|
||||
deletionKey = upload.DeleteKey
|
||||
|
||||
};
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
public string password { get; set; }
|
||||
|
||||
public bool hide { get; set; }
|
||||
|
||||
public PasteAPIv1Model()
|
||||
{
|
||||
code = null;
|
||||
@ -24,7 +22,6 @@
|
||||
expireUnit = "never";
|
||||
expireLength = 1;
|
||||
password = string.Empty;
|
||||
hide = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -143,7 +143,7 @@ namespace Teknik.Areas.Paste.Controllers
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[DisableRequestSizeLimit]
|
||||
public IActionResult Paste([Bind("Content, Title, Syntax, ExpireLength, ExpireUnit, Password, Hide")]PasteCreateViewModel model)
|
||||
public IActionResult Paste([Bind("Content, Title, Syntax, ExpireLength, ExpireUnit, Password")]PasteCreateViewModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
@ -151,7 +151,7 @@ namespace Teknik.Areas.Paste.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Models.Paste paste = PasteHelper.CreatePaste(_config, _dbContext, model.Content, model.Title, model.Syntax, model.ExpireUnit, model.ExpireLength ?? 1, model.Password, model.Hide);
|
||||
Models.Paste paste = PasteHelper.CreatePaste(_config, _dbContext, model.Content, model.Title, model.Syntax, model.ExpireUnit, model.ExpireLength ?? 1, model.Password);
|
||||
|
||||
if (model.ExpireUnit == "view")
|
||||
{
|
||||
|
@ -51,8 +51,6 @@ namespace Teknik.Areas.Paste.Models
|
||||
[CaseSensitive]
|
||||
public string DeleteKey { get; set; }
|
||||
|
||||
public bool Hide { get; set; }
|
||||
|
||||
public int MaxViews { get; set; }
|
||||
|
||||
public int Views { get; set; }
|
||||
|
@ -14,7 +14,7 @@ namespace Teknik.Areas.Paste
|
||||
{
|
||||
public static class PasteHelper
|
||||
{
|
||||
public static Models.Paste CreatePaste(Config config, TeknikEntities db, string content, string title = "", string syntax = "text", string expireUnit = "never", int expireLength = 1, string password = "", bool hide = false)
|
||||
public static Models.Paste CreatePaste(Config config, TeknikEntities db, string content, string title = "", string syntax = "text", string expireUnit = "never", int expireLength = 1, string password = "")
|
||||
{
|
||||
Models.Paste paste = new Models.Paste();
|
||||
paste.DatePosted = DateTime.Now;
|
||||
@ -88,7 +88,6 @@ namespace Teknik.Areas.Paste
|
||||
//paste.Content = content;
|
||||
paste.Title = title;
|
||||
paste.Syntax = syntax;
|
||||
paste.Hide = hide;
|
||||
paste.DeleteKey = delKey;
|
||||
|
||||
return paste;
|
||||
|
@ -19,8 +19,6 @@ namespace Teknik.Areas.Paste.ViewModels
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
public bool Hide { get; set; }
|
||||
|
||||
public string CurrentSub { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -62,15 +62,6 @@
|
||||
<input type="password" class="form-control" name="Password" id="password" placeholder="Secret">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-6">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="Hide" id="hide" value="true"> Hide from Public List
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</!form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -72,6 +72,12 @@ namespace Teknik.Areas.Upload.Controllers
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-logged in users are defaulted to 1 day expiration
|
||||
uploadFile.options.ExpirationUnit = ExpirationUnit.Days;
|
||||
uploadFile.options.ExpirationLength = 1;
|
||||
}
|
||||
if (uploadFile.file.Length <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
@ -135,7 +141,16 @@ namespace Teknik.Areas.Upload.Controllers
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
return Json(new { result = new { name = upload.Url, url = Url.SubRouteUrl("u", "Upload.Download", new { file = upload.Url }), contentType = upload.ContentType, contentLength = StringHelper.GetBytesReadable(upload.ContentLength), deleteUrl = Url.SubRouteUrl("u", "Upload.DeleteByKey", new { file = upload.Url, key = upload.DeleteKey }) } });
|
||||
return Json(new { result = new
|
||||
{
|
||||
name = upload.Url,
|
||||
url = Url.SubRouteUrl("u", "Upload.Download", new { file = upload.Url }),
|
||||
contentType = upload.ContentType,
|
||||
contentLength = StringHelper.GetBytesReadable(upload.ContentLength),
|
||||
deleteUrl = Url.SubRouteUrl("u", "Upload.DeleteByKey", new { file = upload.Url, key = upload.DeleteKey }),
|
||||
expirationUnit = uploadFile.options.ExpirationUnit.ToString(),
|
||||
expirationLength = uploadFile.options.ExpirationLength
|
||||
} });
|
||||
}
|
||||
}
|
||||
return Json(new { error = new { message = "Unable to upload file" } });
|
||||
|
@ -109,6 +109,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
@ -129,6 +131,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,8 +21,9 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<span class="pull-right"><button type="button" class="btn btn-default" id="createClient">Create Client</button></span>
|
||||
<div class="clearfix"></div>
|
||||
<br />
|
||||
<label for="clients"><h4>Clients</h4></label><span class="pull-right"><button type="button" class="btn btn-default" id="createClient">Create Client</button></span>
|
||||
<div id="clients">
|
||||
<ul class="list-group" id="clientList">
|
||||
@if (Model.Clients.Any())
|
||||
|
@ -14,33 +14,29 @@
|
||||
|
||||
<!form class="form" action="##" method="post" id="updateForm">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-3">
|
||||
<h4>Encrypt in Browser</h4>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<label for="update_upload_encrypt"><h4>Encrypt in Browser</h4></label>
|
||||
<input id="update_upload_encrypt" name="update_upload_encrypt" title="whether the file should be encrypted in the browser before upload" type="checkbox" value="true" @(Model.Encrypt ? "checked" : string.Empty) />
|
||||
</label>
|
||||
<input id="update_upload_encrypt" name="update_upload_encrypt" title="whether the file should be encrypted in the browser before upload" type="checkbox" value="true" @(Model.Encrypt ? "checked" : string.Empty) />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<h4 class="text-center">Expiration</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 hidden" id="length-div">
|
||||
<input type="number" min="1" step="1" class="form-control" name="expirelength" id="expirelength" value="@Model.ExpirationLength">
|
||||
</div>
|
||||
<div class="col-sm-12" id="unit-div">
|
||||
<select class="form-control" name="expireunit" id="expireunit">
|
||||
@foreach (ExpirationUnit unit in Enum.GetValues(typeof(ExpirationUnit)))
|
||||
{
|
||||
<!option value="@unit" @(Model.ExpirationUnit == unit ? "selected" : string.Empty)>@unit.ToString()</!option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<h4 class="text-center">Expiration</h4>
|
||||
</div>
|
||||
<div class="col-sm-2 hidden" id="length-div">
|
||||
<input type="number" min="1" step="1" class="form-control" name="expirelength" id="expirelength" value="@Model.ExpirationLength">
|
||||
</div>
|
||||
<div class="col-sm-9" id="unit-div">
|
||||
<select class="form-control" name="expireunit" id="expireunit">
|
||||
@foreach (ExpirationUnit unit in Enum.GetValues(typeof(ExpirationUnit)))
|
||||
{
|
||||
<!option value="@unit" @(Model.ExpirationUnit == unit ? "selected" : string.Empty)>@unit.ToString()</!option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
747
Teknik/Data/Migrations/20190121042731_PasteCleanup.Designer.cs
generated
Normal file
747
Teknik/Data/Migrations/20190121042731_PasteCleanup.Designer.cs
generated
Normal file
@ -0,0 +1,747 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Teknik.Data;
|
||||
|
||||
namespace Teknik.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(TeknikEntities))]
|
||||
[Migration("20190121042731_PasteCleanup")]
|
||||
partial class PasteCleanup
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-preview3-35497")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.Blog", b =>
|
||||
{
|
||||
b.Property<int>("BlogId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("UserId");
|
||||
|
||||
b.HasKey("BlogId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Blogs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPost", b =>
|
||||
{
|
||||
b.Property<int>("BlogPostId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Article");
|
||||
|
||||
b.Property<int>("BlogId");
|
||||
|
||||
b.Property<DateTime>("DateEdited");
|
||||
|
||||
b.Property<DateTime>("DatePosted");
|
||||
|
||||
b.Property<DateTime>("DatePublished");
|
||||
|
||||
b.Property<bool>("Published");
|
||||
|
||||
b.Property<bool>("System");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.HasKey("BlogPostId");
|
||||
|
||||
b.HasIndex("BlogId");
|
||||
|
||||
b.ToTable("BlogPosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPostComment", b =>
|
||||
{
|
||||
b.Property<int>("BlogPostCommentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Article");
|
||||
|
||||
b.Property<int>("BlogPostId");
|
||||
|
||||
b.Property<DateTime>("DateEdited");
|
||||
|
||||
b.Property<DateTime>("DatePosted");
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.HasKey("BlogPostCommentId");
|
||||
|
||||
b.HasIndex("BlogPostId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("BlogPostComments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPostTag", b =>
|
||||
{
|
||||
b.Property<int>("BlogPostTagId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("BlogPostId");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("BlogPostTagId");
|
||||
|
||||
b.HasIndex("BlogPostId");
|
||||
|
||||
b.ToTable("BlogPostTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Contact.Models.Contact", b =>
|
||||
{
|
||||
b.Property<int>("ContactId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("DateAdded");
|
||||
|
||||
b.Property<string>("Email");
|
||||
|
||||
b.Property<string>("Message");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("Subject");
|
||||
|
||||
b.HasKey("ContactId");
|
||||
|
||||
b.ToTable("Contact");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Paste.Models.Paste", b =>
|
||||
{
|
||||
b.Property<int>("PasteId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("BlockSize");
|
||||
|
||||
b.Property<string>("Content");
|
||||
|
||||
b.Property<DateTime>("DatePosted");
|
||||
|
||||
b.Property<string>("DeleteKey")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<DateTime?>("ExpireDate");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<string>("HashedPassword")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<string>("IV")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int>("KeySize");
|
||||
|
||||
b.Property<int>("MaxViews");
|
||||
|
||||
b.Property<string>("Syntax");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.Property<int>("Views");
|
||||
|
||||
b.HasKey("PasteId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Pastes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.Podcast", b =>
|
||||
{
|
||||
b.Property<int>("PodcastId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("DateEdited");
|
||||
|
||||
b.Property<DateTime>("DatePosted");
|
||||
|
||||
b.Property<DateTime>("DatePublished");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int>("Episode");
|
||||
|
||||
b.Property<bool>("Published");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.HasKey("PodcastId");
|
||||
|
||||
b.ToTable("Podcasts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastComment", b =>
|
||||
{
|
||||
b.Property<int>("PodcastCommentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Article");
|
||||
|
||||
b.Property<DateTime>("DateEdited");
|
||||
|
||||
b.Property<DateTime>("DatePosted");
|
||||
|
||||
b.Property<int>("PodcastId");
|
||||
|
||||
b.Property<int>("UserId");
|
||||
|
||||
b.HasKey("PodcastCommentId");
|
||||
|
||||
b.HasIndex("PodcastId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("PodcastComments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastFile", b =>
|
||||
{
|
||||
b.Property<int>("PodcastFileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<long>("ContentLength");
|
||||
|
||||
b.Property<string>("ContentType");
|
||||
|
||||
b.Property<string>("FileName");
|
||||
|
||||
b.Property<string>("Path");
|
||||
|
||||
b.Property<int>("PodcastId");
|
||||
|
||||
b.Property<int>("Size");
|
||||
|
||||
b.HasKey("PodcastFileId");
|
||||
|
||||
b.HasIndex("PodcastId");
|
||||
|
||||
b.ToTable("PodcastFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastTag", b =>
|
||||
{
|
||||
b.Property<int>("PodcastTagId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("PodcastId");
|
||||
|
||||
b.HasKey("PodcastTagId");
|
||||
|
||||
b.HasIndex("PodcastId");
|
||||
|
||||
b.ToTable("PodcastTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Shortener.Models.ShortenedUrl", b =>
|
||||
{
|
||||
b.Property<int>("ShortenedUrlId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("DateAdded");
|
||||
|
||||
b.Property<string>("OriginalUrl");
|
||||
|
||||
b.Property<string>("ShortUrl")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.Property<int>("Views");
|
||||
|
||||
b.HasKey("ShortenedUrlId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ShortenedUrls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Stats.Models.Takedown", b =>
|
||||
{
|
||||
b.Property<int>("TakedownId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ActionTaken");
|
||||
|
||||
b.Property<DateTime>("DateActionTaken");
|
||||
|
||||
b.Property<DateTime>("DateRequested");
|
||||
|
||||
b.Property<string>("Reason");
|
||||
|
||||
b.Property<string>("Requester");
|
||||
|
||||
b.Property<string>("RequesterContact");
|
||||
|
||||
b.HasKey("TakedownId");
|
||||
|
||||
b.ToTable("Takedowns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Stats.Models.Transaction", b =>
|
||||
{
|
||||
b.Property<int>("TransactionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("decimal(19, 5)");
|
||||
|
||||
b.Property<int>("Currency");
|
||||
|
||||
b.Property<DateTime>("DateSent");
|
||||
|
||||
b.Property<string>("Reason");
|
||||
|
||||
b.HasKey("TransactionId");
|
||||
|
||||
b.ToTable("Transactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Upload.Models.Upload", b =>
|
||||
{
|
||||
b.Property<int>("UploadId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("BlockSize");
|
||||
|
||||
b.Property<long>("ContentLength");
|
||||
|
||||
b.Property<string>("ContentType");
|
||||
|
||||
b.Property<DateTime>("DateUploaded");
|
||||
|
||||
b.Property<string>("DeleteKey")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int>("Downloads");
|
||||
|
||||
b.Property<DateTime?>("ExpireDate");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<string>("IV")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int>("KeySize");
|
||||
|
||||
b.Property<int>("MaxDownloads");
|
||||
|
||||
b.Property<int?>("Takedown_TakedownId");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.HasKey("UploadId");
|
||||
|
||||
b.HasIndex("Takedown_TakedownId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Uploads");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.InviteCode", b =>
|
||||
{
|
||||
b.Property<int>("InviteCodeId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int?>("ClaimedUserId");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<int?>("OwnerId");
|
||||
|
||||
b.HasKey("InviteCodeId");
|
||||
|
||||
b.HasIndex("ClaimedUserId")
|
||||
.IsUnique()
|
||||
.HasFilter("[ClaimedUserId] IS NOT NULL");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("InviteCodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.LoginInfo", b =>
|
||||
{
|
||||
b.Property<int>("LoginInfoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("LoginProvider");
|
||||
|
||||
b.Property<string>("ProviderDisplayName");
|
||||
|
||||
b.Property<string>("ProviderKey");
|
||||
|
||||
b.Property<int>("UserId");
|
||||
|
||||
b.HasKey("LoginInfoId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Username");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.Vault", b =>
|
||||
{
|
||||
b.Property<int>("VaultId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("DateCreated");
|
||||
|
||||
b.Property<DateTime>("DateEdited");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.Property<int>("Views");
|
||||
|
||||
b.HasKey("VaultId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Vaults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.VaultItem", b =>
|
||||
{
|
||||
b.Property<int>("VaultItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("DateAdded");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("VaultId");
|
||||
|
||||
b.HasKey("VaultItemId");
|
||||
|
||||
b.HasIndex("VaultId");
|
||||
|
||||
b.ToTable("VaultItems");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("VaultItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.PasteVaultItem", b =>
|
||||
{
|
||||
b.HasBaseType("Teknik.Areas.Vault.Models.VaultItem");
|
||||
|
||||
b.Property<int>("PasteId");
|
||||
|
||||
b.HasIndex("PasteId");
|
||||
|
||||
b.HasDiscriminator().HasValue("PasteVaultItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.UploadVaultItem", b =>
|
||||
{
|
||||
b.HasBaseType("Teknik.Areas.Vault.Models.VaultItem");
|
||||
|
||||
b.Property<int>("UploadId");
|
||||
|
||||
b.HasIndex("UploadId");
|
||||
|
||||
b.HasDiscriminator().HasValue("UploadVaultItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.Blog", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPost", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Blog.Models.Blog", "Blog")
|
||||
.WithMany("BlogPosts")
|
||||
.HasForeignKey("BlogId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPostComment", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Blog.Models.BlogPost", "BlogPost")
|
||||
.WithMany("Comments")
|
||||
.HasForeignKey("BlogPostId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Blog.Models.BlogPostTag", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Blog.Models.BlogPost", "BlogPost")
|
||||
.WithMany("Tags")
|
||||
.HasForeignKey("BlogPostId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Paste.Models.Paste", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany("Pastes")
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastComment", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Podcast.Models.Podcast", "Podcast")
|
||||
.WithMany("Comments")
|
||||
.HasForeignKey("PodcastId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastFile", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Podcast.Models.Podcast", "Podcast")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("PodcastId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Podcast.Models.PodcastTag", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Podcast.Models.Podcast", "Podcast")
|
||||
.WithMany("Tags")
|
||||
.HasForeignKey("PodcastId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Shortener.Models.ShortenedUrl", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany("ShortenedUrls")
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Upload.Models.Upload", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Stats.Models.Takedown")
|
||||
.WithMany("Attachments")
|
||||
.HasForeignKey("Takedown_TakedownId");
|
||||
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany("Uploads")
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.InviteCode", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "ClaimedUser")
|
||||
.WithOne("ClaimedInviteCode")
|
||||
.HasForeignKey("Teknik.Areas.Users.Models.InviteCode", "ClaimedUserId");
|
||||
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "Owner")
|
||||
.WithMany("OwnedInviteCodes")
|
||||
.HasForeignKey("OwnerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.LoginInfo", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany("Logins")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Users.Models.User", b =>
|
||||
{
|
||||
b.OwnsOne("Teknik.Areas.Users.Models.BlogSettings", "BlogSettings", b1 =>
|
||||
{
|
||||
b1.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b1.Property<string>("Description")
|
||||
.HasColumnName("Description");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.HasColumnName("Title");
|
||||
|
||||
b1.HasKey("UserId");
|
||||
|
||||
b1.ToTable("Users");
|
||||
|
||||
b1.HasOne("Teknik.Areas.Users.Models.User")
|
||||
.WithOne("BlogSettings")
|
||||
.HasForeignKey("Teknik.Areas.Users.Models.BlogSettings", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
b.OwnsOne("Teknik.Areas.Users.Models.UploadSettings", "UploadSettings", b1 =>
|
||||
{
|
||||
b1.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b1.Property<bool>("Encrypt")
|
||||
.HasColumnName("Encrypt");
|
||||
|
||||
b1.Property<int>("ExpirationLength")
|
||||
.HasColumnName("ExpirationLength");
|
||||
|
||||
b1.Property<int>("ExpirationUnit")
|
||||
.HasColumnName("ExpirationUnit");
|
||||
|
||||
b1.HasKey("UserId");
|
||||
|
||||
b1.ToTable("Users");
|
||||
|
||||
b1.HasOne("Teknik.Areas.Users.Models.User")
|
||||
.WithOne("UploadSettings")
|
||||
.HasForeignKey("Teknik.Areas.Users.Models.UploadSettings", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
b.OwnsOne("Teknik.Areas.Users.Models.UserSettings", "UserSettings", b1 =>
|
||||
{
|
||||
b1.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b1.Property<string>("About")
|
||||
.HasColumnName("About");
|
||||
|
||||
b1.Property<string>("Quote")
|
||||
.HasColumnName("Quote");
|
||||
|
||||
b1.Property<string>("Website")
|
||||
.HasColumnName("Website");
|
||||
|
||||
b1.HasKey("UserId");
|
||||
|
||||
b1.ToTable("Users");
|
||||
|
||||
b1.HasOne("Teknik.Areas.Users.Models.User")
|
||||
.WithOne("UserSettings")
|
||||
.HasForeignKey("Teknik.Areas.Users.Models.UserSettings", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.Vault", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Users.Models.User", "User")
|
||||
.WithMany("Vaults")
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.VaultItem", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Vault.Models.Vault", "Vault")
|
||||
.WithMany("VaultItems")
|
||||
.HasForeignKey("VaultId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.PasteVaultItem", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Paste.Models.Paste", "Paste")
|
||||
.WithMany("PasteVaultItems")
|
||||
.HasForeignKey("PasteId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Teknik.Areas.Vault.Models.UploadVaultItem", b =>
|
||||
{
|
||||
b.HasOne("Teknik.Areas.Upload.Models.Upload", "Upload")
|
||||
.WithMany("UploadVaultItems")
|
||||
.HasForeignKey("UploadId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
23
Teknik/Data/Migrations/20190121042731_PasteCleanup.cs
Normal file
23
Teknik/Data/Migrations/20190121042731_PasteCleanup.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Teknik.Data.Migrations
|
||||
{
|
||||
public partial class PasteCleanup : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Hide",
|
||||
table: "Pastes");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Hide",
|
||||
table: "Pastes",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
}
|
||||
}
|
@ -151,8 +151,6 @@ namespace Teknik.Data.Migrations
|
||||
b.Property<string>("HashedPassword")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
b.Property<bool>("Hide");
|
||||
|
||||
b.Property<string>("IV")
|
||||
.HasAnnotation("CaseSensitive", true);
|
||||
|
||||
|
@ -428,6 +428,8 @@ function uploadComplete(fileID, key, options, token, evt) {
|
||||
var contentType = obj.result.contentType;
|
||||
var contentLength = obj.result.contentLength;
|
||||
var deleteUrl = obj.result.deleteUrl;
|
||||
var expirationUnit = obj.result.expirationUnit;
|
||||
var expirationLength = obj.result.expirationLength;
|
||||
|
||||
// Set progress bar
|
||||
setProgress(fileID, 100, 'progress-bar-success', '', 'Complete');
|
||||
@ -442,9 +444,9 @@ function uploadComplete(fileID, key, options, token, evt) {
|
||||
itemDiv.find('#upload-contentType').html(contentType);
|
||||
itemDiv.find('#upload-contentLength').html(contentLength);
|
||||
|
||||
var expirationMessage = options.expirationUnit;
|
||||
if (options.expirationUnit !== "Never") {
|
||||
expirationMessage = options.expirationLength + ' ' + options.expirationUnit;
|
||||
var expirationMessage = expirationUnit;
|
||||
if (expirationUnit !== "Never") {
|
||||
expirationMessage = expirationLength + ' ' + expirationUnit;
|
||||
}
|
||||
itemDiv.find('#upload-expiration').html(expirationMessage);
|
||||
|
||||
|
@ -47,12 +47,12 @@ $(document).ready(function () {
|
||||
function setExpireWidth(unit) {
|
||||
if (unit === "Never") {
|
||||
$('#length-div').addClass("hidden");
|
||||
$('#unit-div').removeClass("col-sm-8");
|
||||
$('#unit-div').addClass("col-sm-12");
|
||||
$('#unit-div').removeClass("col-sm-7");
|
||||
$('#unit-div').addClass("col-sm-9");
|
||||
}
|
||||
else {
|
||||
$('#length-div').removeClass("hidden");
|
||||
$('#unit-div').removeClass("col-sm-12");
|
||||
$('#unit-div').addClass("col-sm-8");
|
||||
$('#unit-div').removeClass("col-sm-9");
|
||||
$('#unit-div').addClass("col-sm-7");
|
||||
}
|
||||
}
|
@ -210,19 +210,23 @@ namespace Teknik
|
||||
{
|
||||
options.AddPolicy("FullAPI", p =>
|
||||
{
|
||||
p.AddAuthenticationSchemes("Bearer");
|
||||
p.RequireScope("teknik-api.read");
|
||||
p.RequireScope("teknik-api.write");
|
||||
});
|
||||
options.AddPolicy("ReadOnlyAPI", p =>
|
||||
options.AddPolicy("ReadAPI", p =>
|
||||
{
|
||||
p.AddAuthenticationSchemes("Bearer");
|
||||
p.RequireScope("teknik-api.read");
|
||||
});
|
||||
options.AddPolicy("WriteOnlyAPI", p =>
|
||||
options.AddPolicy("WriteAPI", p =>
|
||||
{
|
||||
p.RequireScope("teknik-api.read");
|
||||
p.AddAuthenticationSchemes("Bearer");
|
||||
p.RequireScope("teknik-api.write");
|
||||
});
|
||||
options.AddPolicy("AnyAPI", p =>
|
||||
{
|
||||
p.AddAuthenticationSchemes("Bearer");
|
||||
p.RequireScope("teknik-api.read", "teknik-api.write");
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user