@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 Priority Actions
@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 (User.Identity.IsAdmin()) { @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.