diff options
| author | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
| commit | cdc61eb4ea5309769ad4db84d92594e4dc3dff67 (patch) | |
| tree | a8297a7aecc4376f07a497a5e02ab5ff165bfbd3 /Project-Unite/Views/Admin | |
| parent | d9f475e1f33bbf39ca0d79d7a6b0c2fd501b4f2d (diff) | |
| download | project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.gz project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.bz2 project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.zip | |
Initial commit (azure deploy test)
Diffstat (limited to 'Project-Unite/Views/Admin')
| -rw-r--r-- | Project-Unite/Views/Admin/AccessControl.cshtml | 59 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/AddForumCategory.cshtml | 48 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/AddUserToRole.cshtml | 24 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/CreateRole.cshtml | 59 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/DeleteRole.cshtml | 48 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/EditForum.cshtml | 51 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/EditRole.cshtml | 619 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/Forums.cshtml | 49 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/Index.cshtml | 7 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/Logs.cshtml | 25 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/RoleDetails.cshtml | 44 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/Roles.cshtml | 65 | ||||
| -rw-r--r-- | Project-Unite/Views/Admin/Users.cshtml | 45 |
13 files changed, 1143 insertions, 0 deletions
diff --git a/Project-Unite/Views/Admin/AccessControl.cshtml b/Project-Unite/Views/Admin/AccessControl.cshtml new file mode 100644 index 0000000..8d51d54 --- /dev/null +++ b/Project-Unite/Views/Admin/AccessControl.cshtml @@ -0,0 +1,59 @@ +@model Project_Unite.Models.AdminAccessControlViewModel + + +@{ + ViewBag.Title = "Access control"; + + Dictionary<string, string> EnumNames = new Dictionary<string, string> { + { "None", "No permissions" }, + { "CanRead", "Read only" }, + { "CanPost", "Can post new topics" }, + {"CanReply", "Can reply" } + }; + + var availablePermissions = new List<SelectListItem>(); + foreach (var v in Enum.GetValues(typeof(Project_Unite.Models.PermissionPreset))) + { + availablePermissions.Add(new SelectListItem + { + Value = v.ToString(), + Text = EnumNames[v.ToString()] + }); + } + +} + +<h2>Access control</h2> + +<p>Below, you can modify the access control list (ACL) definitions for all forum categories.</p> + + @foreach (var key in Model.IDs) + { + <h4>@key</h4> + <table class="table"> + <tr> + <th>Role ID</th> + <th>Value</th> + </tr> + @foreach (var p in Model.ACLList.Where(x => x.CategoryId == key)) + { + <tr> + <td>@Html.DisplayFor(v => p.RoleId)</td> + <td> + @foreach(var r in EnumNames) + { + if(r.Key == p.Permissions.ToString()) + { + <a href="#" class="btn btn-primary">@r.Value</a> + } + else + { + @Html.ActionLink(r.Value, "SetPermission", "Admin", new { id=p.CategoryId, role=p.RoleId, permission=r.Key}, new { @class = "btn btn-default" }) + } + } + </td> + </tr> + } + </table> + + }
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/AddForumCategory.cshtml b/Project-Unite/Views/Admin/AddForumCategory.cshtml new file mode 100644 index 0000000..4b3e9fd --- /dev/null +++ b/Project-Unite/Views/Admin/AddForumCategory.cshtml @@ -0,0 +1,48 @@ +@model Project_Unite.Models.AddForumCategoryViewModel +@{ + ViewBag.Title = "Add forum category"; +} + +<h2>Add forum category</h2> + +<p>This page allows you to add a new forum category to ShiftOS and define a set of ACL rules for this category.</p> + +<div class="panel panel-danger"> + @if(ViewBag.Error != null) + { + <p><span class="glyphicon glyphicon-warning-sign"></span> @ViewBag.Error</p> + } +</div> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.PossibleParents) + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Name)</td> + <td>@Html.TextBoxFor(Model => Model.Name)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Description)</td> + <td>@Html.TextBoxFor(Model => Model.Description)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Parent)</td> + <td>@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)</td> + </tr> + </table> + + <h4>ACL rule definitions</h4> + <p>ACL rules for this forum can be edited in the Access Control section. Additionally, you can select an existing forum to copy ACL data from.</p> + + <p><strong>Copy ACL data from: </strong>@Html.DropDownListFor(Model=>Model.StealPermissionsFrom, Model.PossibleParents)</p> + <p>Leave this value as "Top Level" to not copy permissions. Default permission values are 'Can Post' for all roles.</p> + <h4>Adding new roles</h4> + <p>When you add a new role to the site, the ACL system will automatically add it to this forum, however its permission data will be set to the default "Can Post" value.</p> + <hr/> + + + <input type="submit" value="Add" class="btn btn-primary" /> + @Html.ActionLink("Cancel", "Forums", "Admin", null, new { @class="btn btn-default"}) +}
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/AddUserToRole.cshtml b/Project-Unite/Views/Admin/AddUserToRole.cshtml new file mode 100644 index 0000000..386507c --- /dev/null +++ b/Project-Unite/Views/Admin/AddUserToRole.cshtml @@ -0,0 +1,24 @@ +@model Project_Unite.Models.AddUserToRoleViewModel + +@{ + ViewBag.Title = "Add user to role"; +} + +<h2>Add user to role</h2> + +@using (Html.BeginForm()) +{ + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(model => model.Username)</td> + <td>@Html.TextBoxFor(model => model.Username)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(model => model.RoleId)</td> + <td>@Html.TextBoxFor(model => model.RoleId)</td> + </tr> + + </table> + <input type="submit" class="btn btn-primary" value="Add" /> +} + diff --git a/Project-Unite/Views/Admin/CreateRole.cshtml b/Project-Unite/Views/Admin/CreateRole.cshtml new file mode 100644 index 0000000..736f09d --- /dev/null +++ b/Project-Unite/Views/Admin/CreateRole.cshtml @@ -0,0 +1,59 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Create"; +} + +<h2>Create</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + + <div class="form-horizontal"> + <h4>Role</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + <div class="form-group"> + @Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Create" class="btn btn-default" /> + </div> + </div> + </div> +} + +<div> + @Html.ActionLink("Back to List", "Index") +</div> diff --git a/Project-Unite/Views/Admin/DeleteRole.cshtml b/Project-Unite/Views/Admin/DeleteRole.cshtml new file mode 100644 index 0000000..2344d1d --- /dev/null +++ b/Project-Unite/Views/Admin/DeleteRole.cshtml @@ -0,0 +1,48 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Delete"; +} + +<h2>Delete</h2> + +<h3>Are you sure you want to delete this?</h3> +<div> + <h4>Role</h4> + <hr /> + <dl class="dl-horizontal"> + <dt> + @Html.DisplayNameFor(model => model.Name) + </dt> + + <dd> + @Html.DisplayFor(model => model.Name) + </dd> + + <dt> + @Html.DisplayNameFor(model => model.Description) + </dt> + + <dd> + @Html.DisplayFor(model => model.Description) + </dd> + + <dt> + @Html.DisplayNameFor(model => model.ColorHex) + </dt> + + <dd> + @Html.DisplayFor(model => model.ColorHex) + </dd> + + </dl> + + @using (Html.BeginForm()) { + @Html.AntiForgeryToken() + + <div class="form-actions no-color"> + <input type="submit" value="Delete" class="btn btn-default" /> | + @Html.ActionLink("Back to List", "Index") + </div> + } +</div> diff --git a/Project-Unite/Views/Admin/EditForum.cshtml b/Project-Unite/Views/Admin/EditForum.cshtml new file mode 100644 index 0000000..af22f81 --- /dev/null +++ b/Project-Unite/Views/Admin/EditForum.cshtml @@ -0,0 +1,51 @@ +@model Project_Unite.Models.AddForumCategoryViewModel +@{ + ViewBag.Title = "Edit " + Model.Name; +} + +<h2>Add forum category</h2> + +<div class="panel panel-danger"> + @if (ViewBag.Error != null) + { + <p><span class="glyphicon glyphicon-warning-sign"></span> @ViewBag.Error</p> + } +</div> + +@using (Html.BeginForm(new { id = Model.Id })) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Id) + @Html.HiddenFor(Model => Model.PossibleParents) + <table class="table-condensed"> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Name)</td> + <td>@Html.TextBoxFor(Model => Model.Name)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Description)</td> + <td>@Html.TextBoxFor(Model => Model.Description)</td> + </tr> + <tr> + <td>@Html.DisplayNameFor(Model => Model.Parent)</td> + <td>@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)</td> + </tr> + </table> + + <h4>ACL rule definitions</h4> + <p>Below you can specify what roles can see, reply or post to this category.</p> + <hr /> + + <table class="table-condensed"> + <tr> + <th>Role name</th> + <th>Can see?</th> + <th>Can reply?</th> + <th>Can post?</th> + </tr> + </table> + <p>ACL rules for this forum may be altered in the "Forum ACL Editor" page.</p> + + <input type="submit" value="Add" class="btn btn-primary" /> + @Html.ActionLink("Cancel", "Forums", "Admin", null, new { @class = "btn btn-default" }) +}
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/EditRole.cshtml b/Project-Unite/Views/Admin/EditRole.cshtml new file mode 100644 index 0000000..b9c1f91 --- /dev/null +++ b/Project-Unite/Views/Admin/EditRole.cshtml @@ -0,0 +1,619 @@ +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Edit role: " + Model.Id; +} + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + + <div class="form-horizontal"> + <h4>Role</h4> + <hr /> + @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + @Html.HiddenFor(model => model.Id) + + <div class="form-group"> + @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.Priority, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Priority, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Priority, "", new { @class = "text-danger" }) + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanViewProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanViewProfiles) + @Html.ValidationMessageFor(model => model.CanViewProfiles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnProfile, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnProfile) + @Html.ValidationMessageFor(model => model.CanEditOwnProfile, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditProfiles) + @Html.ValidationMessageFor(model => model.CanEditProfiles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditUsername, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditUsername) + @Html.ValidationMessageFor(model => model.CanEditUsername, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditUsernames, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditUsernames) + @Html.ValidationMessageFor(model => model.CanEditUsernames, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueBan) + @Html.ValidationMessageFor(model => model.CanIssueBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueIPBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueIPBan) + @Html.ValidationMessageFor(model => model.CanIssueIPBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueEmailBan, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueEmailBan) + @Html.ValidationMessageFor(model => model.CanIssueEmailBan, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanIssueMute, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanIssueMute) + @Html.ValidationMessageFor(model => model.CanIssueMute, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanReleaseBuild, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanReleaseBuild) + @Html.ValidationMessageFor(model => model.CanReleaseBuild, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanBlog, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanBlog) + @Html.ValidationMessageFor(model => model.CanBlog, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessModCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessModCP) + @Html.ValidationMessageFor(model => model.CanAccessModCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessAdminCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessAdminCP) + @Html.ValidationMessageFor(model => model.CanAccessAdminCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAccessDevCP, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAccessDevCP) + @Html.ValidationMessageFor(model => model.CanAccessDevCP, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditForumCategories, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditForumCategories) + @Html.ValidationMessageFor(model => model.CanEditForumCategories, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostTopics) + @Html.ValidationMessageFor(model => model.CanPostTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostPolls, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostPolls) + @Html.ValidationMessageFor(model => model.CanPostPolls, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostReplies, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostReplies) + @Html.ValidationMessageFor(model => model.CanPostReplies, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostStatuses) + @Html.ValidationMessageFor(model => model.CanPostStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditRoles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditRoles) + @Html.ValidationMessageFor(model => model.CanEditRoles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteRoles, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteRoles) + @Html.ValidationMessageFor(model => model.CanDeleteRoles, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnTopics) + @Html.ValidationMessageFor(model => model.CanDeleteOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteTopics) + @Html.ValidationMessageFor(model => model.CanDeleteTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnPosts) + @Html.ValidationMessageFor(model => model.CanDeleteOwnPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeletePosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeletePosts) + @Html.ValidationMessageFor(model => model.CanDeletePosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteOwnStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnTopics) + @Html.ValidationMessageFor(model => model.CanEditOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditTopics) + @Html.ValidationMessageFor(model => model.CanEditTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnPosts) + @Html.ValidationMessageFor(model => model.CanEditOwnPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditPosts, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditPosts) + @Html.ValidationMessageFor(model => model.CanEditPosts, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnStatuses) + @Html.ValidationMessageFor(model => model.CanEditOwnStatuses, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanVoteInPolls, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanVoteInPolls) + @Html.ValidationMessageFor(model => model.CanVoteInPolls, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteUsers, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteUsers) + @Html.ValidationMessageFor(model => model.CanDeleteUsers, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnonymizeUsers, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnonymizeUsers) + @Html.ValidationMessageFor(model => model.CanAnonymizeUsers, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanPostSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanPostSkins) + @Html.ValidationMessageFor(model => model.CanPostSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditOwnSkins) + @Html.ValidationMessageFor(model => model.CanEditOwnSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanEditSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanEditSkins) + @Html.ValidationMessageFor(model => model.CanEditSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteOwnSkins) + @Html.ValidationMessageFor(model => model.CanDeleteOwnSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDeleteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDeleteSkins) + @Html.ValidationMessageFor(model => model.CanDeleteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUpvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUpvoteSkins) + @Html.ValidationMessageFor(model => model.CanUpvoteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanDownvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanDownvoteSkins) + @Html.ValidationMessageFor(model => model.CanDownvoteSkins, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanStickyOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanStickyOwnTopics) + @Html.ValidationMessageFor(model => model.CanStickyOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanStickyTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanStickyTopics) + @Html.ValidationMessageFor(model => model.CanStickyTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnnounceOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnnounceOwnTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanAnnounceTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanAnnounceTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanGlobalOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanGlobalOwnTopics) + @Html.ValidationMessageFor(model => model.CanGlobalOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanGlobalTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanGlobalTopics) + @Html.ValidationMessageFor(model => model.CanGlobalTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanMoveOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanMoveOwnTopics) + @Html.ValidationMessageFor(model => model.CanMoveOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanMoveTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanMoveTopics) + @Html.ValidationMessageFor(model => model.CanMoveTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlistOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlistOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlistOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlistTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlistTopics) + @Html.ValidationMessageFor(model => model.CanUnlistTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanLockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanLockOwnTopics) + @Html.ValidationMessageFor(model => model.CanLockOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlockOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlockOwnTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanLockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanLockTopics) + @Html.ValidationMessageFor(model => model.CanLockTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + @Html.LabelFor(model => model.CanUnlockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + <div class="checkbox"> + @Html.EditorFor(model => model.CanUnlockTopics) + @Html.ValidationMessageFor(model => model.CanUnlockTopics, "", new { @class = "text-danger" }) + </div> + </div> + </div> + + <div class="form-group"> + <div class="col-md-offset-2 col-md-10"> + <input type="submit" value="Save" class="btn btn-default" /> + </div> + </div> + </div> +} + +<div> + @Html.ActionLink("Back to List", "Index") +</div> diff --git a/Project-Unite/Views/Admin/Forums.cshtml b/Project-Unite/Views/Admin/Forums.cshtml new file mode 100644 index 0000000..904e3c5 --- /dev/null +++ b/Project-Unite/Views/Admin/Forums.cshtml @@ -0,0 +1,49 @@ +@model IEnumerable<Project_Unite.Models.ForumCategory> +@{ + ViewBag.Title = "Manage forums"; + ViewBag.Modals = new Dictionary<string, string>(); +} + +<h2>Forums</h2> + +<p>The forums are a way for users to start conversations about various topics. Here you can define where users can post and what roles can post where.</p> + +@foreach (var cat in Model) +{ + <table class="table"> + <tr> + <th>@cat.Name [@Html.ActionLink("Edit", "EditForum", "Admin", new { id = cat.Id }, null) | <a href="#[email protected]" data-toggle="modal" data-target="#[email protected]">Delete</a>] + <!-- Modal --> + + </th> + <th>Topics</th> + <th>Posts</th> + <th>Actions</th> + </tr> + @foreach (var subcat in cat.Children) + { + <tr> + <td> + @Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }) <br /> + <p>@subcat.Description</p> + </td> + <td>@subcat.Topics?.Count</td> + <td></td> + <td> + @Html.ActionLink("Edit", "EditForum", "Admin", new { id = subcat.Id }, new { @class = "btn btn-default" }) + + <!-- Trigger the modal with a button --> + <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#[email protected]">Delete</button> + + + </td> + </tr> + ViewBag.Modals.Add(subcat.Id, "/Admin/DeleteForum?id=" + subcat.Id); + } + + </table> + ViewBag.Modals.Add(cat.Id, "/Admin/DeleteForum?id=" + cat.Id); + +} + [email protected]("Add category", "AddForumCategory", "Admin", null, new { @class = "btn btn-default"}) diff --git a/Project-Unite/Views/Admin/Index.cshtml b/Project-Unite/Views/Admin/Index.cshtml new file mode 100644 index 0000000..d282f60 --- /dev/null +++ b/Project-Unite/Views/Admin/Index.cshtml @@ -0,0 +1,7 @@ + +@{ + ViewBag.Title = "Administration Control Panel"; +} + +<p>Wow, an actual index page.</p> + diff --git a/Project-Unite/Views/Admin/Logs.cshtml b/Project-Unite/Views/Admin/Logs.cshtml new file mode 100644 index 0000000..3fa066d --- /dev/null +++ b/Project-Unite/Views/Admin/Logs.cshtml @@ -0,0 +1,25 @@ +@model IEnumerable<Project_Unite.Models.AuditLog> +@{ + ViewBag.Admin = true; + ViewBag.Title = "Audit logs"; +} + +<h2>Audit logs</h2> + +<p>Below is a list of all actions carried out by all users on this site.</p> + +<table class="table"> + <tr> + <th style="width:65%">Action</th> + <th>User & Timestamp</th> + <th>Level</th> + </tr> + @foreach(var i in Model.OrderByDescending(x=>x.Timestamp)) + { + <tr> + <td>@i.Description</td> + <td>@Html.UserLink(i.UserId) at @i.Timestamp</td> + <td>@i.Level</td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/RoleDetails.cshtml b/Project-Unite/Views/Admin/RoleDetails.cshtml new file mode 100644 index 0000000..25b4146 --- /dev/null +++ b/Project-Unite/Views/Admin/RoleDetails.cshtml @@ -0,0 +1,44 @@ +@using Microsoft.AspNet.Identity + +@model Project_Unite.Models.Role + +@{ + ViewBag.Title = "Details for " + Model.Name; +} + +<h2>Role details</h2> + + <h4 style="color:@Model.ColorHex">@Model.Name</h4> + <p><strong>ID: </strong>@Model.Id</p> + <p><strong>Description:</strong></p> + <p>@Model.Description</p> + <p><strong>Priority: </strong>@Model.Priority</p> + +<hr/> + +<h2>Users</h2> + +<p>Below is a list of users in this role.</p> + +<table class="table"> + <tr> + <th style="width:65%">User</th> + <th>Actions</th> + </tr> + @foreach(var user in Model.Users) + { + <tr> + <td>@Html.UserLink(user.UserId)</td> + <td> + @if(User.Identity.GetUserId() != user.UserId) + { + @Html.ActionLink("Remove", "RemoveUserFromRole", "Admin", new { id = user.RoleId, usr = user.UserId}, new { @class="btn btn-danger"}) + + } + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.UserId }, new { @class = "btn btn-default" }) + + + </td> + </tr> + } +</table>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/Roles.cshtml b/Project-Unite/Views/Admin/Roles.cshtml new file mode 100644 index 0000000..0c490f2 --- /dev/null +++ b/Project-Unite/Views/Admin/Roles.cshtml @@ -0,0 +1,65 @@ +@model IEnumerable<Project_Unite.Models.Role> + +@{ + ViewBag.Title = "Administrator Control Panel"; +} + +<h2>Roles</h2> + +<p> + @Html.ActionLink("Create New", "CreateRole") +</p> +<table class="table"> + <tr> + <th style="width:65%"> + Role + </th> + <th>Priority</th> + <th>Actions</th> + </tr> + +@foreach (var item in Model.OrderByDescending(x=>x.Priority)) { + if (ACL.CanManageRole(User.Identity.Name, item.Id)) + { + <tr> + <td> + <strong style="color:@item.ColorHex">@Html.DisplayFor(modelItem => item.Name)</strong> (@Html.DisplayFor(modelItem => item.Id)) + <p>@Html.DisplayFor(modelItem => item.Description)</p> + </td> + <td> + @item.Priority + @if (item.Priority < Model.Count() - 1) + { + <a href="@Url.Action("RaisePriority", "Admin", new { id = item.Id })" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></a> + } + @if (item.Priority > 0) + { + <a href="@Url.Action("LowerPriority", "Admin", new { id = item.Id })" class="btn btn-default"><span class="glyphicon glyphicon-arrow-down"></span></a> + } + + </td> + <td> + @Html.ActionLink("Edit", "EditRole", new { id = item.Id }, new { @class = "btn btn-default" }) + @Html.ActionLink("Details", "RoleDetails", new { id = item.Id }, new { @class = "btn btn-default" }) + @if (ACL.Granted(User.Identity.Name, "CanDeleteRoles")) + { + @Html.ActionLink("Delete", "DeleteRole", new { id = item.Id }, new { @class = "btn btn-danger" }) + } + </td> + </tr> + } +} + +</table> + +<hr/> + +<h4>Role priorities</h4> + +<p>ShiftOS users can have multiple roles at once - and me, Michael, as a programmer, had to find a way to get the user's most granting role - the one with the most permissions. Since this could change at any time (new roles, new permission definitions, etc) I needed a way to arbitrarily determine what the best role to use when determining what users can and can't do.</p> + +<p>So, I set up a role priority system. You can use the buttons above to modify a role's priority. The role listing will display all roles on the site, sorted by priority, from highest to lowest. The highest-priority role assigned to a user will determine the color of their username and the permissions they are given. It will also determine what roles the user can modify - we don't want developers messing up admin permissions, do we?</p> + +<p>You will only see roles on this page that you have permission to alter.</p> + +<p>Also, the lowest-priority role in the system will become the role of all future users - so don't be giving it admin privileges, pretty please.</p>
\ No newline at end of file diff --git a/Project-Unite/Views/Admin/Users.cshtml b/Project-Unite/Views/Admin/Users.cshtml new file mode 100644 index 0000000..a9830c5 --- /dev/null +++ b/Project-Unite/Views/Admin/Users.cshtml @@ -0,0 +1,45 @@ +@model IEnumerable<Project_Unite.Models.ApplicationUser> +@{ + ViewBag.Admin = true; + ViewBag.Title = "Users"; +} + +<h2>Users</h2> + +<p>Below is a list of all users in the database.</p> + +<table class="table"> + <tr> + <th style="width:85%">User</th> + <th>Actions</th> + </tr> + @foreach (var user in Model) + { + <tr> + <td>@Html.UserLink(user.Id)</td> + <td> + + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.DisplayName }, new { @class = "btn btn-default" }) + @if (ACL.Granted(User.Identity.Name, "CanAnonymizeUser")) + { + <a href="#" class="btn btn-danger" data-toggle="modal" data-target="#u_anonymize"><span class="glyphicon glyphicon-warning-sign"></span> Anonymize this user</a> + <div class="modal fade in"> + <div class="modal-content" id="#u_anonymize"> + <div class="modal-header"> + <a class="close" data-dissmiss="modal"></a> + <h2>Anonymize user</h2> + </div> + <div class="modal-body"> + <p>Anonymizing this user will prevent them from ever logging in, and will purge their profile data. Continue?</p> + </div> + <div class="modal-footer"> + <a class="btn btn-default" data-dismiss="modal">No</a> + @Html.ActionLink("Yes", "AnonymizeUser", "Admin", new { id = user.Id }, new { @class = "btn btn-danger" }) + </div> + </div> + </div> + } + </td> + </tr> + } +</table>
\ No newline at end of file |
