From cdc61eb4ea5309769ad4db84d92594e4dc3dff67 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 20 Mar 2017 16:45:17 -0400 Subject: Initial commit (azure deploy test) --- Project-Unite/Views/Admin/AccessControl.cshtml | 59 +++ Project-Unite/Views/Admin/AddForumCategory.cshtml | 48 ++ Project-Unite/Views/Admin/AddUserToRole.cshtml | 24 + Project-Unite/Views/Admin/CreateRole.cshtml | 59 +++ Project-Unite/Views/Admin/DeleteRole.cshtml | 48 ++ Project-Unite/Views/Admin/EditForum.cshtml | 51 ++ Project-Unite/Views/Admin/EditRole.cshtml | 619 ++++++++++++++++++++++ Project-Unite/Views/Admin/Forums.cshtml | 49 ++ Project-Unite/Views/Admin/Index.cshtml | 7 + Project-Unite/Views/Admin/Logs.cshtml | 25 + Project-Unite/Views/Admin/RoleDetails.cshtml | 44 ++ Project-Unite/Views/Admin/Roles.cshtml | 65 +++ Project-Unite/Views/Admin/Users.cshtml | 45 ++ 13 files changed, 1143 insertions(+) create mode 100644 Project-Unite/Views/Admin/AccessControl.cshtml create mode 100644 Project-Unite/Views/Admin/AddForumCategory.cshtml create mode 100644 Project-Unite/Views/Admin/AddUserToRole.cshtml create mode 100644 Project-Unite/Views/Admin/CreateRole.cshtml create mode 100644 Project-Unite/Views/Admin/DeleteRole.cshtml create mode 100644 Project-Unite/Views/Admin/EditForum.cshtml create mode 100644 Project-Unite/Views/Admin/EditRole.cshtml create mode 100644 Project-Unite/Views/Admin/Forums.cshtml create mode 100644 Project-Unite/Views/Admin/Index.cshtml create mode 100644 Project-Unite/Views/Admin/Logs.cshtml create mode 100644 Project-Unite/Views/Admin/RoleDetails.cshtml create mode 100644 Project-Unite/Views/Admin/Roles.cshtml create mode 100644 Project-Unite/Views/Admin/Users.cshtml (limited to 'Project-Unite/Views/Admin') 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 EnumNames = new Dictionary { + { "None", "No permissions" }, + { "CanRead", "Read only" }, + { "CanPost", "Can post new topics" }, + {"CanReply", "Can reply" } + }; + + var availablePermissions = new List(); + foreach (var v in Enum.GetValues(typeof(Project_Unite.Models.PermissionPreset))) + { + availablePermissions.Add(new SelectListItem + { + Value = v.ToString(), + Text = EnumNames[v.ToString()] + }); + } + +} + +

Access control

+ +

Below, you can modify the access control list (ACL) definitions for all forum categories.

+ + @foreach (var key in Model.IDs) + { +

@key

+ + + + + + @foreach (var p in Model.ACLList.Where(x => x.CategoryId == key)) + { + + + + + } +
Role IDValue
@Html.DisplayFor(v => p.RoleId) + @foreach(var r in EnumNames) + { + if(r.Key == p.Permissions.ToString()) + { + @r.Value + } + else + { + @Html.ActionLink(r.Value, "SetPermission", "Admin", new { id=p.CategoryId, role=p.RoleId, permission=r.Key}, new { @class = "btn btn-default" }) + } + } +
+ + } \ 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"; +} + +

Add forum category

+ +

This page allows you to add a new forum category to ShiftOS and define a set of ACL rules for this category.

+ +
+ @if(ViewBag.Error != null) + { +

@ViewBag.Error

+ } +
+ +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.PossibleParents) + + + + + + + + + + + + + +
@Html.DisplayNameFor(Model => Model.Name)@Html.TextBoxFor(Model => Model.Name)
@Html.DisplayNameFor(Model => Model.Description)@Html.TextBoxFor(Model => Model.Description)
@Html.DisplayNameFor(Model => Model.Parent)@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)
+ +

