FIXME SR is private

This commit is contained in:
Paul Schneider 2023-03-19 17:57:55 +00:00
commit 123283f277
576 changed files with 75350 additions and 13070 deletions

View file

@ -1,17 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
namespace Yavsc.Controllers
{
using System.Security.Claims;
using Microsoft.EntityFrameworkCore;
using Models;
using Models.Workflow;
using Yavsc.Helpers;
[Authorize("AdministratorOnly")]
public class ActivityController : Controller
@ -105,13 +102,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Activity activity = _context.Activities.Single(m => m.Code == id);
if (activity == null)
{
return HttpNotFound();
return NotFound();
}
return View(activity);
@ -150,13 +147,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Activity activity = _context.Activities.Single(m => m.Code == id);
if (activity == null)
{
return HttpNotFound();
return NotFound();
}
ViewBag.ParentCode = GetEligibleParent(id);
SetSettingClasseInfo();
@ -187,13 +184,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Activity activity = _context.Activities.Single(m => m.Code == id);
if (activity == null)
{
return HttpNotFound();
return NotFound();
}
return View(activity);

View file

@ -1,12 +1,9 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Auth;
using System.Security.Claims;
namespace Yavsc.Controllers
{
@ -30,13 +27,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
if (client == null)
{
return HttpNotFound();
return NotFound();
}
return View(client);
}
@ -81,13 +78,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
if (client == null)
{
return HttpNotFound();
return NotFound();
}
SetAppTypesInputValues();
return View(client);
@ -113,13 +110,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Client client = await _context.Applications.SingleAsync(m => m.Id == id);
if (client == null)
{
return HttpNotFound();
return NotFound();
}
return View(client);

View file

@ -1,9 +1,7 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Workflow;
@ -30,13 +28,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
if (coWorking == null)
{
return HttpNotFound();
return NotFound();
}
return View(coWorking);
@ -71,13 +69,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
if (coWorking == null)
{
return HttpNotFound();
return NotFound();
}
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId);
ViewData["WorkingForId"] = new SelectList(_context.Users, "Id", "WorkingFor", coWorking.WorkingForId);
@ -106,13 +104,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CoWorking coWorking = await _context.CoWorking.SingleAsync(m => m.Id == id);
if (coWorking == null)
{
return HttpNotFound();
return NotFound();
}
return View(coWorking);

View file

@ -1,18 +1,14 @@
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.OptionsModel;
namespace Yavsc.Controllers
{
using Helpers;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Models;
using Models.Google.Messaging;
using Models.Relationship;
@ -58,7 +54,7 @@ namespace Yavsc.Controllers
[Authorize]
public virtual async Task<IActionResult> Index()
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
return View(await _context.RdvQueries
.Include(x => x.Client)
.Include(x => x.PerformerProfile)
@ -77,7 +73,7 @@ namespace Yavsc.Controllers
.SingleAsync(m => m.Id == id);
if (command == null)
{
return HttpNotFound();
return NotFound();
}
return View(command);
@ -105,7 +101,7 @@ namespace Yavsc.Controllers
x => x.PerformerId == proId
);
if (pro == null)
return HttpNotFound();
return NotFound();
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == activityCode);
ViewBag.GoogleSettings = _googleSettings;
var userid = User.GetUserId();
@ -126,7 +122,7 @@ namespace Yavsc.Controllers
public async Task<IActionResult> Create(RdvQuery command)
{
// TODO validate BillingCode value
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
var prid = command.PerformerId;
if (string.IsNullOrWhiteSpace(uid)
|| string.IsNullOrWhiteSpace(prid))
@ -156,7 +152,7 @@ namespace Yavsc.Controllers
command.Location = existingLocation;
}
else _context.Attach<Location>(command.Location);
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
_context.RdvQueries.Add(command);
_context.SaveChanges(User.GetUserId());
var yaev = command.CreateEvent("NewCommand");
@ -213,13 +209,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
if (command == null)
{
return HttpNotFound();
return NotFound();
}
return View(command);
}
@ -244,13 +240,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
if (command == null)
{
return HttpNotFound();
return NotFound();
}
return View(command);

