Merge branch 'master' into compressTesting
@ -32,16 +32,18 @@ namespace TeamHobby.HobbyProjectGenerator.DAL
|
|||||||
{
|
{
|
||||||
Console.WriteLine(r.ToString());
|
Console.WriteLine(r.ToString());
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*// this is meant for specific basic sql commands
|
||||||
* this is meant for specific basic sql commands
|
|
||||||
using (var adapter = new SqlDataAdapter())
|
using (var adapter = new SqlDataAdapter())
|
||||||
{
|
{
|
||||||
|
adapter.UpdateCommand
|
||||||
|
adapter.DeleteCommand
|
||||||
|
adapter.InsertCommand
|
||||||
adapter.SelectCommand
|
adapter.SelectCommand
|
||||||
}
|
}*/
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using TeamHobby.HobbyProjectGenerator.Main.Models;
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main.Controllers
|
|
||||||
{
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILogger<HomeController> _logger;
|
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Privacy()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
||||||
public IActionResult Error()
|
|
||||||
{
|
|
||||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
using TeamHobby.HobbyProjectGenerator;
|
|
||||||
using TeamHobby.HobbyProjectGenerator.DAL;
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main
|
|
||||||
{
|
|
||||||
public class ExampleDAO : SqlDAO
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
namespace TeamHobby.HobbyProjectGenerator.Main.Models
|
|
||||||
{
|
|
||||||
public class ErrorViewModel
|
|
||||||
{
|
|
||||||
public string? RequestId { get; set; }
|
|
||||||
|
|
||||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
// Add services to the container.
|
|
||||||
builder.Services.AddControllersWithViews();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
|
||||||
if (!app.Environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseExceptionHandler("/Home/Error");
|
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
||||||
app.UseHsts();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
app.UseStaticFiles();
|
|
||||||
|
|
||||||
app.UseRouting();
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
|
||||||
|
|
||||||
app.MapControllerRoute(
|
|
||||||
name: "default",
|
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:6067",
|
|
||||||
"sslPort": 44307
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"TeamHobby.HobbyProjectGenerator.Main": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "https://localhost:7023;http://localhost:5023",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Home Page";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<h1 class="display-4">Welcome</h1>
|
|
||||||
<p>Hello World!</p>
|
|
||||||
</div>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Privacy Policy";
|
|
||||||
}
|
|
||||||
<h1>@ViewData["Title"]</h1>
|
|
||||||
|
|
||||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
@model ErrorViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Error";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
|
||||||
|
|
||||||
@if (Model?.ShowRequestId ?? false)
|
|
||||||
{
|
|
||||||
<p>
|
|
||||||
<strong>Request ID:</strong> <code>@Model?.RequestId</code>
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
|
|
||||||
<h3>Development Mode</h3>
|
|
||||||
<p>
|
|
||||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
|
||||||
It can result in displaying sensitive information from exceptions to end users.
|
|
||||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
|
||||||
and restarting the app.
|
|
||||||
</p>
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>@ViewData["Title"] - TeamHobby.HobbyProjectGenerator.Main</title>
|
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
|
||||||
<link rel="stylesheet" href="~/TeamHobby.HobbyProjectGenerator.Main.styles.css" asp-append-version="true" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">TeamHobby.HobbyProjectGenerator.Main</a>
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
|
||||||
<ul class="navbar-nav flex-grow-1">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<main role="main" class="pb-3">
|
|
||||||
@RenderBody()
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="border-top footer text-muted">
|
|
||||||
<div class="container">
|
|
||||||
© 2021 - TeamHobby.HobbyProjectGenerator.Main - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
|
||||||
for details on configuring this project to bundle and minify static web assets. */
|
|
||||||
|
|
||||||
a.navbar-brand {
|
|
||||||
white-space: normal;
|
|
||||||
text-align: center;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #0077cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #1b6ec2;
|
|
||||||
border-color: #1861ac;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #1b6ec2;
|
|
||||||
border-color: #1861ac;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-top {
|
|
||||||
border-top: 1px solid #e5e5e5;
|
|
||||||
}
|
|
||||||
.border-bottom {
|
|
||||||
border-bottom: 1px solid #e5e5e5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.box-shadow {
|
|
||||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
|
|
||||||
button.accept-policy {
|
|
||||||
font-size: 1rem;
|
|
||||||
line-height: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
|
||||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
@using TeamHobby.HobbyProjectGenerator.Main
|
|
||||||
@using TeamHobby.HobbyProjectGenerator.Main.Models
|
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
@{
|
|
||||||
Layout = "_Layout";
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
html {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
html {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
position: relative;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin-bottom: 60px;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 5.3 KiB |
@ -1,4 +0,0 @@
|
|||||||
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
|
||||||
// for details on configuring this project to bundle and minify static web assets.
|
|
||||||
|
|
||||||
// Write your JavaScript code.
|
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.31919.166
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator", "TeamHobby.HobbyProjectGenerator.csproj", "{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.UserManagement.Tests", "..\TeamHobby.UserManagement.Tests\TeamHobby.UserManagement.Tests.csproj", "{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.DAL", "..\TeamHobby.HobbyProjectGenerator.DAL\TeamHobby.HobbyProjectGenerator.DAL.csproj", "{DCB0E160-1F6D-406E-8633-489CD564479B}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Models", "..\TeamHobby.HobbyProjectGenerator.Models\TeamHobby.HobbyProjectGenerator.Models.csproj", "{75DED6C2-D404-4E71-A58B-0F616DB5C062}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "main", "..\main\main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{DCB0E160-1F6D-406E-8633-489CD564479B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{DCB0E160-1F6D-406E-8633-489CD564479B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{DCB0E160-1F6D-406E-8633-489CD564479B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {B2517200-A9F9-468C-B0EB-280FF9B9FBC9}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
116
Source Code/main/Controller.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using main;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
|
{
|
||||||
|
public class GetCredentials
|
||||||
|
{
|
||||||
|
public string? GetUserName()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Please enter a username:");
|
||||||
|
string? userName = Console.ReadLine();
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
public string? GetPassword()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Please enter a password:");
|
||||||
|
string? userPassword = Console.ReadLine();
|
||||||
|
return userPassword;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
GetCredentials credentials = new GetCredentials();
|
||||||
|
string? username = credentials.GetUserName();
|
||||||
|
string? password = credentials.GetPassword();
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine(value: $"username is {username}\npassword is {password}");
|
||||||
|
|
||||||
|
/* ExampleDAO z = new ExampleDAO();
|
||||||
|
z.UserData("Tomato");
|
||||||
|
Console.Read();*/
|
||||||
|
/*bool MainMenu = true;
|
||||||
|
|
||||||
|
// Set up menu loop
|
||||||
|
while (MainMenu == true)
|
||||||
|
{
|
||||||
|
// Console customization
|
||||||
|
// Change the look of the console
|
||||||
|
Console.Title = "HobbyProjectGenerator";
|
||||||
|
// Change console text color
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
// Change terminal height
|
||||||
|
Console.WindowHeight = 40;
|
||||||
|
|
||||||
|
|
||||||
|
// Create class objects
|
||||||
|
UiPrint menu = new UiPrint();
|
||||||
|
UserAccount user = new UserAccount();
|
||||||
|
|
||||||
|
|
||||||
|
// Print main menu
|
||||||
|
menu.InitialMenu();
|
||||||
|
|
||||||
|
// Set up try-catch for invalid inputs
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get user choice
|
||||||
|
string initialChoice = Console.ReadLine();
|
||||||
|
// Convert to integer
|
||||||
|
int Choice = Convert.ToInt32(initialChoice);
|
||||||
|
|
||||||
|
switch (Choice)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
MainMenu = false;
|
||||||
|
break;
|
||||||
|
// Create a new account
|
||||||
|
case 1:
|
||||||
|
user.newUser();
|
||||||
|
break;
|
||||||
|
// Access Admin features
|
||||||
|
case 2:
|
||||||
|
// Ask for Admin login credentials
|
||||||
|
Console.WriteLine("Please enter a username:");
|
||||||
|
string AdminUser = Console.ReadLine();
|
||||||
|
Console.WriteLine("Please enter the password for" + AdminUser);
|
||||||
|
string AdminPsswrd = Console.ReadLine();
|
||||||
|
|
||||||
|
// Check if the username and password match a record within the administrators
|
||||||
|
|
||||||
|
|
||||||
|
// Show new administrator menu
|
||||||
|
int AdminNum = 0;
|
||||||
|
Console.WriteLine("Welcome" + AdminUser);
|
||||||
|
Console.WriteLine("What would you like to do?");
|
||||||
|
Console.WriteLine("1.View normal user records.");
|
||||||
|
Console.WriteLine("2.View Administrator user records.");
|
||||||
|
Console.WriteLine("3.View log files.");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Invalid choice, please enter a valid number.");
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Catch invalid keys such as spamming enter
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MainMenu = false;
|
||||||
|
};
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
Source Code/main/ExampleDAO.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
|
{
|
||||||
|
public class ExampleDAO
|
||||||
|
{
|
||||||
|
|
||||||
|
public void UserData(string username)
|
||||||
|
{
|
||||||
|
// Sql server connection string, needs to be changed accordingly to connect
|
||||||
|
var connString = "server=localhost,3316;user=root;database=users;password=Plop20"; // Using @" " makes the string literal
|
||||||
|
|
||||||
|
// ADO.NET - ODBC
|
||||||
|
using var conn = new SqlConnection(connString);
|
||||||
|
{
|
||||||
|
// More complex sql commands are done in this method instead
|
||||||
|
var sql = "Select * from roles";
|
||||||
|
using (var command = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
// Get the results from the query
|
||||||
|
SqlDataReader r = command.ExecuteReader();
|
||||||
|
|
||||||
|
// If you wanted to get a singular value back such as a count of a certain item
|
||||||
|
//command.ExecuteScalar();
|
||||||
|
|
||||||
|
// To execute something that doesn't expect results to come back
|
||||||
|
// Use this method instead, IE. Update command
|
||||||
|
//command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
// Read data from query
|
||||||
|
while (r.Read())
|
||||||
|
{
|
||||||
|
Console.WriteLine(r.ToString());
|
||||||
|
}
|
||||||
|
conn.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
// Console.Read();
|
||||||
|
/*
|
||||||
|
* this is meant for specific basic sql commands
|
||||||
|
using (var adapter = new SqlDataAdapter())
|
||||||
|
{
|
||||||
|
adapter.SelectCommand
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
134
Source Code/main/MainMenu.cs
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
|
{
|
||||||
|
public class MainMenu
|
||||||
|
{
|
||||||
|
/*static void Main(string[] args)
|
||||||
|
{
|
||||||
|
/* ExampleDAO z = new ExampleDAO();
|
||||||
|
z.UserData("Tomato");
|
||||||
|
Console.Read();*/
|
||||||
|
/*bool menu = true;
|
||||||
|
|
||||||
|
// Set up menu loop
|
||||||
|
while (menu == true)
|
||||||
|
{
|
||||||
|
// Console customization
|
||||||
|
// Change the look of the console
|
||||||
|
Console.Title = "HobbyProjectGenerator";
|
||||||
|
// Change console text color
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
// Change terminal height
|
||||||
|
Console.WindowHeight = 40;
|
||||||
|
|
||||||
|
|
||||||
|
// Create intial menu
|
||||||
|
Console.WriteLine("What would you like to do?");
|
||||||
|
int num = 1;
|
||||||
|
Console.WriteLine(num + ".Create a new user account.");
|
||||||
|
num += 1;
|
||||||
|
Console.WriteLine(num + ".Acess Admin Features.");
|
||||||
|
|
||||||
|
// Set up try-catch for invalid inputs
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get user choice
|
||||||
|
string initialChoice = Console.ReadLine();
|
||||||
|
// Convert to integer
|
||||||
|
int Choice = Convert.ToInt32(initialChoice);
|
||||||
|
|
||||||
|
switch (Choice)
|
||||||
|
{
|
||||||
|
// Create a new account
|
||||||
|
case 1:
|
||||||
|
// Get username
|
||||||
|
Console.WriteLine("Please enter a username:");
|
||||||
|
string userName = Console.ReadLine();
|
||||||
|
|
||||||
|
// Get Password
|
||||||
|
Console.WriteLine("Please enter a password:");
|
||||||
|
string userPassword = Console.ReadLine();
|
||||||
|
|
||||||
|
// Create bool value for password confirm loop
|
||||||
|
bool conPsswrd = true;
|
||||||
|
// Loop until password is confirmed
|
||||||
|
while (conPsswrd == true)
|
||||||
|
{
|
||||||
|
// Confirm Password
|
||||||
|
Console.WriteLine("Please re-enter the password:");
|
||||||
|
string checkPsswd = Console.ReadLine();
|
||||||
|
// Check if passwords match
|
||||||
|
if (userPassword == checkPsswd)
|
||||||
|
{
|
||||||
|
// Get Security question for password reset
|
||||||
|
Console.WriteLine("Please enter a security question.\n" +
|
||||||
|
"(EX: What is your favorite food?");
|
||||||
|
string SecQuest = Console.ReadLine();
|
||||||
|
// Get Security question answer
|
||||||
|
Console.WriteLine("Please enter the answer for your security question:");
|
||||||
|
String SecAnswer = Console.ReadLine();
|
||||||
|
|
||||||
|
// Call user manager method to create the new user
|
||||||
|
//int userCreateConfirm = new CreateUser(userName,userPassword,SecQuest,SecAnswer);
|
||||||
|
|
||||||
|
// Check if user creation was successful
|
||||||
|
/* if (userCreateConfirm = 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Confirm to user that the account has been created
|
||||||
|
Console.WriteLine("Account created succesfully with the username of" + userName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
/* conPsswrd = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Passwords did not match, please try again.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Access Admin features
|
||||||
|
case 2:
|
||||||
|
// Ask for Admin login credentials
|
||||||
|
Console.WriteLine("Please enter a username:");
|
||||||
|
string AdminUser = Console.ReadLine();
|
||||||
|
Console.WriteLine("Please enter the password for" + AdminUser);
|
||||||
|
string AdminPsswrd = Console.ReadLine();
|
||||||
|
|
||||||
|
// Check if the username and password match a record within the administrators
|
||||||
|
|
||||||
|
|
||||||
|
// Show new administrator menu
|
||||||
|
int AdminNum = 0;
|
||||||
|
Console.WriteLine("Welcome" + AdminUser);
|
||||||
|
Console.WriteLine("What would you like to do?");
|
||||||
|
Console.WriteLine("1.View normal user records.");
|
||||||
|
Console.WriteLine("2.View Administrator user records.");
|
||||||
|
Console.WriteLine("3.");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
menu = false;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Catch invalid keys such as spamming enter
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
menu = false;
|
||||||
|
};
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
79
Source Code/main/SystemAccountManager.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
internal class SystemAccountManager
|
||||||
|
{
|
||||||
|
/*public NewUserName()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public NewPassword()
|
||||||
|
{
|
||||||
|
// Create bool value for password confirm loop
|
||||||
|
bool conPsswrd = true;
|
||||||
|
// Loop until password is confirmed
|
||||||
|
while (conPsswrd == true)
|
||||||
|
{
|
||||||
|
// Confirm Password
|
||||||
|
Console.WriteLine("Please re-enter the password:");
|
||||||
|
string checkPsswd = Console.ReadLine();
|
||||||
|
// Check if passwords match
|
||||||
|
if (userPassword == checkPsswd)
|
||||||
|
{
|
||||||
|
// Get Security question for password reset
|
||||||
|
Console.WriteLine("Please enter a security question.\n" +
|
||||||
|
"(EX: What is your favorite food?");
|
||||||
|
string SecQuest = Console.ReadLine();
|
||||||
|
// Get Security question answer
|
||||||
|
Console.WriteLine("Please enter the answer for your security question:");
|
||||||
|
String SecAnswer = Console.ReadLine();
|
||||||
|
|
||||||
|
// Call user manager method to create the new user
|
||||||
|
//int userCreateConfirm = new CreateUser(userName,userPassword,SecQuest,SecAnswer);
|
||||||
|
|
||||||
|
// Check if user creation was successful
|
||||||
|
/*if (userCreateConfirm = 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Confirm to user that the account has been created
|
||||||
|
Console.WriteLine("Account created succesfully with the username of" + userName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
/*conPsswrd = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Passwords did not match, please try again.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public void AccountController()
|
||||||
|
{
|
||||||
|
// Create objects
|
||||||
|
UserAccount user = new UserAccount();
|
||||||
|
UiPrint ui = new UiPrint();
|
||||||
|
|
||||||
|
bool foo = true;
|
||||||
|
|
||||||
|
while (foo == true)
|
||||||
|
{
|
||||||
|
// sub menu
|
||||||
|
ui.SystemAccountMenu();
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Source Code/main/UiPrint.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
// Print Statements used throughout the program.
|
||||||
|
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
internal class UiPrint
|
||||||
|
{
|
||||||
|
public void InitialMenu()
|
||||||
|
{
|
||||||
|
// Create intial menu
|
||||||
|
Console.WriteLine("What would you like to access?");
|
||||||
|
int num = 1;
|
||||||
|
Console.WriteLine(num + ".User Management");
|
||||||
|
num += 1;
|
||||||
|
Console.WriteLine(num + ".Logging");
|
||||||
|
}
|
||||||
|
public void SystemAccountMenu()
|
||||||
|
{
|
||||||
|
// Create intial menu
|
||||||
|
Console.WriteLine("What would you like to do?");
|
||||||
|
int num = 1;
|
||||||
|
Console.WriteLine(num + ".Create a new account.");
|
||||||
|
num += 1;
|
||||||
|
Console.WriteLine(num + ".Access Admin Features");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Source Code/main/UserAccount.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
public class UserAccount
|
||||||
|
{
|
||||||
|
/* private string username;
|
||||||
|
private string password;
|
||||||
|
private string role;
|
||||||
|
|
||||||
|
public UserAccount(string un,string pwd,string rol)
|
||||||
|
{
|
||||||
|
username = un;
|
||||||
|
password = pwd;
|
||||||
|
role = rol;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UserAccount()
|
||||||
|
{
|
||||||
|
password = "1234";
|
||||||
|
role = "Regular";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void newUser()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DAL\TeamHobby.HobbyProjectGenerator.DAL.csproj" />
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
BIN
doc/Business Docs/Testing_Library_Tech_Approval.pdf
Normal file
|
Before Width: | Height: | Size: 478 KiB |
|
Before Width: | Height: | Size: 861 KiB |
|
Before Width: | Height: | Size: 833 KiB |
|
Before Width: | Height: | Size: 688 KiB |
|
Before Width: | Height: | Size: 828 KiB |
BIN
doc/LowLevel/UserManagement/UserManagementCreateAccount.png
Normal file
|
After Width: | Height: | Size: 474 KiB |
@ -23,7 +23,7 @@ Controller.cs->SqlDAO:++IDataSource factory.GetDataSource(string DbName, string
|
|||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlDAO:++Constructor(string connInfo)++
|
SqlDAO->SqlDAO:++Constructor(string connInfo)++
|
||||||
group #red Data Store Timed Out #white
|
group #red Data Store Timed Out #white
|
||||||
SqlDAO->SqlDAO:++Catch Exception++
|
SqlDAO->SqlDAO: ++Catch SqlException++
|
||||||
Controller.cs<--SqlDAO:++return "Data Source Timed Out"++
|
Controller.cs<--SqlDAO:++return "Data Source Timed Out"++
|
||||||
end
|
end
|
||||||
group #blue Data Store Online #white
|
group #blue Data Store Online #white
|
||||||
@ -49,7 +49,8 @@ activate UserAccount #CBC3E3
|
|||||||
UserAccount->UserAccount:++Constructor(string username,\n string password,\n DateTime TimeStamp)++
|
UserAccount->UserAccount:++Constructor(string username,\n string password,\n DateTime TimeStamp)++
|
||||||
Controller.cs<--UserAccount:++New UserAccount++
|
Controller.cs<--UserAccount:++New UserAccount++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
|
//
|
||||||
|
Controller.cs->SystemAccountManager:++manager.CreateUserRecord(user:UserAccount)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
||||||
|
|
||||||
@ -57,13 +58,9 @@ group #red Invalid Information #white
|
|||||||
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
||||||
User<--Controller.cs:++ return "Invalid input"++
|
User<--Controller.cs:++ return "Invalid input"++
|
||||||
end
|
end
|
||||||
Controller.cs<--SystemAccountManager:++return true++
|
group #green Information Valid #white
|
||||||
deactivate SystemAccountManager
|
|
||||||
//
|
|
||||||
Controller.cs->SystemAccountManager:++manager.CreateUserRecord(user:UserAccount)++
|
|
||||||
|
|
||||||
//check if there is an admin user
|
//check if there is an admin user
|
||||||
activate SystemAccountManager #ffffe0
|
|
||||||
SystemAccountManager->SqlDAO:++bool isAdmin(user:UserAccount)++
|
SystemAccountManager->SqlDAO:++bool isAdmin(user:UserAccount)++
|
||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
||||||
@ -114,9 +111,9 @@ SystemAccountManager->SystemAccountManager:++string NewRole()++
|
|||||||
// Enter Role
|
// Enter Role
|
||||||
User->SystemAccountManager:++string NewRole++
|
User->SystemAccountManager:++string NewRole++
|
||||||
// Create NewUser object
|
// Create NewUser object
|
||||||
UserAccount<-SystemAccountManager:++new NewUser(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole,\nDateTime TimeStamp)++
|
UserAccount<-SystemAccountManager:++new NewUser(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nDateTime TimeStamp)++
|
||||||
activate UserAccount #CBC3E3
|
activate UserAccount #CBC3E3
|
||||||
UserAccount->UserAccount:++Constructor(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole,\nDateTime TimeStamp)++
|
UserAccount->UserAccount:++Constructor(string NewUserName,\nstring NewPassword,\nstring New Email,\nDateTime TimeStamp)++
|
||||||
UserAccount-->SystemAccountManager:++return NewUser++
|
UserAccount-->SystemAccountManager:++return NewUser++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
//Create User Record
|
//Create User Record
|
||||||
@ -171,3 +168,5 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
BIN
doc/LowLevel/UserManagement/UserManagementDeleteUser.png
Normal file
|
After Width: | Height: | Size: 477 KiB |
@ -49,21 +49,17 @@ activate UserAccount #CBC3E3
|
|||||||
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
||||||
Controller.cs<--UserAccount:++New UserAccount++
|
Controller.cs<--UserAccount:++New UserAccount++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
|
Controller.cs->SystemAccountManager: ++manager.DeleteUserRecord(user:UserAccount)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
||||||
group #red Invalid Information #white
|
group #red Invalid Information #white
|
||||||
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
||||||
User<--Controller.cs:++ return "Invalid input"++
|
User<--Controller.cs:++ return "Invalid input"++
|
||||||
end
|
end
|
||||||
Controller.cs<--SystemAccountManager:++return true++
|
|
||||||
deactivate SystemAccountManager
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Controller.cs->SystemAccountManager: ++manager.DeleteUserRecord(user:UserAccount)++
|
group #green Information Valid #white
|
||||||
|
|
||||||
//check if there is an admin user
|
//check if there is an admin user
|
||||||
activate SystemAccountManager #ffffe0
|
|
||||||
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
||||||
@ -119,7 +115,7 @@ AccountService->SqlDAO:++SqlDAO\n.DeleteUserRecord(user:NewUser,\nUpdateType: us
|
|||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++isUser(user:NewUser)++
|
SqlDAO->SqlServer(MariaDB):++isUser(user:NewUser)++
|
||||||
activate SqlServer(MariaDB) #00FFFF
|
activate SqlServer(MariaDB) #00FFFF
|
||||||
SqlServer(MariaDB)->SqlServer(MariaDB):++Select *\nFrom Users\nwhere Username\n= @UserName and\nRole = @UserRole
|
SqlServer(MariaDB)->SqlServer(MariaDB):++ Select *\nFrom Users\nwhere Username\n= @UserName OR\nemail = @Email++
|
||||||
group #red data store timed out #white
|
group #red data store timed out #white
|
||||||
SqlDAO<--SqlServer(MariaDB):++SqlException++
|
SqlDAO<--SqlServer(MariaDB):++SqlException++
|
||||||
deactivate SqlServer(MariaDB)
|
deactivate SqlServer(MariaDB)
|
||||||
@ -162,3 +158,4 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
BIN
doc/LowLevel/UserManagement/UserManagementDisableUser.png
Normal file
|
After Width: | Height: | Size: 462 KiB |
@ -49,21 +49,19 @@ activate UserAccount #CBC3E3
|
|||||||
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
||||||
Controller.cs<--UserAccount:++New UserAccount++
|
Controller.cs<--UserAccount:++New UserAccount++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
|
Controller.cs->SystemAccountManager: ++manager.DisableUserRecord(user:UserAccount)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
||||||
group #red Invalid Information #white
|
group #red Invalid Information #white
|
||||||
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
||||||
User<--Controller.cs:++ return "Invalid input"++
|
User<--Controller.cs:++ return "Invalid input"++
|
||||||
end
|
end
|
||||||
Controller.cs<--SystemAccountManager:++return true++
|
group #green Information Valid #white
|
||||||
deactivate SystemAccountManager
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Controller.cs->SystemAccountManager: ++manager.DisableUserRecord(user:UserAccount)++
|
|
||||||
|
|
||||||
//check if there is an admin user
|
//check if there is an admin user
|
||||||
activate SystemAccountManager #ffffe0
|
|
||||||
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
||||||
@ -159,3 +157,4 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
BIN
doc/LowLevel/UserManagement/UserManagementEditUserRecords.png
Normal file
|
After Width: | Height: | Size: 441 KiB |
@ -50,20 +50,18 @@ activate UserAccount #CBC3E3
|
|||||||
UserAccount->UserAccount: ++string username,\n string password,\n DateTime RegistrationTimeStamp++
|
UserAccount->UserAccount: ++string username,\n string password,\n DateTime RegistrationTimeStamp++
|
||||||
Controller.cs<--UserAccount:++New UserAccount++
|
Controller.cs<--UserAccount:++New UserAccount++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
|
Controller.cs->SystemAccountManager:++manager.UpdateUserRecord(user:UserAccount)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
||||||
group #red Invalid Information #white
|
group #red Invalid Information #white
|
||||||
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
||||||
User<--Controller.cs:++ return "Invalid input"++
|
User<--Controller.cs:++ return "Invalid input"++
|
||||||
end
|
end
|
||||||
Controller.cs<--SystemAccountManager:++return true++
|
group #green Information Valid #white
|
||||||
deactivate SystemAccountManager
|
|
||||||
|
|
||||||
//look over
|
//look over
|
||||||
Controller.cs->SystemAccountManager:++manager.UpdateUserRecord(user:UserAccount)++
|
|
||||||
|
|
||||||
//check if there is an admin user
|
//check if there is an admin user
|
||||||
activate SystemAccountManager #ffffe0
|
|
||||||
SystemAccountManager->SqlDAO:++bool isAdmin(user:UserAccount)++
|
SystemAccountManager->SqlDAO:++bool isAdmin(user:UserAccount)++
|
||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
||||||
@ -113,9 +111,9 @@ SystemAccountManager->SystemAccountManager:++string NewRole()++
|
|||||||
// Enter Role
|
// Enter Role
|
||||||
User->SystemAccountManager:++string NewRole++
|
User->SystemAccountManager:++string NewRole++
|
||||||
// Create NewUser object
|
// Create NewUser object
|
||||||
UserAccount<-SystemAccountManager:++new NewUser(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole,\nDateTime TimeStamp)++
|
UserAccount<-SystemAccountManager:++new NewUser(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole\nDateTime TimeStamp)++
|
||||||
activate UserAccount #CBC3E3
|
activate UserAccount #CBC3E3
|
||||||
UserAccount->UserAccount:++Constructor(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole,\nDateTime TimeStamp)++
|
UserAccount->UserAccount:++Constructor(\nstring NewUserName,\nstring NewPassword,\nstring New Email,\nstring NewRole\nDateTime TimeStamp)++
|
||||||
UserAccount-->SystemAccountManager:++return NewUser++
|
UserAccount-->SystemAccountManager:++return NewUser++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
SystemAccountManager->AccountService:++AccountService\n.UpdateUserRecord(user:NewUser,\nUpdateType: userUpdate)++
|
SystemAccountManager->AccountService:++AccountService\n.UpdateUserRecord(user:NewUser,\nUpdateType: userUpdate)++
|
||||||
@ -124,7 +122,7 @@ AccountService->SqlDAO:++SqlDAO\n.UpdateUserRecord(user:NewUser,\nUpdateType: us
|
|||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++isUser(user:NewUser)++
|
SqlDAO->SqlServer(MariaDB):++isUser(user:NewUser)++
|
||||||
activate SqlServer(MariaDB) #00FFFF
|
activate SqlServer(MariaDB) #00FFFF
|
||||||
SqlServer(MariaDB)->SqlServer(MariaDB):++Update *\nFrom Users\nwhere Username\n= @UserName and\nRole = @UserRole
|
SqlServer(MariaDB)->SqlServer(MariaDB):++Update *\nFrom Users\nwhere Username\n= @UserName OR\nemail = @Email++
|
||||||
group #red data store timed out #white
|
group #red data store timed out #white
|
||||||
SqlDAO<--SqlServer(MariaDB):++SqlException++
|
SqlDAO<--SqlServer(MariaDB):++SqlException++
|
||||||
deactivate SqlServer(MariaDB)
|
deactivate SqlServer(MariaDB)
|
||||||
@ -142,11 +140,11 @@ activate SqlServer(MariaDB) #00FFFF
|
|||||||
SqlDAO<--SqlServer(MariaDB):++ return True++
|
SqlDAO<--SqlServer(MariaDB):++ return True++
|
||||||
SqlDAO->SqlServer(MariaDB):++ SQL insert\nupdate credentials++
|
SqlDAO->SqlServer(MariaDB):++ SQL insert\nupdate credentials++
|
||||||
SqlDAO<--SqlServer(MariaDB):++ return 1++
|
SqlDAO<--SqlServer(MariaDB):++ return 1++
|
||||||
deactivate SqlServer(MariaDB)
|
|
||||||
AccountService<--SqlDAO:++return "User information updated successfully"++
|
AccountService<--SqlDAO:++return "User information updated successfully"++
|
||||||
SystemAccountManager<--AccountService:++return "User information updated successfully"++
|
SystemAccountManager<--AccountService:++return "User information updated successfully"++
|
||||||
Controller.cs<--SystemAccountManager:++return "User information updated successfully"++
|
Controller.cs<--SystemAccountManager:++return "User information updated successfully"++
|
||||||
User<--Controller.cs:++ return "User information\n updated successfully"++
|
User<--Controller.cs:++ return "User information\n updated successfully"++
|
||||||
|
deactivate SqlServer(MariaDB)
|
||||||
end
|
end
|
||||||
// User doesn't exist
|
// User doesn't exist
|
||||||
group #green User does not exist #white
|
group #green User does not exist #white
|
||||||
@ -154,14 +152,14 @@ activate SqlServer(MariaDB) #00FFFF
|
|||||||
SqlDAO<--SqlServer(MariaDB):++ return False++
|
SqlDAO<--SqlServer(MariaDB):++ return False++
|
||||||
SqlDAO->SqlServer(MariaDB):++ SQL insert\nuser credentials++
|
SqlDAO->SqlServer(MariaDB):++ SQL insert\nuser credentials++
|
||||||
SqlDAO<--SqlServer(MariaDB):++ return 1++
|
SqlDAO<--SqlServer(MariaDB):++ return 1++
|
||||||
deactivate SqlServer(MariaDB)
|
|
||||||
AccountService<--SqlDAO:++return "User is now registered"++
|
AccountService<--SqlDAO:++return "User is now registered"++
|
||||||
deactivate SqlDAO
|
|
||||||
SystemAccountManager<--AccountService:++return "User is now registered"++
|
SystemAccountManager<--AccountService:++return "User is now registered"++
|
||||||
deactivate AccountService
|
|
||||||
Controller.cs<--SystemAccountManager:++return "User is now registered"++
|
Controller.cs<--SystemAccountManager:++return "User is now registered"++
|
||||||
deactivate SystemAccountManager
|
|
||||||
User<--Controller.cs:++ return \n"User is now registered"++
|
User<--Controller.cs:++ return \n"User is now registered"++
|
||||||
|
deactivate AccountService
|
||||||
|
deactivate SqlDAO
|
||||||
|
deactivate SqlServer(MariaDB)
|
||||||
|
deactivate SystemAccountManager
|
||||||
deactivate Controller.cs
|
deactivate Controller.cs
|
||||||
end
|
end
|
||||||
//deactivate User
|
//deactivate User
|
||||||
@ -169,3 +167,4 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
BIN
doc/LowLevel/UserManagement/UserManagementEnableUser.png
Normal file
|
After Width: | Height: | Size: 464 KiB |
@ -1,4 +1,4 @@
|
|||||||
title Enable Specfied User
|
title Disable Specfied User
|
||||||
actor User
|
actor User
|
||||||
participant Controller.cs #90EE90
|
participant Controller.cs #90EE90
|
||||||
participant RDSFactory #26abff
|
participant RDSFactory #26abff
|
||||||
@ -29,7 +29,6 @@ end
|
|||||||
group #blue Data Store Online #white
|
group #blue Data Store Online #white
|
||||||
Controller.cs<--SqlDAO: ++return SqlDAO++
|
Controller.cs<--SqlDAO: ++return SqlDAO++
|
||||||
deactivate SqlDAO
|
deactivate SqlDAO
|
||||||
|
|
||||||
// Create new Admin
|
// Create new Admin
|
||||||
Controller.cs->SystemAccountManager:++ manager = new SystemAccountManager(IDataSource conn)++
|
Controller.cs->SystemAccountManager:++ manager = new SystemAccountManager(IDataSource conn)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
@ -49,21 +48,18 @@ activate UserAccount #CBC3E3
|
|||||||
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
UserAccount->UserAccount: ++Constructor(string username,\n string password,\n DateTime RegistrationTimeStamp)++
|
||||||
Controller.cs<--UserAccount:++New UserAccount++
|
Controller.cs<--UserAccount:++New UserAccount++
|
||||||
deactivate UserAccount
|
deactivate UserAccount
|
||||||
|
Controller.cs->SystemAccountManager:++manager.EnableUserRecord(user:UserAccount)++
|
||||||
activate SystemAccountManager #ffffe0
|
activate SystemAccountManager #ffffe0
|
||||||
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
SystemAccountManager->SystemAccountManager:++isInputValid(user: UserAccount)++
|
||||||
group #red Invalid Information #white
|
group #red Invalid Information #white
|
||||||
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
Controller.cs<--SystemAccountManager:++return "Invalid input"++
|
||||||
User<--Controller.cs:++ return "Invalid input"++
|
User<--Controller.cs:++ return "Invalid input"++
|
||||||
end
|
end
|
||||||
Controller.cs<--SystemAccountManager:++return true++
|
|
||||||
deactivate SystemAccountManager
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Controller.cs->SystemAccountManager:++manager.EnableUserRecord(user:UserAccount)++
|
|
||||||
|
|
||||||
|
group #green Information Valid #white
|
||||||
//check if there is an admin user
|
//check if there is an admin user
|
||||||
activate SystemAccountManager #ffffe0
|
|
||||||
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
SystemAccountManager->SqlDAO:++isAdmin(user:UserAccount)++
|
||||||
activate SqlDAO #D3D3D3
|
activate SqlDAO #D3D3D3
|
||||||
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
SqlDAO->SqlServer(MariaDB):++SqlRead confirmAdmin()++
|
||||||
@ -159,3 +155,4 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||