ACL rule definitions

+

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.

+ +

Copy ACL data from: @Html.DropDownListFor(Model=>Model.StealPermissionsFrom, Model.PossibleParents)

+

Leave this value as "Top Level" to not copy permissions. Default permission values are 'Can Post' for all roles.

+

Adding new roles

+

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.

+
+ + + + @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"; +} + +

Add user to role

+ +@using (Html.BeginForm()) +{ + + + + + + + + + + +
@Html.DisplayNameFor(model => model.Username)@Html.TextBoxFor(model => model.Username)
@Html.DisplayNameFor(model => model.RoleId)@Html.TextBoxFor(model => model.RoleId)
+ +} + 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"; +} + +

Create

+ +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + +
+

Role

+
+ @Html.ValidationSummary(true, "", new { @class = "text-danger" }) +
+ @Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) +
+
+ +
+
+ +
+
+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
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"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Role

+
+
+
+ @Html.DisplayNameFor(model => model.Name) +
+ +
+ @Html.DisplayFor(model => model.Name) +
+ +
+ @Html.DisplayNameFor(model => model.Description) +
+ +
+ @Html.DisplayFor(model => model.Description) +
+ +
+ @Html.DisplayNameFor(model => model.ColorHex) +
+ +
+ @Html.DisplayFor(model => model.ColorHex) +
+ +
+ + @using (Html.BeginForm()) { + @Html.AntiForgeryToken() + +
+ | + @Html.ActionLink("Back to List", "Index") +
+ } +
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; +} + +

Add forum category

+ +
+ @if (ViewBag.Error != null) + { +

@ViewBag.Error

+ } +
+ +@using (Html.BeginForm(new { id = Model.Id })) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Id) + @Html.HiddenFor(Model => Model.PossibleParents) + + + + + + + + + + + + + +
@Html.DisplayNameFor(Model => Model.Name)@Html.TextBoxFor(Model => Model.Name)
@Html.DisplayNameFor(Model => Model.Description)@Html.TextBoxFor(Model => Model.Description)
@Html.DisplayNameFor(Model => Model.Parent)@Html.DropDownListFor(Model => Model.Parent, Model.PossibleParents)
+ +

ACL rule definitions

+

Below you can specify what roles can see, reply or post to this category.

+
+ + + + + + + + +
Role nameCan see?Can reply?Can post?
+

ACL rules for this forum may be altered in the "Forum ACL Editor" page.

+ + + @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() + +
+

Role