View file

@ -1,9 +1,7 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Workflow;
@ -30,13 +28,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
if (commandForm == null)
{
return HttpNotFound();
return NotFound();
}
return View(commandForm);
@ -73,13 +71,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
if (commandForm == null)
{
return HttpNotFound();
return NotFound();
}
SetViewBag(commandForm);
return View(commandForm);
@ -106,13 +104,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id);
if (commandForm == null)
{
return HttpNotFound();
return NotFound();
}
return View(commandForm);

View file

@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Models;
using Yavsc.Models.Musical.Profiles;
@ -26,13 +25,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(djSettings);
@ -63,13 +62,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(djSettings);
}
@ -94,13 +93,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(djSettings);

View file

@ -1,9 +1,7 @@
using System.Linq;
using System.Security.Claims;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Yavsc.Controllers
{
@ -13,6 +11,8 @@ namespace Yavsc.Controllers
using Yavsc.ViewModels.Workflow;
using Yavsc.Services;
using System.Threading.Tasks;
using Yavsc.Helpers;
using Microsoft.EntityFrameworkCore;
[Authorize]
public class DoController : Controller
@ -49,14 +49,14 @@ namespace Yavsc.Controllers
if (id == null || activityCode == null)
{
return HttpNotFound();
return NotFound();
}
UserActivity userActivity = dbContext.UserActivities.Include(m=>m.Does)
.Include(m=>m.User).Single(m => m.DoesCode == activityCode && m.UserId == id);
if (userActivity == null)
{
return HttpNotFound();
return NotFound();
}
bool hasConfigurableSettings = (userActivity.Does.SettingsClassName != null);
var settings = await billing.GetPerformerSettingsAsync(activityCode,id);
@ -88,7 +88,7 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken]
public IActionResult Create(UserActivity userActivity)
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
if (!User.IsInRole("Administrator"))
if (uid != userActivity.UserId)
ModelState.AddModelError("User","You're not admin.");
@ -110,7 +110,7 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
UserActivity userActivity = dbContext.UserActivities.Include(
@ -120,7 +120,7 @@ namespace Yavsc.Controllers
).Single(m => m.DoesCode == activityCode && m.UserId == id);
if (userActivity == null)
{
return HttpNotFound();
return NotFound();
}
ViewData["DoesCode"] = new SelectList(dbContext.Activities, "Code", "Does", userActivity.DoesCode);
ViewData["UserId"] = new SelectList(dbContext.Performers, "PerformerId", "User", userActivity.UserId);
@ -152,14 +152,14 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
UserActivity userActivity = dbContext.UserActivities.Single(m => m.UserId == id && m.DoesCode == activityCode);
if (userActivity == null)
{
return HttpNotFound();
return NotFound();
}
if (!User.IsInRole("Administrator"))
if (User.GetUserId() != userActivity.UserId)

View file

