summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Admin/Roles.cshtml
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-20 16:45:17 -0400
committerMichael <[email protected]>2017-03-20 16:45:17 -0400
commitcdc61eb4ea5309769ad4db84d92594e4dc3dff67 (patch)
treea8297a7aecc4376f07a497a5e02ab5ff165bfbd3 /Project-Unite/Views/Admin/Roles.cshtml
parentd9f475e1f33bbf39ca0d79d7a6b0c2fd501b4f2d (diff)
downloadproject-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/Roles.cshtml')
-rw-r--r--Project-Unite/Views/Admin/Roles.cshtml65
1 files changed, 65 insertions, 0 deletions
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