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/Roles.cshtml | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Project-Unite/Views/Admin/Roles.cshtml (limited to 'Project-Unite/Views/Admin/Roles.cshtml') 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 -- cgit v1.2.3