@ -1,18 +1,13 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mime;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.Extensions.OptionsModel;
using Yavsc.Helpers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Models;
using Models.Billing;
using Models.Workflow;
@ -36,7 +31,7 @@ namespace Yavsc.Controllers
public IActionResult Index()
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
return View(_context.Estimates.Include(e=>e.Query)
.Include(e=>e.Query.PerformerProfile)
.Include(e=>e.Query.PerformerProfile.Performer)
@ -49,10 +44,10 @@ namespace Yavsc.Controllers
// GET: Estimate/Details/5
public async Task<IActionResult> Details(long? id)
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Estimate estimate = _context.Estimates
@ -66,9 +61,9 @@ namespace Yavsc.Controllers
.Single(m => m.Id == id);
if (estimate == null)
{
return HttpNotFound();
return NotFound();
}
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
if (authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()).IsFaulted)
{
return new ChallengeResult();
}
@ -80,7 +75,7 @@ namespace Yavsc.Controllers
[Authorize]
public IActionResult Create()
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
IQueryable<RdvQuery> queries = _context.RdvQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid);
//.Select(bq=>new SelectListItem{ Text = bq.Client.UserName, Value = bq.Client.Id });
ViewBag.Clients = queries.Select(q=>q.Client).Distinct();
@ -147,15 +142,15 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
Estimate estimate = _context.Estimates
.Where(e=>e.OwnerId==uid||e.ClientId==uid).Single(m => m.Id == id);
if (estimate == null)
{
return HttpNotFound();
return NotFound();
}
ViewBag.Files = Yavsc.Helpers.FileSystemHelpers.GetFileName(null);
@ -170,9 +165,9 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken]
public IActionResult Edit(Estimate estimate)
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
if (estimate.OwnerId!=uid&&estimate.ClientId!=uid
) return new HttpNotFoundResult();
) return NotFound();
if (ModelState.IsValid)
{
_context.Update(estimate);
@ -188,15 +183,15 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
Estimate estimate = _context.Estimates
.Where(e=>e.OwnerId==uid||e.ClientId==uid) .Single(m => m.Id == id);
if (estimate == null)
{
return HttpNotFound();
return NotFound();
}
return View(estimate);

View file

@ -1,7 +1,6 @@
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Forms;
@ -27,13 +26,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Form form = await _context.Form.SingleAsync(m => m.Id == id);
if (form == null)
{
return HttpNotFound();
return NotFound();
}
return View(form);
@ -64,13 +63,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Form form = await _context.Form.SingleAsync(m => m.Id == id);
if (form == null)
{
return HttpNotFound();
return NotFound();
}
return View(form);
}
@ -95,13 +94,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
Form form = await _context.Form.SingleAsync(m => m.Id == id);
if (form == null)
{
return HttpNotFound();
return NotFound();
}
return View(form);

View file

@ -1,19 +1,15 @@
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.Data.Entity;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;
namespace Yavsc.Controllers
{
using Helpers;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
using Models;
using ViewModels.FrontOffice;
using Yavsc.Abstract.FileSystem;
using Yavsc.Services;
public class FrontOfficeController : Controller
@ -38,7 +34,7 @@ namespace Yavsc.Controllers
}
public ActionResult Index()
{
var uid = User.GetUserId();
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
var now = DateTime.Now;
var model = new FrontOfficeIndexViewModel

View file

@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Models;
using Yavsc.Models.Musical.Profiles;
@ -26,13 +25,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(generalSettings);
@ -63,13 +62,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(generalSettings);
}
@ -94,13 +93,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
return NotFound();
}
return View(generalSettings);

View file

@ -1,11 +1,11 @@
using System.Linq;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace Yavsc.Controllers
{
using System.Security.Claims;
using Models;
using Models.Musical;
using Yavsc.Helpers;
public class MusicalTendenciesController : Controller
{
private readonly ApplicationDbContext _context;
@ -26,13 +26,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
if (musicalTendency == null)
{
return HttpNotFound();
return NotFound();
}
return View(musicalTendency);
@ -63,13 +63,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
if (musicalTendency == null)
{
return HttpNotFound();
return NotFound();
}
return View(musicalTendency);
}
@ -94,13 +94,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
if (musicalTendency == null)
{
return HttpNotFound();
return NotFound();
}
return View(musicalTendency);

View file

@ -1,7 +1,6 @@
using System.Linq;
using System.Security.Claims;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Billing;
@ -28,13 +27,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
if (exceptionSIREN == null)
{
return HttpNotFound();
return NotFound();
}
return View(exceptionSIREN);
@ -65,13 +64,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
if (exceptionSIREN == null)
{
return HttpNotFound();
return NotFound();
}
return View(exceptionSIREN);
}
@ -96,13 +95,13 @@ namespace Yavsc.Controllers
{
if (id == null)
{
return HttpNotFound();
return NotFound();
}
ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id);
if (exceptionSIREN == null)
{
return HttpNotFound();
return NotFound();
}
return View(exceptionSIREN);