private static bool _CheckRight(EUserRights requestedRight) { Guid sessionKey = _GetSession(); if (sessionKey == Guid.Empty) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden; WebOperationContext.Current.OutgoingResponse.StatusDescription = "No session"; } return(false); } if (!CSessionControl.RequestRight(sessionKey, requestedRight)) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden; WebOperationContext.Current.OutgoingResponse.StatusDescription = "Not allowed"; } return(false); } return(true); }
private static bool _CheckRightWithNoErrorMessage(EUserRights requestedRight) { Guid sessionKey = _GetSession(); if (sessionKey == Guid.Empty) { return(false); } if (!CSessionControl.RequestRight(sessionKey, requestedRight)) { return(false); } return(true); }
internal static bool RequestRight(Guid sessionId, EUserRights requestedRight) { return((CUserRoleControl.GetUserRightsFromUserRole(_ActiveSessions[sessionId].Roles) .HasFlag(requestedRight))); }