protected void Page_Load(object sender, EventArgs e) { var userId = Context.User.Identity.GetUserId(); var user = _userCache.Get(userId); if (!Permissions.CanManageServers(user?.RoleId)) { Response.Redirect("~/Default.aspx"); } AddServer.Visible = true; ServerGrid.Visible = true; if (!Page.IsPostBack) { RefreshGrid(); } }
private void SetPermissions(CachedUser user) { ManageDepartments.Visible = Permissions.CanManageDepartments(user?.RoleId); ManageServers.Visible = Permissions.CanManageServers(user?.RoleId); ManageUsers.Visible = Permissions.CanManageUsers(user?.RoleId); }