+
+ @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + @Html.HiddenFor(model => model.Id) + +
+ @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.ColorHex, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.ColorHex, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.ColorHex, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.Priority, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Priority, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Priority, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.CanViewProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanViewProfiles) + @Html.ValidationMessageFor(model => model.CanViewProfiles, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditOwnProfile, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditOwnProfile) + @Html.ValidationMessageFor(model => model.CanEditOwnProfile, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditProfiles, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditProfiles) + @Html.ValidationMessageFor(model => model.CanEditProfiles, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditUsername, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditUsername) + @Html.ValidationMessageFor(model => model.CanEditUsername, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditUsernames, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditUsernames) + @Html.ValidationMessageFor(model => model.CanEditUsernames, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanIssueBan, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanIssueBan) + @Html.ValidationMessageFor(model => model.CanIssueBan, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanIssueIPBan, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanIssueIPBan) + @Html.ValidationMessageFor(model => model.CanIssueIPBan, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanIssueEmailBan, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanIssueEmailBan) + @Html.ValidationMessageFor(model => model.CanIssueEmailBan, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanIssueMute, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanIssueMute) + @Html.ValidationMessageFor(model => model.CanIssueMute, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanReleaseBuild, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanReleaseBuild) + @Html.ValidationMessageFor(model => model.CanReleaseBuild, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanBlog, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanBlog) + @Html.ValidationMessageFor(model => model.CanBlog, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAccessModCP, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAccessModCP) + @Html.ValidationMessageFor(model => model.CanAccessModCP, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAccessAdminCP, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAccessAdminCP) + @Html.ValidationMessageFor(model => model.CanAccessAdminCP, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAccessDevCP, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAccessDevCP) + @Html.ValidationMessageFor(model => model.CanAccessDevCP, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditForumCategories, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditForumCategories) + @Html.ValidationMessageFor(model => model.CanEditForumCategories, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanPostTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanPostTopics) + @Html.ValidationMessageFor(model => model.CanPostTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanPostPolls, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanPostPolls) + @Html.ValidationMessageFor(model => model.CanPostPolls, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanPostReplies, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanPostReplies) + @Html.ValidationMessageFor(model => model.CanPostReplies, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanPostStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanPostStatuses) + @Html.ValidationMessageFor(model => model.CanPostStatuses, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditRoles, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditRoles) + @Html.ValidationMessageFor(model => model.CanEditRoles, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteRoles, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteRoles) + @Html.ValidationMessageFor(model => model.CanDeleteRoles, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteOwnTopics) + @Html.ValidationMessageFor(model => model.CanDeleteOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteTopics) + @Html.ValidationMessageFor(model => model.CanDeleteTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteOwnPosts) + @Html.ValidationMessageFor(model => model.CanDeleteOwnPosts, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeletePosts, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeletePosts) + @Html.ValidationMessageFor(model => model.CanDeletePosts, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteOwnStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteOwnStatuses, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteStatuses) + @Html.ValidationMessageFor(model => model.CanDeleteStatuses, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditOwnTopics) + @Html.ValidationMessageFor(model => model.CanEditOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditTopics) + @Html.ValidationMessageFor(model => model.CanEditTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditOwnPosts, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditOwnPosts) + @Html.ValidationMessageFor(model => model.CanEditOwnPosts, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditPosts, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditPosts) + @Html.ValidationMessageFor(model => model.CanEditPosts, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditOwnStatuses, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditOwnStatuses) + @Html.ValidationMessageFor(model => model.CanEditOwnStatuses, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanVoteInPolls, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanVoteInPolls) + @Html.ValidationMessageFor(model => model.CanVoteInPolls, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteUsers, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteUsers) + @Html.ValidationMessageFor(model => model.CanDeleteUsers, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAnonymizeUsers, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAnonymizeUsers) + @Html.ValidationMessageFor(model => model.CanAnonymizeUsers, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanPostSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanPostSkins) + @Html.ValidationMessageFor(model => model.CanPostSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditOwnSkins) + @Html.ValidationMessageFor(model => model.CanEditOwnSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanEditSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanEditSkins) + @Html.ValidationMessageFor(model => model.CanEditSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteOwnSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteOwnSkins) + @Html.ValidationMessageFor(model => model.CanDeleteOwnSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDeleteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDeleteSkins) + @Html.ValidationMessageFor(model => model.CanDeleteSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanUpvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanUpvoteSkins) + @Html.ValidationMessageFor(model => model.CanUpvoteSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanDownvoteSkins, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanDownvoteSkins) + @Html.ValidationMessageFor(model => model.CanDownvoteSkins, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanStickyOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanStickyOwnTopics) + @Html.ValidationMessageFor(model => model.CanStickyOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanStickyTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanStickyTopics) + @Html.ValidationMessageFor(model => model.CanStickyTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAnnounceOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAnnounceOwnTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanAnnounceTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanAnnounceTopics) + @Html.ValidationMessageFor(model => model.CanAnnounceTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanGlobalOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanGlobalOwnTopics) + @Html.ValidationMessageFor(model => model.CanGlobalOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanGlobalTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanGlobalTopics) + @Html.ValidationMessageFor(model => model.CanGlobalTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanMoveOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanMoveOwnTopics) + @Html.ValidationMessageFor(model => model.CanMoveOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanMoveTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanMoveTopics) + @Html.ValidationMessageFor(model => model.CanMoveTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanUnlistOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanUnlistOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlistOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanUnlistTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanUnlistTopics) + @Html.ValidationMessageFor(model => model.CanUnlistTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanLockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanLockOwnTopics) + @Html.ValidationMessageFor(model => model.CanLockOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanUnlockOwnTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanUnlockOwnTopics) + @Html.ValidationMessageFor(model => model.CanUnlockOwnTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanLockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanLockTopics) + @Html.ValidationMessageFor(model => model.CanLockTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+ @Html.LabelFor(model => model.CanUnlockTopics, htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ @Html.EditorFor(model => model.CanUnlockTopics) + @Html.ValidationMessageFor(model => model.CanUnlockTopics, "", new { @class = "text-danger" }) +
+
+
+ +
+
+ +
+
+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
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 +@{ + ViewBag.Title = "Manage forums"; + ViewBag.Modals = new Dictionary(); +} + +

Forums

+ +

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.

+ +@foreach (var cat in Model) +{ + + + + + + + + @foreach (var subcat in cat.Children) + { + + + + + + + ViewBag.Modals.Add(subcat.Id, "/Admin/DeleteForum?id=" + subcat.Id); + } + +
@cat.Name [@Html.ActionLink("Edit", "EditForum", "Admin", new { id = cat.Id }, null) | Delete] + + + TopicsPostsActions
+ @Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id })
+

@subcat.Description

+
@subcat.Topics?.Count + @Html.ActionLink("Edit", "EditForum", "Admin", new { id = subcat.Id }, new { @class = "btn btn-default" }) + + + + + +
+ ViewBag.Modals.Add(cat.Id, "/Admin/DeleteForum?id=" + cat.Id); + +} + +@Html.ActionLink("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"; +} + +

Wow, an actual index page.

+ 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 +@{ + ViewBag.Admin = true; + ViewBag.Title = "Audit logs"; +} + +

Audit logs

+ +

Below is a list of all actions carried out by all users on this site.

+ + + + + + + + @foreach(var i in Model.OrderByDescending(x=>x.Timestamp)) + { + + + + + + } +
ActionUser & TimestampLevel
@i.Description@Html.UserLink(i.UserId) at @i.Timestamp@i.Level
\ 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; +} + +

Role details

+ +

@Model.Name

+

ID: @Model.Id

+

Description:

+

@Model.Description

+

Priority: @Model.Priority

+ +
+ +

Users

+ +

Below is a list of users in this role.

+ + + + + + + @foreach(var user in Model.Users) + { + + + + + } +
UserActions
@Html.UserLink(user.UserId) + @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" }) + + +
\ 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 + +@{ + ViewBag.Title = "Administrator Control Panel"; +} + +

Roles

+ +

+ @Html.ActionLink("Create New", "CreateRole") +

+ + + + + + + +@foreach (var item in Model.OrderByDescending(x=>x.Priority)) { + if (ACL.CanManageRole(User.Identity.Name, item.Id)) + { + + + + + + } +} + +
+ Role + PriorityActions
+ @Html.DisplayFor(modelItem => item.Name) (@Html.DisplayFor(modelItem => item.Id)) +

@Html.DisplayFor(modelItem => item.Description)

+
+ @item.Priority + @if (item.Priority < Model.Count() - 1) + { + + } + @if (item.Priority > 0) + { + + } + + + @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" }) + } +
+ +
+ +

Role priorities

+ +

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.

+ +

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?

+ +

You will only see roles on this page that you have permission to alter.

+ +

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.

\ 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 +@{ + ViewBag.Admin = true; + ViewBag.Title = "Users"; +} + +

Users

+ +

Below is a list of all users in the database.

+ + + + + + + @foreach (var user in Model) + { + + + + + } +
UserActions
@Html.UserLink(user.Id) + + @Html.ActionLink("User details", "UserDetails", "Moderator", new { id = user.DisplayName }, new { @class = "btn btn-default" }) + @if (ACL.Granted(User.Identity.Name, "CanAnonymizeUser")) + { + Anonymize this user + + } +
\ No newline at end of file -- cgit v1.2.3